@kubb/plugin-mcp 5.0.0-alpha.27 → 5.0.0-alpha.29

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/index.js CHANGED
@@ -1,74 +1,1010 @@
1
1
  import "./chunk--u3MIqq1.js";
2
- import { n as camelCase } from "./Server-kM1BVYP3.js";
3
- import { n as mcpGenerator, t as serverGenerator } from "./generators-Cc2InAz4.js";
4
2
  import path from "node:path";
5
- import { createPlugin, getBarrelFiles, getMode } from "@kubb/core";
3
+ import { caseParams, createFunctionParameter, createFunctionParameters, createOperationParams, createParameterGroup, transform, walk } from "@kubb/ast";
4
+ import { functionPrinter, pluginTsName } from "@kubb/plugin-ts";
5
+ import { Const, File, Function as Function$1 } from "@kubb/react-fabric";
6
+ import { Fragment, jsx, jsxs } from "@kubb/react-fabric/jsx-runtime";
7
+ import { createPlugin, defineGenerator, definePresets, defineResolver, getBarrelFiles, getPreset, runGeneratorOperation, runGeneratorOperations, runGeneratorSchema } from "@kubb/core";
8
+ import { pluginZodName } from "@kubb/plugin-zod";
6
9
  import { pluginClientName } from "@kubb/plugin-client";
7
10
  import { source } from "@kubb/plugin-client/templates/clients/axios.source";
8
11
  import { source as source$1 } from "@kubb/plugin-client/templates/clients/fetch.source";
9
12
  import { source as source$2 } from "@kubb/plugin-client/templates/config.source";
10
- import { OperationGenerator, pluginOasName } from "@kubb/plugin-oas";
11
- import { pluginTsName } from "@kubb/plugin-ts";
12
- import { pluginZodName } from "@kubb/plugin-zod";
13
+ //#region ../../internals/utils/src/casing.ts
14
+ /**
15
+ * Shared implementation for camelCase and PascalCase conversion.
16
+ * Splits on common word boundaries (spaces, hyphens, underscores, dots, slashes, colons)
17
+ * and capitalizes each word according to `pascal`.
18
+ *
19
+ * When `pascal` is `true` the first word is also capitalized (PascalCase), otherwise only subsequent words are.
20
+ */
21
+ function toCamelOrPascal(text, pascal) {
22
+ return text.trim().replace(/([a-z\d])([A-Z])/g, "$1 $2").replace(/([A-Z]+)([A-Z][a-z])/g, "$1 $2").replace(/(\d)([a-z])/g, "$1 $2").split(/[\s\-_./\\:]+/).filter(Boolean).map((word, i) => {
23
+ if (word.length > 1 && word === word.toUpperCase()) return word;
24
+ if (i === 0 && !pascal) return word.charAt(0).toLowerCase() + word.slice(1);
25
+ return word.charAt(0).toUpperCase() + word.slice(1);
26
+ }).join("").replace(/[^a-zA-Z0-9]/g, "");
27
+ }
28
+ /**
29
+ * Splits `text` on `.` and applies `transformPart` to each segment.
30
+ * The last segment receives `isLast = true`, all earlier segments receive `false`.
31
+ * Segments are joined with `/` to form a file path.
32
+ *
33
+ * Only splits on dots followed by a letter so that version numbers
34
+ * embedded in operationIds (e.g. `v2025.0`) are kept intact.
35
+ */
36
+ function applyToFileParts(text, transformPart) {
37
+ const parts = text.split(/\.(?=[a-zA-Z])/);
38
+ return parts.map((part, i) => transformPart(part, i === parts.length - 1)).join("/");
39
+ }
40
+ /**
41
+ * Converts `text` to camelCase.
42
+ * When `isFile` is `true`, dot-separated segments are each cased independently and joined with `/`.
43
+ *
44
+ * @example
45
+ * camelCase('hello-world') // 'helloWorld'
46
+ * camelCase('pet.petId', { isFile: true }) // 'pet/petId'
47
+ */
48
+ function camelCase(text, { isFile, prefix = "", suffix = "" } = {}) {
49
+ if (isFile) return applyToFileParts(text, (part, isLast) => camelCase(part, isLast ? {
50
+ prefix,
51
+ suffix
52
+ } : {}));
53
+ return toCamelOrPascal(`${prefix} ${text} ${suffix}`, false);
54
+ }
55
+ //#endregion
56
+ //#region ../../internals/utils/src/reserved.ts
57
+ /**
58
+ * Returns `true` when `name` is a syntactically valid JavaScript variable name.
59
+ *
60
+ * @example
61
+ * ```ts
62
+ * isValidVarName('status') // true
63
+ * isValidVarName('class') // false (reserved word)
64
+ * isValidVarName('42foo') // false (starts with digit)
65
+ * ```
66
+ */
67
+ function isValidVarName(name) {
68
+ try {
69
+ new Function(`var ${name}`);
70
+ } catch {
71
+ return false;
72
+ }
73
+ return true;
74
+ }
75
+ //#endregion
76
+ //#region ../../internals/utils/src/urlPath.ts
77
+ /**
78
+ * Parses and transforms an OpenAPI/Swagger path string into various URL formats.
79
+ *
80
+ * @example
81
+ * const p = new URLPath('/pet/{petId}')
82
+ * p.URL // '/pet/:petId'
83
+ * p.template // '`/pet/${petId}`'
84
+ */
85
+ var URLPath = class {
86
+ /**
87
+ * The raw OpenAPI/Swagger path string, e.g. `/pet/{petId}`.
88
+ */
89
+ path;
90
+ #options;
91
+ constructor(path, options = {}) {
92
+ this.path = path;
93
+ this.#options = options;
94
+ }
95
+ /** Converts the OpenAPI path to Express-style colon syntax, e.g. `/pet/{petId}` → `/pet/:petId`.
96
+ *
97
+ * @example
98
+ * ```ts
99
+ * new URLPath('/pet/{petId}').URL // '/pet/:petId'
100
+ * ```
101
+ */
102
+ get URL() {
103
+ return this.toURLPath();
104
+ }
105
+ /** Returns `true` when `path` is a fully-qualified URL (e.g. starts with `https://`).
106
+ *
107
+ * @example
108
+ * ```ts
109
+ * new URLPath('https://petstore.swagger.io/v2/pet').isURL // true
110
+ * new URLPath('/pet/{petId}').isURL // false
111
+ * ```
112
+ */
113
+ get isURL() {
114
+ try {
115
+ return !!new URL(this.path).href;
116
+ } catch {
117
+ return false;
118
+ }
119
+ }
120
+ /**
121
+ * Converts the OpenAPI path to a TypeScript template literal string.
122
+ *
123
+ * @example
124
+ * new URLPath('/pet/{petId}').template // '`/pet/${petId}`'
125
+ * new URLPath('/account/monetary-accountID').template // '`/account/${monetaryAccountId}`'
126
+ */
127
+ get template() {
128
+ return this.toTemplateString();
129
+ }
130
+ /** Returns the path and its extracted params as a structured `URLObject`, or as a stringified expression when `stringify` is set.
131
+ *
132
+ * @example
133
+ * ```ts
134
+ * new URLPath('/pet/{petId}').object
135
+ * // { url: '/pet/:petId', params: { petId: 'petId' } }
136
+ * ```
137
+ */
138
+ get object() {
139
+ return this.toObject();
140
+ }
141
+ /** Returns a map of path parameter names, or `undefined` when the path has no parameters.
142
+ *
143
+ * @example
144
+ * ```ts
145
+ * new URLPath('/pet/{petId}').params // { petId: 'petId' }
146
+ * new URLPath('/pet').params // undefined
147
+ * ```
148
+ */
149
+ get params() {
150
+ return this.getParams();
151
+ }
152
+ #transformParam(raw) {
153
+ const param = isValidVarName(raw) ? raw : camelCase(raw);
154
+ return this.#options.casing === "camelcase" ? camelCase(param) : param;
155
+ }
156
+ /**
157
+ * Iterates over every `{param}` token in `path`, calling `fn` with the raw token and transformed name.
158
+ */
159
+ #eachParam(fn) {
160
+ for (const match of this.path.matchAll(/\{([^}]+)\}/g)) {
161
+ const raw = match[1];
162
+ fn(raw, this.#transformParam(raw));
163
+ }
164
+ }
165
+ toObject({ type = "path", replacer, stringify } = {}) {
166
+ const object = {
167
+ url: type === "path" ? this.toURLPath() : this.toTemplateString({ replacer }),
168
+ params: this.getParams()
169
+ };
170
+ if (stringify) {
171
+ if (type === "template") return JSON.stringify(object).replaceAll("'", "").replaceAll(`"`, "");
172
+ if (object.params) return `{ url: '${object.url}', params: ${JSON.stringify(object.params).replaceAll("'", "").replaceAll(`"`, "")} }`;
173
+ return `{ url: '${object.url}' }`;
174
+ }
175
+ return object;
176
+ }
177
+ /**
178
+ * Converts the OpenAPI path to a TypeScript template literal string.
179
+ * An optional `replacer` can transform each extracted parameter name before interpolation.
180
+ *
181
+ * @example
182
+ * new URLPath('/pet/{petId}').toTemplateString() // '`/pet/${petId}`'
183
+ */
184
+ toTemplateString({ prefix = "", replacer } = {}) {
185
+ return `\`${prefix}${this.path.split(/\{([^}]+)\}/).map((part, i) => {
186
+ if (i % 2 === 0) return part;
187
+ const param = this.#transformParam(part);
188
+ return `\${${replacer ? replacer(param) : param}}`;
189
+ }).join("")}\``;
190
+ }
191
+ /**
192
+ * Extracts all `{param}` segments from the path and returns them as a key-value map.
193
+ * An optional `replacer` transforms each parameter name in both key and value positions.
194
+ * Returns `undefined` when no path parameters are found.
195
+ *
196
+ * @example
197
+ * ```ts
198
+ * new URLPath('/pet/{petId}/tag/{tagId}').getParams()
199
+ * // { petId: 'petId', tagId: 'tagId' }
200
+ * ```
201
+ */
202
+ getParams(replacer) {
203
+ const params = {};
204
+ this.#eachParam((_raw, param) => {
205
+ const key = replacer ? replacer(param) : param;
206
+ params[key] = key;
207
+ });
208
+ return Object.keys(params).length > 0 ? params : void 0;
209
+ }
210
+ /** Converts the OpenAPI path to Express-style colon syntax.
211
+ *
212
+ * @example
213
+ * ```ts
214
+ * new URLPath('/pet/{petId}').toURLPath() // '/pet/:petId'
215
+ * ```
216
+ */
217
+ toURLPath() {
218
+ return this.path.replace(/\{([^}]+)\}/g, ":$1");
219
+ }
220
+ };
221
+ //#endregion
222
+ //#region src/utils.ts
223
+ /**
224
+ * Find the first 2xx response status code from an operation's responses.
225
+ */
226
+ function findSuccessStatusCode(responses) {
227
+ for (const res of responses) {
228
+ const code = Number(res.statusCode);
229
+ if (code >= 200 && code < 300) return res.statusCode;
230
+ }
231
+ }
232
+ /**
233
+ * Render a group param value — either a group schema name directly (kubbV4),
234
+ * or compose individual schemas into `z.object({ ... })` (v5).
235
+ */
236
+ function zodGroupExpr(entry) {
237
+ if (typeof entry === "string") return entry;
238
+ return `z.object({ ${entry.map((p) => `${JSON.stringify(p.name)}: ${p.schemaName}`).join(", ")} })`;
239
+ }
240
+ /**
241
+ * Build JSDoc comment lines from an OperationNode.
242
+ */
243
+ function getComments(node) {
244
+ return [
245
+ node.description && `@description ${node.description}`,
246
+ node.summary && `@summary ${node.summary}`,
247
+ node.deprecated && "@deprecated",
248
+ `{@link ${node.path.replaceAll("{", ":").replaceAll("}", "")}}`
249
+ ].filter((x) => Boolean(x));
250
+ }
251
+ /**
252
+ * Build a mapping of original param names → camelCase names.
253
+ * Returns `undefined` when no names actually change (no remapping needed).
254
+ */
255
+ function getParamsMapping(params) {
256
+ if (!params.length) return;
257
+ const mapping = {};
258
+ let hasDifference = false;
259
+ for (const p of params) {
260
+ const camelName = camelCase(p.name);
261
+ mapping[p.name] = camelName;
262
+ if (p.name !== camelName) hasDifference = true;
263
+ }
264
+ return hasDifference ? mapping : void 0;
265
+ }
266
+ /**
267
+ * Convert a SchemaNode type to an inline Zod expression string.
268
+ * Used as fallback when no named zod schema is available for a path parameter.
269
+ */
270
+ function zodExprFromSchemaNode(schema) {
271
+ let expr;
272
+ switch (schema.type) {
273
+ case "integer":
274
+ expr = "z.coerce.number()";
275
+ break;
276
+ case "number":
277
+ expr = "z.number()";
278
+ break;
279
+ case "boolean":
280
+ expr = "z.boolean()";
281
+ break;
282
+ case "array":
283
+ expr = "z.array(z.unknown())";
284
+ break;
285
+ default: expr = "z.string()";
286
+ }
287
+ if (schema.nullable) expr = `${expr}.nullable()`;
288
+ return expr;
289
+ }
290
+ //#endregion
291
+ //#region src/components/McpHandler.tsx
292
+ /**
293
+ * Generate a remapping statement: `const mappedX = x ? { "orig": x.camel, ... } : undefined`
294
+ */
295
+ function buildRemappingCode(mapping, varName, sourceName) {
296
+ return `const ${varName} = ${sourceName} ? { ${Object.entries(mapping).map(([orig, camel]) => `"${orig}": ${sourceName}.${camel}`).join(", ")} } : undefined`;
297
+ }
298
+ const declarationPrinter = functionPrinter({ mode: "declaration" });
299
+ function McpHandler({ name, node, resolver, baseURL, dataReturnType, paramsCasing }) {
300
+ const urlPath = new URLPath(node.path);
301
+ const contentType = node.requestBody?.contentType;
302
+ const isFormData = contentType === "multipart/form-data";
303
+ const casedParams = caseParams(node.parameters, paramsCasing);
304
+ const queryParams = casedParams.filter((p) => p.in === "query");
305
+ const headerParams = casedParams.filter((p) => p.in === "header");
306
+ const originalPathParams = node.parameters.filter((p) => p.in === "path");
307
+ const originalQueryParams = node.parameters.filter((p) => p.in === "query");
308
+ const originalHeaderParams = node.parameters.filter((p) => p.in === "header");
309
+ const requestName = node.requestBody?.schema ? resolver.resolveDataName(node) : void 0;
310
+ const responseName = resolver.resolveResponseName(node);
311
+ const errorResponses = node.responses.filter((r) => Number(r.statusCode) >= 400).map((r) => resolver.resolveResponseStatusName(node, r.statusCode));
312
+ const generics = [
313
+ responseName,
314
+ `ResponseErrorConfig<${errorResponses.length > 0 ? errorResponses.join(" | ") : "Error"}>`,
315
+ requestName || "unknown"
316
+ ].filter(Boolean);
317
+ const paramsNode = createOperationParams(node, {
318
+ paramsType: "object",
319
+ pathParamsType: "inline",
320
+ resolver,
321
+ paramsCasing
322
+ });
323
+ const paramsSignature = declarationPrinter.print(paramsNode) ?? "";
324
+ const pathParamsMapping = paramsCasing ? getParamsMapping(originalPathParams) : void 0;
325
+ const queryParamsMapping = paramsCasing ? getParamsMapping(originalQueryParams) : void 0;
326
+ const headerParamsMapping = paramsCasing ? getParamsMapping(originalHeaderParams) : void 0;
327
+ const contentTypeHeader = contentType && contentType !== "application/json" && contentType !== "multipart/form-data" ? `'Content-Type': '${contentType}'` : void 0;
328
+ const headers = [headerParams.length ? headerParamsMapping ? "...mappedHeaders" : "...headers" : void 0, contentTypeHeader].filter(Boolean);
329
+ const fetchConfig = [];
330
+ fetchConfig.push(`method: ${JSON.stringify(node.method.toUpperCase())}`);
331
+ fetchConfig.push(`url: ${urlPath.template}`);
332
+ if (baseURL) fetchConfig.push(`baseURL: \`${baseURL}\``);
333
+ if (queryParams.length) fetchConfig.push(queryParamsMapping ? "params: mappedParams" : "params");
334
+ if (requestName) fetchConfig.push(`data: ${isFormData ? "formData as FormData" : "requestData"}`);
335
+ if (headers.length) fetchConfig.push(`headers: { ${headers.join(", ")} }`);
336
+ const callToolResult = dataReturnType === "data" ? `return {
337
+ content: [
338
+ {
339
+ type: 'text',
340
+ text: JSON.stringify(res.data)
341
+ }
342
+ ],
343
+ structuredContent: { data: res.data }
344
+ }` : `return {
345
+ content: [
346
+ {
347
+ type: 'text',
348
+ text: JSON.stringify(res)
349
+ }
350
+ ],
351
+ structuredContent: { data: res.data }
352
+ }`;
353
+ return /* @__PURE__ */ jsx(File.Source, {
354
+ name,
355
+ isExportable: true,
356
+ isIndexable: true,
357
+ children: /* @__PURE__ */ jsxs(Function$1, {
358
+ name,
359
+ async: true,
360
+ export: true,
361
+ params: paramsSignature,
362
+ JSDoc: { comments: getComments(node) },
363
+ returnType: "Promise<CallToolResult>",
364
+ children: [
365
+ "",
366
+ /* @__PURE__ */ jsx("br", {}),
367
+ /* @__PURE__ */ jsx("br", {}),
368
+ pathParamsMapping && Object.entries(pathParamsMapping).filter(([originalName, camelCaseName]) => originalName !== camelCaseName && isValidVarName(originalName)).map(([originalName, camelCaseName]) => `const ${originalName} = ${camelCaseName}`).join("\n"),
369
+ pathParamsMapping && /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx("br", {}), /* @__PURE__ */ jsx("br", {})] }),
370
+ queryParamsMapping && queryParams.length > 0 && /* @__PURE__ */ jsxs(Fragment, { children: [
371
+ buildRemappingCode(queryParamsMapping, "mappedParams", "params"),
372
+ /* @__PURE__ */ jsx("br", {}),
373
+ /* @__PURE__ */ jsx("br", {})
374
+ ] }),
375
+ headerParamsMapping && headerParams.length > 0 && /* @__PURE__ */ jsxs(Fragment, { children: [
376
+ buildRemappingCode(headerParamsMapping, "mappedHeaders", "headers"),
377
+ /* @__PURE__ */ jsx("br", {}),
378
+ /* @__PURE__ */ jsx("br", {})
379
+ ] }),
380
+ requestName && "const requestData = data",
381
+ /* @__PURE__ */ jsx("br", {}),
382
+ isFormData && requestName && "const formData = buildFormData(requestData)",
383
+ /* @__PURE__ */ jsx("br", {}),
384
+ `const res = await fetch<${generics.join(", ")}>({ ${fetchConfig.join(", ")} })`,
385
+ /* @__PURE__ */ jsx("br", {}),
386
+ callToolResult
387
+ ]
388
+ })
389
+ });
390
+ }
391
+ //#endregion
392
+ //#region src/components/Server.tsx
393
+ const keysPrinter = functionPrinter({ mode: "keys" });
394
+ function Server({ name, serverName, serverVersion, paramsCasing, operations }) {
395
+ return /* @__PURE__ */ jsxs(File.Source, {
396
+ name,
397
+ isExportable: true,
398
+ isIndexable: true,
399
+ children: [
400
+ /* @__PURE__ */ jsx(Const, {
401
+ name: "server",
402
+ export: true,
403
+ children: `
404
+ new McpServer({
405
+ name: '${serverName}',
406
+ version: '${serverVersion}',
407
+ })
408
+ `
409
+ }),
410
+ operations.map(({ tool, mcp, zod, node }) => {
411
+ const pathParams = caseParams(node.parameters, paramsCasing).filter((p) => p.in === "path");
412
+ const pathEntries = [];
413
+ const otherEntries = [];
414
+ for (const p of pathParams) {
415
+ const zodParam = zod.pathParams.find((zp) => zp.name === p.name);
416
+ pathEntries.push({
417
+ key: p.name,
418
+ value: zodParam ? zodParam.schemaName : zodExprFromSchemaNode(p.schema)
419
+ });
420
+ }
421
+ if (zod.requestName) otherEntries.push({
422
+ key: "data",
423
+ value: zod.requestName
424
+ });
425
+ if (zod.queryParams) otherEntries.push({
426
+ key: "params",
427
+ value: zodGroupExpr(zod.queryParams)
428
+ });
429
+ if (zod.headerParams) otherEntries.push({
430
+ key: "headers",
431
+ value: zodGroupExpr(zod.headerParams)
432
+ });
433
+ otherEntries.sort((a, b) => a.key.localeCompare(b.key));
434
+ const entries = [...pathEntries, ...otherEntries];
435
+ const paramsNode = entries.length ? createFunctionParameters({ params: [createParameterGroup({ properties: entries.map((e) => createFunctionParameter({
436
+ name: e.key,
437
+ optional: false
438
+ })) })] }) : void 0;
439
+ const destructured = paramsNode ? keysPrinter.print(paramsNode) ?? "" : "";
440
+ const inputSchema = entries.length ? `{ ${entries.map((e) => `${e.key}: ${e.value}`).join(", ")} }` : void 0;
441
+ const outputSchema = zod.responseName;
442
+ const config = [
443
+ tool.title ? `title: ${JSON.stringify(tool.title)}` : null,
444
+ `description: ${JSON.stringify(tool.description)}`,
445
+ outputSchema ? `outputSchema: { data: ${outputSchema} }` : null
446
+ ].filter(Boolean).join(",\n ");
447
+ if (inputSchema) return `
448
+ server.registerTool(${JSON.stringify(tool.name)}, {
449
+ ${config},
450
+ inputSchema: ${inputSchema},
451
+ }, async (${destructured}) => {
452
+ return ${mcp.name}(${destructured})
453
+ })
454
+ `;
455
+ return `
456
+ server.registerTool(${JSON.stringify(tool.name)}, {
457
+ ${config},
458
+ }, async () => {
459
+ return ${mcp.name}()
460
+ })
461
+ `;
462
+ }).filter(Boolean),
463
+ /* @__PURE__ */ jsx(Function$1, {
464
+ name: "startServer",
465
+ async: true,
466
+ export: true,
467
+ children: `try {
468
+ const transport = new StdioServerTransport()
469
+ await server.connect(transport)
470
+
471
+ } catch (error) {
472
+ console.error('Failed to start server:', error)
473
+ process.exit(1)
474
+ }`
475
+ })
476
+ ]
477
+ });
478
+ }
479
+ //#endregion
480
+ //#region src/generators/mcpGenerator.tsx
481
+ const mcpGenerator = defineGenerator({
482
+ name: "mcp",
483
+ type: "react",
484
+ Operation({ node, options, config, driver, resolver, plugin }) {
485
+ const { output, client, paramsCasing, group } = options;
486
+ const root = path.resolve(config.root, config.output.path);
487
+ const pluginTs = driver.getPlugin(pluginTsName);
488
+ if (!pluginTs?.resolver) return null;
489
+ const transformedNode = plugin.transformer ? transform(node, plugin.transformer) : node;
490
+ const casedParams = caseParams(transformedNode.parameters, paramsCasing);
491
+ const pathParams = casedParams.filter((p) => p.in === "path");
492
+ const queryParams = casedParams.filter((p) => p.in === "query");
493
+ const headerParams = casedParams.filter((p) => p.in === "header");
494
+ const importedTypeNames = [
495
+ ...pathParams.map((p) => pluginTs.resolver.resolvePathParamsName(transformedNode, p)),
496
+ ...queryParams.map((p) => pluginTs.resolver.resolveQueryParamsName(transformedNode, p)),
497
+ ...headerParams.map((p) => pluginTs.resolver.resolveHeaderParamsName(transformedNode, p)),
498
+ transformedNode.requestBody?.schema ? pluginTs.resolver.resolveDataName(transformedNode) : void 0,
499
+ pluginTs.resolver.resolveResponseName(transformedNode),
500
+ ...transformedNode.responses.filter((r) => Number(r.statusCode) >= 400).map((r) => pluginTs.resolver.resolveResponseStatusName(transformedNode, r.statusCode))
501
+ ].filter(Boolean);
502
+ const meta = {
503
+ name: resolver.resolveName(transformedNode.operationId),
504
+ file: resolver.resolveFile({
505
+ name: transformedNode.operationId,
506
+ extname: ".ts",
507
+ tag: transformedNode.tags[0] ?? "default",
508
+ path: transformedNode.path
509
+ }, {
510
+ root,
511
+ output,
512
+ group
513
+ }),
514
+ fileTs: pluginTs.resolver.resolveFile({
515
+ name: transformedNode.operationId,
516
+ extname: ".ts",
517
+ tag: transformedNode.tags[0] ?? "default",
518
+ path: transformedNode.path
519
+ }, {
520
+ root,
521
+ output: pluginTs.options?.output ?? output,
522
+ group: pluginTs.options?.group
523
+ })
524
+ };
525
+ return /* @__PURE__ */ jsxs(File, {
526
+ baseName: meta.file.baseName,
527
+ path: meta.file.path,
528
+ meta: meta.file.meta,
529
+ children: [
530
+ meta.fileTs && importedTypeNames.length > 0 && /* @__PURE__ */ jsx(File.Import, {
531
+ name: Array.from(new Set(importedTypeNames)).sort(),
532
+ root: meta.file.path,
533
+ path: meta.fileTs.path,
534
+ isTypeOnly: true
535
+ }),
536
+ /* @__PURE__ */ jsx(File.Import, {
537
+ name: ["CallToolResult"],
538
+ path: "@modelcontextprotocol/sdk/types",
539
+ isTypeOnly: true
540
+ }),
541
+ /* @__PURE__ */ jsx(File.Import, {
542
+ name: ["buildFormData"],
543
+ root: meta.file.path,
544
+ path: path.resolve(root, ".kubb/config.ts")
545
+ }),
546
+ client.importPath ? /* @__PURE__ */ jsxs(Fragment, { children: [
547
+ /* @__PURE__ */ jsx(File.Import, {
548
+ name: [
549
+ "Client",
550
+ "RequestConfig",
551
+ "ResponseErrorConfig"
552
+ ],
553
+ path: client.importPath,
554
+ isTypeOnly: true
555
+ }),
556
+ /* @__PURE__ */ jsx(File.Import, {
557
+ name: "fetch",
558
+ path: client.importPath
559
+ }),
560
+ client.dataReturnType === "full" && /* @__PURE__ */ jsx(File.Import, {
561
+ name: ["ResponseConfig"],
562
+ path: client.importPath,
563
+ isTypeOnly: true
564
+ })
565
+ ] }) : /* @__PURE__ */ jsxs(Fragment, { children: [
566
+ /* @__PURE__ */ jsx(File.Import, {
567
+ name: [
568
+ "Client",
569
+ "RequestConfig",
570
+ "ResponseErrorConfig"
571
+ ],
572
+ root: meta.file.path,
573
+ path: path.resolve(root, ".kubb/fetch.ts"),
574
+ isTypeOnly: true
575
+ }),
576
+ /* @__PURE__ */ jsx(File.Import, {
577
+ name: ["fetch"],
578
+ root: meta.file.path,
579
+ path: path.resolve(root, ".kubb/fetch.ts")
580
+ }),
581
+ client.dataReturnType === "full" && /* @__PURE__ */ jsx(File.Import, {
582
+ name: ["ResponseConfig"],
583
+ root: meta.file.path,
584
+ path: path.resolve(root, ".kubb/fetch.ts"),
585
+ isTypeOnly: true
586
+ })
587
+ ] }),
588
+ /* @__PURE__ */ jsx(McpHandler, {
589
+ name: meta.name,
590
+ node: transformedNode,
591
+ resolver: pluginTs.resolver,
592
+ baseURL: client.baseURL,
593
+ dataReturnType: client.dataReturnType || "data",
594
+ paramsCasing
595
+ })
596
+ ]
597
+ });
598
+ }
599
+ });
600
+ //#endregion
601
+ //#region src/generators/serverGenerator.tsx
602
+ /**
603
+ * Default server generator for `compatibilityPreset: 'default'` (v5).
604
+ *
605
+ * Uses individual zod schemas for each param (e.g. `createPetsPathUuidSchema`, `createPetsQueryOffsetSchema`)
606
+ * and `resolveResponseStatusName` for per-status response schemas.
607
+ * Query and header params are composed into `z.object({ ... })` from individual schemas.
608
+ */
609
+ const serverGenerator = defineGenerator({
610
+ name: "operations",
611
+ type: "react",
612
+ Operations({ nodes, adapter, options, config, driver, resolver, plugin }) {
613
+ const { output, paramsCasing, group } = options;
614
+ const root = path.resolve(config.root, config.output.path);
615
+ const pluginZod = driver.getPlugin(pluginZodName);
616
+ if (!pluginZod?.resolver) return;
617
+ const name = "server";
618
+ const serverFile = {
619
+ baseName: "server.ts",
620
+ path: path.resolve(root, output.path, "server.ts"),
621
+ meta: { pluginName: plugin.name }
622
+ };
623
+ const jsonFile = {
624
+ baseName: ".mcp.json",
625
+ path: path.resolve(root, output.path, ".mcp.json"),
626
+ meta: { pluginName: plugin.name }
627
+ };
628
+ const operationsMapped = nodes.map((node) => {
629
+ const transformedNode = plugin.transformer ? transform(node, plugin.transformer) : node;
630
+ const casedParams = caseParams(transformedNode.parameters, paramsCasing);
631
+ const pathParams = casedParams.filter((p) => p.in === "path");
632
+ const queryParams = casedParams.filter((p) => p.in === "query");
633
+ const headerParams = casedParams.filter((p) => p.in === "header");
634
+ const mcpFile = resolver.resolveFile({
635
+ name: transformedNode.operationId,
636
+ extname: ".ts",
637
+ tag: transformedNode.tags[0] ?? "default",
638
+ path: transformedNode.path
639
+ }, {
640
+ root,
641
+ output,
642
+ group
643
+ });
644
+ const zodFile = pluginZod.resolver.resolveFile({
645
+ name: transformedNode.operationId,
646
+ extname: ".ts",
647
+ tag: transformedNode.tags[0] ?? "default",
648
+ path: transformedNode.path
649
+ }, {
650
+ root,
651
+ output: pluginZod.options?.output ?? output,
652
+ group: pluginZod.options?.group
653
+ });
654
+ const requestName = transformedNode.requestBody?.schema ? pluginZod.resolver.resolveDataName(transformedNode) : void 0;
655
+ const successStatus = findSuccessStatusCode(transformedNode.responses);
656
+ const responseName = successStatus ? pluginZod.resolver.resolveResponseStatusName(transformedNode, successStatus) : void 0;
657
+ const resolveParams = (params) => params.map((p) => ({
658
+ name: p.name,
659
+ schemaName: pluginZod.resolver.resolveParamName(transformedNode, p)
660
+ }));
661
+ return {
662
+ tool: {
663
+ name: transformedNode.operationId,
664
+ title: transformedNode.summary || void 0,
665
+ description: transformedNode.description || `Make a ${transformedNode.method.toUpperCase()} request to ${transformedNode.path}`
666
+ },
667
+ mcp: {
668
+ name: resolver.resolveName(transformedNode.operationId),
669
+ file: mcpFile
670
+ },
671
+ zod: {
672
+ pathParams: resolveParams(pathParams),
673
+ queryParams: queryParams.length ? resolveParams(queryParams) : void 0,
674
+ headerParams: headerParams.length ? resolveParams(headerParams) : void 0,
675
+ requestName,
676
+ responseName,
677
+ file: zodFile
678
+ },
679
+ node: transformedNode
680
+ };
681
+ });
682
+ const imports = operationsMapped.flatMap(({ mcp, zod }) => {
683
+ const zodNames = [
684
+ ...zod.pathParams.map((p) => p.schemaName),
685
+ ...(zod.queryParams ?? []).map((p) => p.schemaName),
686
+ ...(zod.headerParams ?? []).map((p) => p.schemaName),
687
+ zod.requestName,
688
+ zod.responseName
689
+ ].filter(Boolean);
690
+ const uniqueNames = [...new Set(zodNames)].sort();
691
+ return [/* @__PURE__ */ jsx(File.Import, {
692
+ name: [mcp.name],
693
+ root: serverFile.path,
694
+ path: mcp.file.path
695
+ }, mcp.name), uniqueNames.length > 0 && /* @__PURE__ */ jsx(File.Import, {
696
+ name: uniqueNames,
697
+ root: serverFile.path,
698
+ path: zod.file.path
699
+ }, `zod-${mcp.name}`)].filter(Boolean);
700
+ });
701
+ return /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsxs(File, {
702
+ baseName: serverFile.baseName,
703
+ path: serverFile.path,
704
+ meta: serverFile.meta,
705
+ banner: resolver.resolveBanner(adapter.rootNode, {
706
+ output,
707
+ config
708
+ }),
709
+ footer: resolver.resolveFooter(adapter.rootNode, {
710
+ output,
711
+ config
712
+ }),
713
+ children: [
714
+ /* @__PURE__ */ jsx(File.Import, {
715
+ name: ["McpServer"],
716
+ path: "@modelcontextprotocol/sdk/server/mcp"
717
+ }),
718
+ /* @__PURE__ */ jsx(File.Import, {
719
+ name: ["z"],
720
+ path: "zod"
721
+ }),
722
+ /* @__PURE__ */ jsx(File.Import, {
723
+ name: ["StdioServerTransport"],
724
+ path: "@modelcontextprotocol/sdk/server/stdio"
725
+ }),
726
+ imports,
727
+ /* @__PURE__ */ jsx(Server, {
728
+ name,
729
+ serverName: adapter.rootNode?.meta?.title ?? "server",
730
+ serverVersion: adapter.rootNode?.meta?.version ?? "0.0.0",
731
+ paramsCasing,
732
+ operations: operationsMapped
733
+ })
734
+ ]
735
+ }), /* @__PURE__ */ jsx(File, {
736
+ baseName: jsonFile.baseName,
737
+ path: jsonFile.path,
738
+ meta: jsonFile.meta,
739
+ children: /* @__PURE__ */ jsx(File.Source, {
740
+ name,
741
+ children: `
742
+ {
743
+ "mcpServers": {
744
+ "${adapter.rootNode?.meta?.title || "server"}": {
745
+ "type": "stdio",
746
+ "command": "npx",
747
+ "args": ["tsx", "${path.relative(path.dirname(jsonFile.path), serverFile.path)}"]
748
+ }
749
+ }
750
+ }
751
+ `
752
+ })
753
+ })] });
754
+ }
755
+ });
756
+ //#endregion
757
+ //#region src/generators/serverGeneratorLegacy.tsx
758
+ /**
759
+ * Legacy server generator for `compatibilityPreset: 'kubbV4'`.
760
+ *
761
+ * Uses grouped zod schemas for query/header params (e.g. `createPetsQueryParamsSchema`)
762
+ * and `resolveResponseName` for the combined response schema.
763
+ * Path params are always rendered inline (no named imports).
764
+ */
765
+ const serverGeneratorLegacy = defineGenerator({
766
+ name: "operations",
767
+ type: "react",
768
+ Operations({ nodes, adapter, options, config, driver, resolver, plugin }) {
769
+ const { output, paramsCasing, group } = options;
770
+ const root = path.resolve(config.root, config.output.path);
771
+ const pluginZod = driver.getPlugin(pluginZodName);
772
+ if (!pluginZod?.resolver) return;
773
+ const name = "server";
774
+ const serverFile = {
775
+ baseName: "server.ts",
776
+ path: path.resolve(root, output.path, "server.ts"),
777
+ meta: { pluginName: plugin.name }
778
+ };
779
+ const jsonFile = {
780
+ baseName: ".mcp.json",
781
+ path: path.resolve(root, output.path, ".mcp.json"),
782
+ meta: { pluginName: plugin.name }
783
+ };
784
+ const operationsMapped = nodes.map((node) => {
785
+ const transformedNode = plugin.transformer ? transform(node, plugin.transformer) : node;
786
+ const casedParams = caseParams(transformedNode.parameters, paramsCasing);
787
+ const queryParams = casedParams.filter((p) => p.in === "query");
788
+ const headerParams = casedParams.filter((p) => p.in === "header");
789
+ const mcpFile = resolver.resolveFile({
790
+ name: transformedNode.operationId,
791
+ extname: ".ts",
792
+ tag: transformedNode.tags[0] ?? "default",
793
+ path: transformedNode.path
794
+ }, {
795
+ root,
796
+ output,
797
+ group
798
+ });
799
+ const zodFile = pluginZod?.resolver.resolveFile({
800
+ name: transformedNode.operationId,
801
+ extname: ".ts",
802
+ tag: transformedNode.tags[0] ?? "default",
803
+ path: transformedNode.path
804
+ }, {
805
+ root,
806
+ output: pluginZod?.options?.output ?? output,
807
+ group: pluginZod?.options?.group
808
+ });
809
+ const requestName = transformedNode.requestBody?.schema ? pluginZod?.resolver.resolveDataName(transformedNode) : void 0;
810
+ const responseName = pluginZod?.resolver.resolveResponseName(transformedNode);
811
+ const zodQueryParams = queryParams.length ? pluginZod?.resolver.resolveQueryParamsName(transformedNode, queryParams[0]) : void 0;
812
+ const zodHeaderParams = headerParams.length ? pluginZod?.resolver.resolveHeaderParamsName(transformedNode, headerParams[0]) : void 0;
813
+ return {
814
+ tool: {
815
+ name: transformedNode.operationId,
816
+ title: transformedNode.summary || void 0,
817
+ description: transformedNode.description || `Make a ${transformedNode.method.toUpperCase()} request to ${transformedNode.path}`
818
+ },
819
+ mcp: {
820
+ name: resolver.resolveName(transformedNode.operationId),
821
+ file: mcpFile
822
+ },
823
+ zod: {
824
+ pathParams: [],
825
+ queryParams: zodQueryParams,
826
+ headerParams: zodHeaderParams,
827
+ requestName,
828
+ responseName,
829
+ file: zodFile
830
+ },
831
+ node: transformedNode
832
+ };
833
+ });
834
+ const imports = operationsMapped.flatMap(({ mcp, zod }) => {
835
+ const zodNames = [
836
+ zod.queryParams,
837
+ zod.headerParams,
838
+ zod.requestName,
839
+ zod.responseName
840
+ ].filter(Boolean);
841
+ return [/* @__PURE__ */ jsx(File.Import, {
842
+ name: [mcp.name],
843
+ root: serverFile.path,
844
+ path: mcp.file.path
845
+ }, mcp.name), zod.file && zodNames.length > 0 && /* @__PURE__ */ jsx(File.Import, {
846
+ name: zodNames.sort(),
847
+ root: serverFile.path,
848
+ path: zod.file.path
849
+ }, `zod-${mcp.name}`)].filter(Boolean);
850
+ });
851
+ return /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsxs(File, {
852
+ baseName: serverFile.baseName,
853
+ path: serverFile.path,
854
+ meta: serverFile.meta,
855
+ banner: resolver.resolveBanner(adapter.rootNode, {
856
+ output,
857
+ config
858
+ }),
859
+ footer: resolver.resolveFooter(adapter.rootNode, {
860
+ output,
861
+ config
862
+ }),
863
+ children: [
864
+ /* @__PURE__ */ jsx(File.Import, {
865
+ name: ["McpServer"],
866
+ path: "@modelcontextprotocol/sdk/server/mcp"
867
+ }),
868
+ /* @__PURE__ */ jsx(File.Import, {
869
+ name: ["z"],
870
+ path: "zod"
871
+ }),
872
+ /* @__PURE__ */ jsx(File.Import, {
873
+ name: ["StdioServerTransport"],
874
+ path: "@modelcontextprotocol/sdk/server/stdio"
875
+ }),
876
+ imports,
877
+ /* @__PURE__ */ jsx(Server, {
878
+ name,
879
+ serverName: adapter.rootNode?.meta?.title ?? "server",
880
+ serverVersion: adapter.document?.openapi ?? adapter.rootNode?.meta?.version ?? "0.0.0",
881
+ paramsCasing,
882
+ operations: operationsMapped
883
+ })
884
+ ]
885
+ }), /* @__PURE__ */ jsx(File, {
886
+ baseName: jsonFile.baseName,
887
+ path: jsonFile.path,
888
+ meta: jsonFile.meta,
889
+ children: /* @__PURE__ */ jsx(File.Source, {
890
+ name,
891
+ children: `
892
+ {
893
+ "mcpServers": {
894
+ "${adapter.rootNode?.meta?.title || "server"}": {
895
+ "type": "stdio",
896
+ "command": "npx",
897
+ "args": ["tsx", "${path.relative(path.dirname(jsonFile.path), serverFile.path)}"]
898
+ }
899
+ }
900
+ }
901
+ `
902
+ })
903
+ })] });
904
+ }
905
+ });
906
+ //#endregion
907
+ //#region src/resolvers/resolverMcp.ts
908
+ /**
909
+ * Resolver for `@kubb/plugin-mcp` that provides the default naming
910
+ * and path-resolution helpers used by the plugin.
911
+ *
912
+ * @example
913
+ * ```ts
914
+ * import { resolverMcp } from '@kubb/plugin-mcp'
915
+ *
916
+ * resolverMcp.default('addPet', 'function') // -> 'addPetHandler'
917
+ * resolverMcp.resolveName('show pet by id') // -> 'showPetByIdHandler'
918
+ * ```
919
+ */
920
+ const resolverMcp = defineResolver(() => ({
921
+ name: "default",
922
+ pluginName: "plugin-mcp",
923
+ default(name, type) {
924
+ if (type === "file") return camelCase(name, { isFile: true });
925
+ return camelCase(name, { suffix: "handler" });
926
+ },
927
+ resolveName(name) {
928
+ return this.default(name, "function");
929
+ }
930
+ }));
931
+ //#endregion
932
+ //#region src/presets.ts
933
+ /**
934
+ * Built-in preset registry for `@kubb/plugin-mcp`.
935
+ *
936
+ * - `default` — v5 naming with individual zod schemas and per-status responses.
937
+ * - `kubbV4` — legacy naming with grouped zod schemas and combined responses.
938
+ */
939
+ const presets = definePresets({
940
+ default: {
941
+ name: "default",
942
+ resolver: resolverMcp,
943
+ generators: [mcpGenerator, serverGenerator]
944
+ },
945
+ kubbV4: {
946
+ name: "kubbV4",
947
+ resolver: resolverMcp,
948
+ generators: [mcpGenerator, serverGeneratorLegacy]
949
+ }
950
+ });
951
+ //#endregion
13
952
  //#region src/plugin.ts
14
953
  const pluginMcpName = "plugin-mcp";
15
954
  const pluginMcp = createPlugin((options) => {
16
955
  const { output = {
17
956
  path: "mcp",
18
957
  barrelType: "named"
19
- }, group, exclude = [], include, override = [], transformers = {}, generators = [mcpGenerator, serverGenerator].filter(Boolean), contentType, paramsCasing, client } = options;
958
+ }, group, exclude = [], include, override = [], paramsCasing, client, compatibilityPreset = "default", resolver: userResolver, transformer: userTransformer, generators: userGenerators = [] } = options;
20
959
  const clientName = client?.client ?? "axios";
21
960
  const clientImportPath = client?.importPath ?? (!client?.bundle ? `@kubb/plugin-client/clients/${clientName}` : void 0);
961
+ const preset = getPreset({
962
+ preset: compatibilityPreset,
963
+ presets,
964
+ resolver: userResolver,
965
+ transformer: userTransformer,
966
+ generators: userGenerators
967
+ });
22
968
  return {
23
969
  name: pluginMcpName,
24
- options: {
25
- output,
26
- group,
27
- paramsCasing,
28
- client: {
29
- client: clientName,
30
- clientType: client?.clientType ?? "function",
31
- importPath: clientImportPath,
32
- dataReturnType: client?.dataReturnType ?? "data",
33
- bundle: client?.bundle,
34
- baseURL: client?.baseURL,
35
- paramsCasing: client?.paramsCasing
36
- }
970
+ get resolver() {
971
+ return preset.resolver;
37
972
  },
38
- pre: [
39
- pluginOasName,
40
- pluginTsName,
41
- pluginZodName
42
- ].filter(Boolean),
43
- resolvePath(baseName, pathMode, options) {
44
- const root = path.resolve(this.config.root, this.config.output.path);
45
- if ((pathMode ?? getMode(path.resolve(root, output.path))) === "single")
46
- /**
47
- * when output is a file then we will always append to the same file(output file), see fileManager.addOrAppend
48
- * Other plugins then need to call addOrAppend instead of just add from the fileManager class
49
- */
50
- return path.resolve(root, output.path);
51
- if (group && (options?.group?.path || options?.group?.tag)) {
52
- const groupName = group?.name ? group.name : (ctx) => {
53
- if (group?.type === "path") return `${ctx.group.split("/")[1]}`;
54
- return `${camelCase(ctx.group)}Requests`;
55
- };
56
- return path.resolve(root, output.path, groupName({ group: group.type === "path" ? options.group.path : options.group.tag }), baseName);
57
- }
58
- return path.resolve(root, output.path, baseName);
973
+ get transformer() {
974
+ return preset.transformer;
59
975
  },
60
- resolveName(name, type) {
61
- const resolvedName = camelCase(name, { isFile: type === "file" });
62
- if (type) return transformers?.name?.(resolvedName, type) || resolvedName;
63
- return resolvedName;
976
+ get options() {
977
+ return {
978
+ output,
979
+ group: group ? {
980
+ ...group,
981
+ name: group.name ? group.name : (ctx) => {
982
+ if (group.type === "path") return `${ctx.group.split("/")[1]}`;
983
+ return `${camelCase(ctx.group)}Requests`;
984
+ }
985
+ } : void 0,
986
+ paramsCasing,
987
+ client: {
988
+ client: clientName,
989
+ clientType: client?.clientType ?? "function",
990
+ importPath: clientImportPath,
991
+ dataReturnType: client?.dataReturnType ?? "data",
992
+ bundle: client?.bundle,
993
+ baseURL: client?.baseURL,
994
+ paramsCasing: client?.paramsCasing
995
+ },
996
+ resolver: preset.resolver
997
+ };
64
998
  },
999
+ pre: [pluginTsName, pluginZodName].filter(Boolean),
65
1000
  async install() {
66
- const root = path.resolve(this.config.root, this.config.output.path);
67
- const mode = getMode(path.resolve(root, output.path));
68
- const oas = await this.getOas();
69
- const baseURL = await this.getBaseURL();
70
- if (baseURL) this.plugin.options.client.baseURL = baseURL;
71
- const hasClientPlugin = !!this.getPlugin(pluginClientName);
1001
+ const { config, fabric, plugin, adapter, rootNode, driver } = this;
1002
+ const root = path.resolve(config.root, config.output.path);
1003
+ const resolver = preset.resolver;
1004
+ if (!adapter) throw new Error("Plugin cannot work without adapter being set");
1005
+ const baseURL = adapter.rootNode?.meta?.baseURL;
1006
+ if (baseURL) this.plugin.options.client.baseURL = this.plugin.options.client.baseURL || baseURL;
1007
+ const hasClientPlugin = !!driver.getPlugin(pluginClientName);
72
1008
  if (this.plugin.options.client.bundle && !hasClientPlugin && !this.plugin.options.client.importPath) await this.addFile({
73
1009
  baseName: "fetch.ts",
74
1010
  path: path.resolve(root, ".kubb/fetch.ts"),
@@ -93,19 +1029,35 @@ const pluginMcp = createPlugin((options) => {
93
1029
  imports: [],
94
1030
  exports: []
95
1031
  });
96
- const files = await new OperationGenerator(this.plugin.options, {
97
- fabric: this.fabric,
98
- oas,
99
- driver: this.driver,
100
- events: this.events,
101
- plugin: this.plugin,
102
- contentType,
1032
+ const collectedOperations = [];
1033
+ const generatorContext = {
1034
+ generators: preset.generators,
1035
+ plugin,
1036
+ resolver,
103
1037
  exclude,
104
1038
  include,
105
1039
  override,
106
- mode
107
- }).build(...generators);
108
- await this.upsertFile(...files);
1040
+ fabric,
1041
+ adapter,
1042
+ config,
1043
+ driver
1044
+ };
1045
+ await walk(rootNode, {
1046
+ depth: "shallow",
1047
+ async schema(schemaNode) {
1048
+ await runGeneratorSchema(schemaNode, generatorContext);
1049
+ },
1050
+ async operation(operationNode) {
1051
+ if (resolver.resolveOptions(operationNode, {
1052
+ options: plugin.options,
1053
+ exclude,
1054
+ include,
1055
+ override
1056
+ }) !== null) collectedOperations.push(operationNode);
1057
+ await runGeneratorOperation(operationNode, generatorContext);
1058
+ }
1059
+ });
1060
+ await runGeneratorOperations(collectedOperations, generatorContext);
109
1061
  const barrelFiles = await getBarrelFiles(this.fabric.files, {
110
1062
  type: output.barrelType ?? "named",
111
1063
  root,
@@ -117,6 +1069,6 @@ const pluginMcp = createPlugin((options) => {
117
1069
  };
118
1070
  });
119
1071
  //#endregion
120
- export { pluginMcp, pluginMcpName };
1072
+ export { McpHandler, Server, mcpGenerator, pluginMcp, pluginMcpName, resolverMcp, serverGenerator, serverGeneratorLegacy };
121
1073
 
122
1074
  //# sourceMappingURL=index.js.map