xmcp 1.4.1 → 1.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/client/managed.d.ts +23 -0
- package/dist/client.d.ts +4 -0
- package/dist/client.js +70 -0
- package/dist/config/index.d.ts +105 -32
- package/dist/config/schemas/components.d.ts +54 -0
- package/dist/config/schemas/experimental/index.d.ts +4 -4
- package/dist/config/schemas/index.d.ts +1 -0
- package/dist/config.js +1 -1
- package/dist/index.d.ts +3 -3
- package/dist/index.js +59 -66
- package/dist/runtime/adapter-express.js +83 -88
- package/dist/runtime/adapter-fastify.js +83 -88
- package/dist/runtime/adapter-fetch-cloudflare.js +235 -0
- package/dist/runtime/adapter-fetch.js +239 -0
- package/dist/runtime/adapter-nestjs.js +83 -88
- package/dist/runtime/adapter-nextjs.js +82 -87
- package/dist/runtime/cloudflare-worker.js +87 -92
- package/dist/runtime/http.js +92 -97
- package/dist/runtime/stdio.js +71 -76
- package/dist/runtime/utils/component-visibility.d.ts +10 -0
- package/dist/runtime/utils/execution-logger.d.ts +7 -0
- package/dist/runtime/utils/resources.d.ts +2 -2
- package/dist/runtime/utils/server.d.ts +6 -6
- package/dist/runtime/vercel.js +92 -97
- package/package.json +11 -3
- package/dist/runtime/adapter-tanstack-cloudflare.js +0 -240
- package/dist/runtime/adapter-tanstack.js +0 -244
package/dist/config/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { z } from "zod/v3";
|
|
2
1
|
import type { RspackOptions } from "@rspack/core";
|
|
2
|
+
import { z } from "zod/v3";
|
|
3
3
|
/**
|
|
4
4
|
* xmcp Config schema
|
|
5
5
|
*/
|
|
@@ -120,11 +120,11 @@ export declare const configSchema: z.ZodObject<{
|
|
|
120
120
|
} | undefined;
|
|
121
121
|
}>]>>;
|
|
122
122
|
experimental: z.ZodOptional<z.ZodObject<{
|
|
123
|
-
adapter: z.ZodOptional<z.ZodEnum<["express", "nextjs", "nestjs", "fastify", "tanstack"]>>;
|
|
123
|
+
adapter: z.ZodOptional<z.ZodEnum<["express", "nextjs", "nestjs", "fastify", "tanstack", "hono", "sveltekit", "nuxt", "react-router", "astro"]>>;
|
|
124
124
|
}, "strip", z.ZodTypeAny, {
|
|
125
|
-
adapter?: "express" | "nextjs" | "nestjs" | "fastify" | "tanstack" | undefined;
|
|
125
|
+
adapter?: "express" | "nextjs" | "nestjs" | "fastify" | "tanstack" | "hono" | "sveltekit" | "nuxt" | "react-router" | "astro" | undefined;
|
|
126
126
|
}, {
|
|
127
|
-
adapter?: "express" | "nextjs" | "nestjs" | "fastify" | "tanstack" | undefined;
|
|
127
|
+
adapter?: "express" | "nextjs" | "nestjs" | "fastify" | "tanstack" | "hono" | "sveltekit" | "nuxt" | "react-router" | "astro" | undefined;
|
|
128
128
|
}>>;
|
|
129
129
|
paths: z.ZodOptional<z.ZodEffects<z.ZodObject<{
|
|
130
130
|
tools: z.ZodOptional<z.ZodDefault<z.ZodUnion<[z.ZodBoolean, z.ZodString]>>>;
|
|
@@ -225,7 +225,58 @@ export declare const configSchema: z.ZodObject<{
|
|
|
225
225
|
}, {
|
|
226
226
|
skipTypeCheck?: boolean | undefined;
|
|
227
227
|
}>>;
|
|
228
|
+
observability: z.ZodOptional<z.ZodObject<{
|
|
229
|
+
enabled: z.ZodBoolean;
|
|
230
|
+
}, "strip", z.ZodTypeAny, {
|
|
231
|
+
enabled: boolean;
|
|
232
|
+
}, {
|
|
233
|
+
enabled: boolean;
|
|
234
|
+
}>>;
|
|
235
|
+
components: z.ZodOptional<z.ZodObject<{
|
|
236
|
+
include: z.ZodOptional<z.ZodObject<{
|
|
237
|
+
names: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
238
|
+
tags: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
239
|
+
}, "strict", z.ZodTypeAny, {
|
|
240
|
+
tags?: string[] | undefined;
|
|
241
|
+
names?: string[] | undefined;
|
|
242
|
+
}, {
|
|
243
|
+
tags?: string[] | undefined;
|
|
244
|
+
names?: string[] | undefined;
|
|
245
|
+
}>>;
|
|
246
|
+
exclude: z.ZodOptional<z.ZodObject<{
|
|
247
|
+
names: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
248
|
+
tags: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
249
|
+
}, "strict", z.ZodTypeAny, {
|
|
250
|
+
tags?: string[] | undefined;
|
|
251
|
+
names?: string[] | undefined;
|
|
252
|
+
}, {
|
|
253
|
+
tags?: string[] | undefined;
|
|
254
|
+
names?: string[] | undefined;
|
|
255
|
+
}>>;
|
|
256
|
+
}, "strict", z.ZodTypeAny, {
|
|
257
|
+
include?: {
|
|
258
|
+
tags?: string[] | undefined;
|
|
259
|
+
names?: string[] | undefined;
|
|
260
|
+
} | undefined;
|
|
261
|
+
exclude?: {
|
|
262
|
+
tags?: string[] | undefined;
|
|
263
|
+
names?: string[] | undefined;
|
|
264
|
+
} | undefined;
|
|
265
|
+
}, {
|
|
266
|
+
include?: {
|
|
267
|
+
tags?: string[] | undefined;
|
|
268
|
+
names?: string[] | undefined;
|
|
269
|
+
} | undefined;
|
|
270
|
+
exclude?: {
|
|
271
|
+
tags?: string[] | undefined;
|
|
272
|
+
names?: string[] | undefined;
|
|
273
|
+
} | undefined;
|
|
274
|
+
}>>;
|
|
228
275
|
}, "strip", z.ZodTypeAny, {
|
|
276
|
+
stdio?: boolean | {
|
|
277
|
+
debug: boolean;
|
|
278
|
+
silent: boolean;
|
|
279
|
+
} | undefined;
|
|
229
280
|
http?: boolean | {
|
|
230
281
|
port: number;
|
|
231
282
|
host: string;
|
|
@@ -241,6 +292,15 @@ export declare const configSchema: z.ZodObject<{
|
|
|
241
292
|
maxAge: number;
|
|
242
293
|
};
|
|
243
294
|
} | undefined;
|
|
295
|
+
experimental?: {
|
|
296
|
+
adapter?: "express" | "nextjs" | "nestjs" | "fastify" | "tanstack" | "hono" | "sveltekit" | "nuxt" | "react-router" | "astro" | undefined;
|
|
297
|
+
} | undefined;
|
|
298
|
+
paths?: {
|
|
299
|
+
tools: string | boolean;
|
|
300
|
+
prompts: string | boolean;
|
|
301
|
+
resources: string | boolean;
|
|
302
|
+
} | undefined;
|
|
303
|
+
bundler?: ((args_0: any, ...args: unknown[]) => any) | undefined;
|
|
244
304
|
template?: {
|
|
245
305
|
name: string;
|
|
246
306
|
description: string;
|
|
@@ -253,23 +313,27 @@ export declare const configSchema: z.ZodObject<{
|
|
|
253
313
|
instructions?: string | undefined;
|
|
254
314
|
homePage?: string | undefined;
|
|
255
315
|
} | undefined;
|
|
256
|
-
stdio?: boolean | {
|
|
257
|
-
debug: boolean;
|
|
258
|
-
silent: boolean;
|
|
259
|
-
} | undefined;
|
|
260
|
-
experimental?: {
|
|
261
|
-
adapter?: "express" | "nextjs" | "nestjs" | "fastify" | "tanstack" | undefined;
|
|
262
|
-
} | undefined;
|
|
263
|
-
paths?: {
|
|
264
|
-
tools: string | boolean;
|
|
265
|
-
prompts: string | boolean;
|
|
266
|
-
resources: string | boolean;
|
|
267
|
-
} | undefined;
|
|
268
|
-
bundler?: ((args_0: any, ...args: unknown[]) => any) | undefined;
|
|
269
316
|
typescript?: {
|
|
270
317
|
skipTypeCheck: boolean;
|
|
271
318
|
} | undefined;
|
|
319
|
+
observability?: {
|
|
320
|
+
enabled: boolean;
|
|
321
|
+
} | undefined;
|
|
322
|
+
components?: {
|
|
323
|
+
include?: {
|
|
324
|
+
tags?: string[] | undefined;
|
|
325
|
+
names?: string[] | undefined;
|
|
326
|
+
} | undefined;
|
|
327
|
+
exclude?: {
|
|
328
|
+
tags?: string[] | undefined;
|
|
329
|
+
names?: string[] | undefined;
|
|
330
|
+
} | undefined;
|
|
331
|
+
} | undefined;
|
|
272
332
|
}, {
|
|
333
|
+
stdio?: boolean | {
|
|
334
|
+
debug?: boolean | undefined;
|
|
335
|
+
silent?: boolean | undefined;
|
|
336
|
+
} | undefined;
|
|
273
337
|
http?: boolean | {
|
|
274
338
|
port?: number | undefined;
|
|
275
339
|
host?: string | undefined;
|
|
@@ -285,6 +349,15 @@ export declare const configSchema: z.ZodObject<{
|
|
|
285
349
|
maxAge?: number | undefined;
|
|
286
350
|
} | undefined;
|
|
287
351
|
} | undefined;
|
|
352
|
+
experimental?: {
|
|
353
|
+
adapter?: "express" | "nextjs" | "nestjs" | "fastify" | "tanstack" | "hono" | "sveltekit" | "nuxt" | "react-router" | "astro" | undefined;
|
|
354
|
+
} | undefined;
|
|
355
|
+
paths?: {
|
|
356
|
+
tools?: string | boolean | undefined;
|
|
357
|
+
prompts?: string | boolean | undefined;
|
|
358
|
+
resources?: string | boolean | undefined;
|
|
359
|
+
} | undefined;
|
|
360
|
+
bundler?: ((args_0: any, ...args: unknown[]) => any) | undefined;
|
|
288
361
|
template?: {
|
|
289
362
|
name?: string | undefined;
|
|
290
363
|
description?: string | undefined;
|
|
@@ -297,28 +370,28 @@ export declare const configSchema: z.ZodObject<{
|
|
|
297
370
|
instructions?: string | undefined;
|
|
298
371
|
homePage?: string | undefined;
|
|
299
372
|
} | undefined;
|
|
300
|
-
stdio?: boolean | {
|
|
301
|
-
debug?: boolean | undefined;
|
|
302
|
-
silent?: boolean | undefined;
|
|
303
|
-
} | undefined;
|
|
304
|
-
experimental?: {
|
|
305
|
-
adapter?: "express" | "nextjs" | "nestjs" | "fastify" | "tanstack" | undefined;
|
|
306
|
-
} | undefined;
|
|
307
|
-
paths?: {
|
|
308
|
-
tools?: string | boolean | undefined;
|
|
309
|
-
prompts?: string | boolean | undefined;
|
|
310
|
-
resources?: string | boolean | undefined;
|
|
311
|
-
} | undefined;
|
|
312
|
-
bundler?: ((args_0: any, ...args: unknown[]) => any) | undefined;
|
|
313
373
|
typescript?: {
|
|
314
374
|
skipTypeCheck?: boolean | undefined;
|
|
315
375
|
} | undefined;
|
|
376
|
+
observability?: {
|
|
377
|
+
enabled: boolean;
|
|
378
|
+
} | undefined;
|
|
379
|
+
components?: {
|
|
380
|
+
include?: {
|
|
381
|
+
tags?: string[] | undefined;
|
|
382
|
+
names?: string[] | undefined;
|
|
383
|
+
} | undefined;
|
|
384
|
+
exclude?: {
|
|
385
|
+
tags?: string[] | undefined;
|
|
386
|
+
names?: string[] | undefined;
|
|
387
|
+
} | undefined;
|
|
388
|
+
} | undefined;
|
|
316
389
|
}>;
|
|
317
390
|
type BundlerConfigType = {
|
|
318
391
|
bundler?: (config: RspackOptions) => RspackOptions;
|
|
319
392
|
};
|
|
320
393
|
export type XmcpConfigInputSchema = Omit<z.input<typeof configSchema>, "bundler"> & BundlerConfigType;
|
|
321
394
|
export type XmcpConfigOutputSchema = Omit<z.output<typeof configSchema>, "bundler"> & BundlerConfigType;
|
|
322
|
-
export type {
|
|
323
|
-
export type {
|
|
395
|
+
export type { ResolvedExperimentalConfig, ResolvedHttpConfig, ResolvedPathsConfig, ResolvedStdioConfig, } from "./utils";
|
|
396
|
+
export type { BundlerConfig, ComponentsConfig, ComponentSelector, CorsConfig, ExperimentalConfig, HttpTransportConfig, PathsConfig, StdioTransportConfig, TemplateConfig, TypescriptConfig, } from "./schemas";
|
|
324
397
|
export { getResolvedCorsConfig, getResolvedExperimentalConfig, getResolvedHttpConfig, getResolvedPathsConfig, getResolvedStdioConfig, getResolvedTemplateConfig, getResolvedTypescriptConfig, } from "./utils";
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { z } from "zod/v3";
|
|
2
|
+
declare const componentSelectorSchema: z.ZodObject<{
|
|
3
|
+
names: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
4
|
+
tags: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
5
|
+
}, "strict", z.ZodTypeAny, {
|
|
6
|
+
tags?: string[] | undefined;
|
|
7
|
+
names?: string[] | undefined;
|
|
8
|
+
}, {
|
|
9
|
+
tags?: string[] | undefined;
|
|
10
|
+
names?: string[] | undefined;
|
|
11
|
+
}>;
|
|
12
|
+
export declare const componentsConfigSchema: z.ZodObject<{
|
|
13
|
+
include: z.ZodOptional<z.ZodObject<{
|
|
14
|
+
names: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
15
|
+
tags: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
16
|
+
}, "strict", z.ZodTypeAny, {
|
|
17
|
+
tags?: string[] | undefined;
|
|
18
|
+
names?: string[] | undefined;
|
|
19
|
+
}, {
|
|
20
|
+
tags?: string[] | undefined;
|
|
21
|
+
names?: string[] | undefined;
|
|
22
|
+
}>>;
|
|
23
|
+
exclude: z.ZodOptional<z.ZodObject<{
|
|
24
|
+
names: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
25
|
+
tags: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
|
|
26
|
+
}, "strict", z.ZodTypeAny, {
|
|
27
|
+
tags?: string[] | undefined;
|
|
28
|
+
names?: string[] | undefined;
|
|
29
|
+
}, {
|
|
30
|
+
tags?: string[] | undefined;
|
|
31
|
+
names?: string[] | undefined;
|
|
32
|
+
}>>;
|
|
33
|
+
}, "strict", z.ZodTypeAny, {
|
|
34
|
+
include?: {
|
|
35
|
+
tags?: string[] | undefined;
|
|
36
|
+
names?: string[] | undefined;
|
|
37
|
+
} | undefined;
|
|
38
|
+
exclude?: {
|
|
39
|
+
tags?: string[] | undefined;
|
|
40
|
+
names?: string[] | undefined;
|
|
41
|
+
} | undefined;
|
|
42
|
+
}, {
|
|
43
|
+
include?: {
|
|
44
|
+
tags?: string[] | undefined;
|
|
45
|
+
names?: string[] | undefined;
|
|
46
|
+
} | undefined;
|
|
47
|
+
exclude?: {
|
|
48
|
+
tags?: string[] | undefined;
|
|
49
|
+
names?: string[] | undefined;
|
|
50
|
+
} | undefined;
|
|
51
|
+
}>;
|
|
52
|
+
export type ComponentSelector = z.infer<typeof componentSelectorSchema>;
|
|
53
|
+
export type ComponentsConfig = z.infer<typeof componentsConfigSchema>;
|
|
54
|
+
export {};
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { z } from "zod/v3";
|
|
2
|
-
export declare const adapterConfigSchema: z.ZodEnum<["express", "nextjs", "nestjs", "fastify", "tanstack"]>;
|
|
2
|
+
export declare const adapterConfigSchema: z.ZodEnum<["express", "nextjs", "nestjs", "fastify", "tanstack", "hono", "sveltekit", "nuxt", "react-router", "astro"]>;
|
|
3
3
|
export type AdapterConfig = z.infer<typeof adapterConfigSchema>;
|
|
4
4
|
export declare const experimentalConfigSchema: z.ZodObject<{
|
|
5
|
-
adapter: z.ZodOptional<z.ZodEnum<["express", "nextjs", "nestjs", "fastify", "tanstack"]>>;
|
|
5
|
+
adapter: z.ZodOptional<z.ZodEnum<["express", "nextjs", "nestjs", "fastify", "tanstack", "hono", "sveltekit", "nuxt", "react-router", "astro"]>>;
|
|
6
6
|
}, "strip", z.ZodTypeAny, {
|
|
7
|
-
adapter?: "express" | "nextjs" | "nestjs" | "fastify" | "tanstack" | undefined;
|
|
7
|
+
adapter?: "express" | "nextjs" | "nestjs" | "fastify" | "tanstack" | "hono" | "sveltekit" | "nuxt" | "react-router" | "astro" | undefined;
|
|
8
8
|
}, {
|
|
9
|
-
adapter?: "express" | "nextjs" | "nestjs" | "fastify" | "tanstack" | undefined;
|
|
9
|
+
adapter?: "express" | "nextjs" | "nestjs" | "fastify" | "tanstack" | "hono" | "sveltekit" | "nuxt" | "react-router" | "astro" | undefined;
|
|
10
10
|
}>;
|
|
11
11
|
export type ExperimentalConfig = z.infer<typeof experimentalConfigSchema>;
|
|
@@ -5,3 +5,4 @@ export { pathsConfigSchema, type PathsConfig, DEFAULT_PATHS } from "./paths";
|
|
|
5
5
|
export { bundlerConfigSchema, type BundlerConfig } from "./bundler";
|
|
6
6
|
export { templateConfigSchema, type TemplateConfig } from "./template";
|
|
7
7
|
export { typescriptConfigSchema, type TypescriptConfig } from "./typescript";
|
|
8
|
+
export { componentsConfigSchema, type ComponentsConfig, type ComponentSelector, } from "./components";
|
package/dist/config.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
!function(e,t){if("object"==typeof exports&&"object"==typeof module)module.exports=t(require("zod/v3"));else if("function"==typeof define&&define.amd)define(["zod/v3"],t);else{var o="object"==typeof exports?t(require("zod/v3")):t(e["zod/v3"]);for(var r in o)("object"==typeof exports?exports:e)[r]=o[r]}}(this,e=>(()=>{"use strict";var t={4953(t){t.exports=e}},o={};function r(e){var n=o[e];if(void 0!==n)return n.exports;var s=o[e]={exports:{}};return t[e](s,s.exports,r),s.exports}r.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return r.d(t,{a:t}),t},r.d=(e,t)=>{for(var o in t)r.o(t,o)&&!r.o(e,o)&&Object.defineProperty(e,o,{enumerable:!0,get:t[o]})},r.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var n={};return(()=>{r.r(n),r.d(n,{getResolvedHttpConfig:()=>
|
|
1
|
+
!function(e,t){if("object"==typeof exports&&"object"==typeof module)module.exports=t(require("zod/v3"));else if("function"==typeof define&&define.amd)define(["zod/v3"],t);else{var o="object"==typeof exports?t(require("zod/v3")):t(e["zod/v3"]);for(var r in o)("object"==typeof exports?exports:e)[r]=o[r]}}(this,e=>(()=>{"use strict";var t={4953(t){t.exports=e}},o={};function r(e){var n=o[e];if(void 0!==n)return n.exports;var s=o[e]={exports:{}};return t[e](s,s.exports,r),s.exports}r.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return r.d(t,{a:t}),t},r.d=(e,t)=>{for(var o in t)r.o(t,o)&&!r.o(e,o)&&Object.defineProperty(e,o,{enumerable:!0,get:t[o]})},r.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var n={};return(()=>{r.r(n),r.d(n,{getResolvedHttpConfig:()=>T,configSchema:()=>q,getResolvedStdioConfig:()=>R,getResolvedTypescriptConfig:()=>_,getResolvedCorsConfig:()=>E,getResolvedPathsConfig:()=>P,getResolvedExperimentalConfig:()=>M,getResolvedTemplateConfig:()=>k});var e=r(4953),t=r.n(e);let o=["x-mcp-client-name","x-mcp-client-version","x-mcp-client-title","x-mcp-client-website-url","x-mcp-client-description"],s={origin:"*",methods:["GET","POST"],allowedHeaders:["Content-Type","Authorization","mcp-session-id","mcp-protocol-version","mcp-method","mcp-name",...o],exposedHeaders:["Content-Type","Authorization","mcp-session-id"],credentials:!1,maxAge:86400},i=e.z.object({origin:e.z.union([e.z.string(),e.z.array(e.z.string()),e.z.boolean()]).default(s.origin),methods:e.z.union([e.z.string(),e.z.array(e.z.string())]).default([...s.methods]),allowedHeaders:e.z.union([e.z.string(),e.z.array(e.z.string())]).default([...s.allowedHeaders]),exposedHeaders:e.z.union([e.z.string(),e.z.array(e.z.string())]).default([...s.exposedHeaders]),credentials:e.z.boolean().default(s.credentials),maxAge:e.z.number().default(s.maxAge)}),l=i.parse({}),a=i.partial().transform(e=>{let t=Object.fromEntries(Object.entries(e).filter(([e,t])=>void 0!==t)),r={...l,...t};if(Array.isArray(r.allowedHeaders)){let e=new Set(r.allowedHeaders);for(let t of(e.add("mcp-session-id"),e.add("mcp-protocol-version"),e.add("mcp-method"),e.add("mcp-name"),o))e.add(t);r.allowedHeaders=Array.from(e)}if(Array.isArray(r.exposedHeaders)){let e=new Set(r.exposedHeaders);e.add("mcp-session-id"),r.exposedHeaders=Array.from(e)}return r}),p=e.z.object({port:e.z.number().default(3001),host:e.z.string().default("127.0.0.1"),bodySizeLimit:e.z.number().default(0xa00000),debug:e.z.boolean().default(!1),endpoint:e.z.string().default("/mcp"),cors:a}),u=p.partial().transform(e=>{let t=p.parse({cors:{}}),o=Object.fromEntries(Object.entries(e).filter(([e,t])=>void 0!==t));return{...t,...o}}),d=e.z.union([e.z.boolean(),u]);d.transform(e=>"boolean"==typeof e?e?{}:null:e).pipe(e.z.union([e.z.literal(null),u]));let c=e.z.object({debug:e.z.boolean().default(!1),silent:e.z.boolean().default(!1)}),f=c.partial().transform(e=>{let t=c.parse({}),o=Object.fromEntries(Object.entries(e).filter(([e,t])=>void 0!==t));return{...t,...o}}),m=e.z.union([e.z.boolean(),f]).optional(),z=e.z.enum(["express","nextjs","nestjs","fastify","tanstack","hono","sveltekit","nuxt","react-router","astro"]),b=e.z.object({adapter:z.optional()}),g=e.z.object({tools:e.z.union([e.z.boolean(),e.z.string()]).default(!0),prompts:e.z.union([e.z.boolean(),e.z.string()]).default(!0),resources:e.z.union([e.z.boolean(),e.z.string()]).default(!0)}),y=g.partial().transform(e=>{let t=g.parse({}),o=Object.fromEntries(Object.entries(e).filter(([e,t])=>void 0!==t));return{...t,...o}}),j="src/tools",v="src/prompts",x="src/resources",h=t().function().args(t().any()).returns(t().any()).optional(),O=e.z.object({name:e.z.string().default("xmcp server"),description:e.z.string().default("This MCP server was bootstrapped with xmcp."),icons:e.z.array(e.z.object({src:e.z.string(),mimeType:e.z.string().optional(),sizes:e.z.array(e.z.string()).optional(),theme:e.z.enum(["light","dark"]).optional()})).optional(),instructions:e.z.string().optional(),homePage:e.z.string().optional()}),H=O.partial().transform(e=>{let t=O.parse({}),o=Object.fromEntries(Object.entries(e).filter(([e,t])=>void 0!==t));return{...t,...o}}),w=e.z.object({skipTypeCheck:e.z.boolean().default(!1)}),C=w.partial().transform(e=>{let t=w.parse({}),o=Object.fromEntries(Object.entries(e).filter(([e,t])=>void 0!==t));return{...t,...o}}),A=e.z.object({names:e.z.array(e.z.string().min(1)).optional(),tags:e.z.array(e.z.string().min(1)).optional()}).strict(),S=e.z.object({include:A.optional(),exclude:A.optional()}).strict();function T(e){if("boolean"==typeof e){if(!e)return null;let t=d.parse({});return"object"!=typeof t||null===t?null:t}if("object"==typeof e&&null!==e){let t=d.parse(e);return"object"!=typeof t||null===t?null:t}return null}function E(e){return a.parse(e?.cors??{})}function P(e){let t=e?.paths;if(!t)return{tools:j,prompts:v,resources:x};let o={tools:j,prompts:v,resources:x};return"boolean"==typeof t.tools?o.tools=t.tools?j:null:"string"==typeof t.tools&&(o.tools=t.tools),"boolean"==typeof t.prompts?o.prompts=t.prompts?v:null:"string"==typeof t.prompts&&(o.prompts=t.prompts),"boolean"==typeof t.resources?o.resources=t.resources?x:null:"string"==typeof t.resources&&(o.resources=t.resources),o}function R(e){let t=e?.stdio;if("boolean"==typeof t){if(!t)return null;let e=m.parse({});return"object"!=typeof e||null===e?null:e}if(t){let e=m.parse(t);return"object"!=typeof e||null===e?null:e}let o=m.parse({});return"object"!=typeof o||null===o?null:o}function k(e){let t=e?.template;return H.parse(t??{})}function M(e){let t=e?.experimental;return{adapter:t?.adapter}}function _(e){let t=e?.typescript;return C.parse(t??{})}let q=e.z.object({stdio:m.optional(),http:d.optional(),experimental:b.optional(),paths:y.optional(),bundler:h.optional(),template:H.optional(),typescript:C.optional(),observability:e.z.object({enabled:e.z.boolean()}).optional(),components:S.optional()})})(),n})());
|
package/dist/index.d.ts
CHANGED
|
@@ -5,7 +5,7 @@ export type { McpClientInfo } from "./types/client-info";
|
|
|
5
5
|
export type { PromptMetadata, PromptMessage, GetPromptResult, } from "./types/prompt";
|
|
6
6
|
export type { ResourceMetadata, ResourceCompletions } from "./types/resource";
|
|
7
7
|
export type { UIMetadata } from "./types/ui-meta";
|
|
8
|
-
export type { XmcpConfigInputSchema as XmcpConfig } from "./config";
|
|
8
|
+
export type { XmcpConfigInputSchema as XmcpConfig } from "./config/index";
|
|
9
9
|
import "./types/declarations";
|
|
10
10
|
export { apiKeyAuthMiddleware } from "./auth/api-key";
|
|
11
11
|
export { jwtAuthMiddleware } from "./auth/jwt";
|
|
@@ -15,9 +15,9 @@ export { getRequestContext } from "./runtime/contexts/request-context";
|
|
|
15
15
|
export type { RequestContext } from "./runtime/contexts/request-context";
|
|
16
16
|
export { completable, UrlElicitationRequiredError, inputRequired, inputResponse, acceptedContent, isInputRequiredResult, createRequestStateCodec, } from "@modelcontextprotocol/server";
|
|
17
17
|
export type { InputRequiredResult, InputRequests, InputResponses, RequestStateCodec, } from "@modelcontextprotocol/server";
|
|
18
|
-
export { createHTTPClient, createSTDIOClient, listSTDIOClientTools, callSTDIOClientTool, disconnectSTDIOClient, } from "./client";
|
|
18
|
+
export { createHTTPClient, createSTDIOClient, listSTDIOClientTools, callSTDIOClientTool, disconnectSTDIOClient, } from "./client/index";
|
|
19
19
|
export type { HttpClient, StdioClient, StdioIOStrategy, ClientConnectionEntry, ClientConnections, ClientDefinition, HttpClientConfig, StdioClientConfig, } from "./client/types";
|
|
20
|
-
export type { StdioClientConnection, StdioClientOptions } from "./client";
|
|
20
|
+
export type { StdioClientConnection, StdioClientOptions } from "./client/index";
|
|
21
21
|
export type { CustomHeaders, CustomHeader, StaticHeader, EnvHeader, } from "./client/headers";
|
|
22
22
|
export { isEnvHeader, headersToRecord } from "./client/headers";
|
|
23
23
|
export { extractToolNamesFromRequest } from "./runtime/utils/request-tool-names";
|