@kubb/plugin-mcp 5.0.0-beta.10 → 5.0.0-beta.15

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.cjs CHANGED
@@ -379,7 +379,17 @@ function resolveErrorNames(node, resolver) {
379
379
  function resolveStatusCodeNames(node, resolver) {
380
380
  return node.responses.map((response) => resolver.resolveResponseStatusName(node, response.statusCode));
381
381
  }
382
+ const typeNamesByResolver = /* @__PURE__ */ new WeakMap();
382
383
  function resolveOperationTypeNames(node, resolver, options = {}) {
384
+ const cacheKey = `${node.operationId}\0${options.paramsCasing ?? ""}\0${options.order ?? ""}\0${options.responseStatusNames ?? ""}\0${(options.exclude ?? []).join(",")}`;
385
+ let byResolver = typeNamesByResolver.get(resolver);
386
+ if (byResolver) {
387
+ const cached = byResolver.get(cacheKey);
388
+ if (cached) return cached;
389
+ } else {
390
+ byResolver = /* @__PURE__ */ new Map();
391
+ typeNamesByResolver.set(resolver, byResolver);
392
+ }
383
393
  const { path, query, header } = getOperationParameters(node, { paramsCasing: options.paramsCasing });
384
394
  const responseStatusNames = options.responseStatusNames === "error" ? resolveErrorNames(node, resolver) : options.responseStatusNames === false ? [] : resolveStatusCodeNames(node, resolver);
385
395
  const exclude = new Set(options.exclude ?? []);
@@ -389,7 +399,7 @@ function resolveOperationTypeNames(node, resolver, options = {}) {
389
399
  ...header.map((param) => resolver.resolveHeaderParamsName(node, param))
390
400
  ];
391
401
  const bodyAndResponseNames = [node.requestBody?.content?.[0]?.schema ? resolver.resolveDataName(node) : void 0, resolver.resolveResponseName(node)];
392
- return (options.order === "body-response-first" ? [
402
+ const result = (options.order === "body-response-first" ? [
393
403
  ...bodyAndResponseNames,
394
404
  ...paramNames,
395
405
  ...responseStatusNames
@@ -398,6 +408,8 @@ function resolveOperationTypeNames(node, resolver, options = {}) {
398
408
  ...bodyAndResponseNames,
399
409
  ...responseStatusNames
400
410
  ]).filter((name) => Boolean(name) && !exclude.has(name));
411
+ byResolver.set(cacheKey, result);
412
+ return result;
401
413
  }
402
414
  function findSuccessStatusCode(responses) {
403
415
  for (const response of responses) if (isSuccessStatusCode(response.statusCode)) return response.statusCode;
@@ -654,7 +666,7 @@ server.registerTool(${JSON.stringify(tool.name)}, {
654
666
  //#region src/generators/mcpGenerator.tsx
655
667
  const mcpGenerator = (0, _kubb_core.defineGenerator)({
656
668
  name: "mcp",
657
- renderer: _kubb_renderer_jsx.jsxRenderer,
669
+ renderer: _kubb_renderer_jsx.jsxRendererSync,
658
670
  operation(node, ctx) {
659
671
  const { resolver, driver, root } = ctx;
660
672
  const { output, client, paramsCasing, group } = ctx.options;
@@ -783,9 +795,9 @@ const mcpGenerator = (0, _kubb_core.defineGenerator)({
783
795
  */
784
796
  const serverGenerator = (0, _kubb_core.defineGenerator)({
785
797
  name: "operations",
786
- renderer: _kubb_renderer_jsx.jsxRenderer,
798
+ renderer: _kubb_renderer_jsx.jsxRendererSync,
787
799
  operations(nodes, ctx) {
788
- const { adapter, config, resolver, plugin, driver, root } = ctx;
800
+ const { config, resolver, plugin, driver, root, inputNode } = ctx;
789
801
  const { output, paramsCasing, group } = ctx.options;
790
802
  const pluginZod = driver.getPlugin(_kubb_plugin_zod.pluginZodName);
791
803
  if (!pluginZod) return;
@@ -874,11 +886,11 @@ const serverGenerator = (0, _kubb_core.defineGenerator)({
874
886
  baseName: serverFile.baseName,
875
887
  path: serverFile.path,
876
888
  meta: serverFile.meta,
877
- banner: resolver.resolveBanner(adapter.inputNode, {
889
+ banner: resolver.resolveBanner(inputNode, {
878
890
  output,
879
891
  config
880
892
  }),
881
- footer: resolver.resolveFooter(adapter.inputNode, {
893
+ footer: resolver.resolveFooter(inputNode, {
882
894
  output,
883
895
  config
884
896
  }),
@@ -898,8 +910,8 @@ const serverGenerator = (0, _kubb_core.defineGenerator)({
898
910
  imports,
899
911
  /* @__PURE__ */ (0, _kubb_renderer_jsx_jsx_runtime.jsx)(Server, {
900
912
  name,
901
- serverName: adapter.inputNode?.meta?.title ?? "server",
902
- serverVersion: adapter.inputNode?.meta?.version ?? "0.0.0",
913
+ serverName: inputNode.meta?.title ?? "server",
914
+ serverVersion: inputNode.meta?.version ?? "0.0.0",
903
915
  paramsCasing,
904
916
  operations: operationsMapped
905
917
  })
@@ -913,7 +925,7 @@ const serverGenerator = (0, _kubb_core.defineGenerator)({
913
925
  children: `
914
926
  {
915
927
  "mcpServers": {
916
- "${adapter.inputNode?.meta?.title || "server"}": {
928
+ "${inputNode.meta?.title || "server"}": {
917
929
  "type": "stdio",
918
930
  "command": "npx",
919
931
  "args": ["tsx", "${node_path.default.relative(node_path.default.dirname(jsonFile.path), serverFile.path)}"]
@@ -1 +1 @@
1
- {"version":3,"file":"index.cjs","names":["#options","#transformParam","#eachParam","ast","ast","File","Function","File","Const","ast","Function","jsxRenderer","pluginTsName","File","path","jsxRenderer","pluginZodName","path","File","pluginTsName","pluginZodName","path","pluginClientName","ast","fetchClientSource","axiosClientSource","configSource"],"sources":["../../../internals/utils/src/casing.ts","../../../internals/utils/src/reserved.ts","../../../internals/utils/src/urlPath.ts","../../../internals/shared/src/operation.ts","../../../internals/shared/src/params.ts","../src/components/McpHandler.tsx","../src/utils.ts","../src/components/Server.tsx","../src/generators/mcpGenerator.tsx","../src/generators/serverGenerator.tsx","../src/resolvers/resolverMcp.ts","../src/plugin.ts"],"sourcesContent":["type Options = {\n /**\n * When `true`, dot-separated segments are split on `.` and joined with `/` after casing.\n */\n isFile?: boolean\n /**\n * Text prepended before casing is applied.\n */\n prefix?: string\n /**\n * Text appended before casing is applied.\n */\n suffix?: string\n}\n\n/**\n * Shared implementation for camelCase and PascalCase conversion.\n * Splits on common word boundaries (spaces, hyphens, underscores, dots, slashes, colons)\n * and capitalizes each word according to `pascal`.\n *\n * When `pascal` is `true` the first word is also capitalized (PascalCase), otherwise only subsequent words are.\n */\nfunction toCamelOrPascal(text: string, pascal: boolean): string {\n const normalized = text\n .trim()\n .replace(/([a-z\\d])([A-Z])/g, '$1 $2')\n .replace(/([A-Z]+)([A-Z][a-z])/g, '$1 $2')\n .replace(/(\\d)([a-z])/g, '$1 $2')\n\n const words = normalized.split(/[\\s\\-_./\\\\:]+/).filter(Boolean)\n\n return words\n .map((word, i) => {\n const allUpper = word.length > 1 && word === word.toUpperCase()\n if (allUpper) return word\n if (i === 0 && !pascal) return word.charAt(0).toLowerCase() + word.slice(1)\n return word.charAt(0).toUpperCase() + word.slice(1)\n })\n .join('')\n .replace(/[^a-zA-Z0-9]/g, '')\n}\n\n/**\n * Splits `text` on `.` and applies `transformPart` to each segment.\n * The last segment receives `isLast = true`, all earlier segments receive `false`.\n * Segments are joined with `/` to form a file path.\n *\n * Only splits on dots followed by a letter so that version numbers\n * embedded in operationIds (e.g. `v2025.0`) are kept intact.\n */\nfunction applyToFileParts(text: string, transformPart: (part: string, isLast: boolean) => string): string {\n const parts = text.split(/\\.(?=[a-zA-Z])/)\n return parts.map((part, i) => transformPart(part, i === parts.length - 1)).join('/')\n}\n\n/**\n * Converts `text` to camelCase.\n * When `isFile` is `true`, dot-separated segments are each cased independently and joined with `/`.\n *\n * @example\n * camelCase('hello-world') // 'helloWorld'\n * camelCase('pet.petId', { isFile: true }) // 'pet/petId'\n */\nexport function camelCase(text: string, { isFile, prefix = '', suffix = '' }: Options = {}): string {\n if (isFile) {\n return applyToFileParts(text, (part, isLast) => camelCase(part, isLast ? { prefix, suffix } : {}))\n }\n\n return toCamelOrPascal(`${prefix} ${text} ${suffix}`, false)\n}\n\n/**\n * Converts `text` to PascalCase.\n * When `isFile` is `true`, the last dot-separated segment is PascalCased and earlier segments are camelCased.\n *\n * @example\n * pascalCase('hello-world') // 'HelloWorld'\n * pascalCase('pet.petId', { isFile: true }) // 'pet/PetId'\n */\nexport function pascalCase(text: string, { isFile, prefix = '', suffix = '' }: Options = {}): string {\n if (isFile) {\n return applyToFileParts(text, (part, isLast) => (isLast ? pascalCase(part, { prefix, suffix }) : camelCase(part)))\n }\n\n return toCamelOrPascal(`${prefix} ${text} ${suffix}`, true)\n}\n\n/**\n * Converts `text` to snake_case.\n *\n * @example\n * snakeCase('helloWorld') // 'hello_world'\n * snakeCase('Hello-World') // 'hello_world'\n */\nexport function snakeCase(text: string, { prefix = '', suffix = '' }: Omit<Options, 'isFile'> = {}): string {\n const processed = `${prefix} ${text} ${suffix}`.trim()\n return processed\n .replace(/([a-z])([A-Z])/g, '$1_$2')\n .replace(/[\\s\\-.]+/g, '_')\n .replace(/[^a-zA-Z0-9_]/g, '')\n .toLowerCase()\n .split('_')\n .filter(Boolean)\n .join('_')\n}\n\n/**\n * Converts `text` to SCREAMING_SNAKE_CASE.\n *\n * @example\n * screamingSnakeCase('helloWorld') // 'HELLO_WORLD'\n */\nexport function screamingSnakeCase(text: string, { prefix = '', suffix = '' }: Omit<Options, 'isFile'> = {}): string {\n return snakeCase(text, { prefix, suffix }).toUpperCase()\n}\n","/**\n * JavaScript and Java reserved words.\n * @link https://github.com/jonschlinkert/reserved/blob/master/index.js\n */\nconst reservedWords = new Set([\n 'abstract',\n 'arguments',\n 'boolean',\n 'break',\n 'byte',\n 'case',\n 'catch',\n 'char',\n 'class',\n 'const',\n 'continue',\n 'debugger',\n 'default',\n 'delete',\n 'do',\n 'double',\n 'else',\n 'enum',\n 'eval',\n 'export',\n 'extends',\n 'false',\n 'final',\n 'finally',\n 'float',\n 'for',\n 'function',\n 'goto',\n 'if',\n 'implements',\n 'import',\n 'in',\n 'instanceof',\n 'int',\n 'interface',\n 'let',\n 'long',\n 'native',\n 'new',\n 'null',\n 'package',\n 'private',\n 'protected',\n 'public',\n 'return',\n 'short',\n 'static',\n 'super',\n 'switch',\n 'synchronized',\n 'this',\n 'throw',\n 'throws',\n 'transient',\n 'true',\n 'try',\n 'typeof',\n 'var',\n 'void',\n 'volatile',\n 'while',\n 'with',\n 'yield',\n 'Array',\n 'Date',\n 'hasOwnProperty',\n 'Infinity',\n 'isFinite',\n 'isNaN',\n 'isPrototypeOf',\n 'length',\n 'Math',\n 'name',\n 'NaN',\n 'Number',\n 'Object',\n 'prototype',\n 'String',\n 'toString',\n 'undefined',\n 'valueOf',\n] as const)\n\n/**\n * Returns `true` when `name` is a syntactically valid JavaScript variable name.\n *\n * @example\n * ```ts\n * isValidVarName('status') // true\n * isValidVarName('class') // false (reserved word)\n * isValidVarName('42foo') // false (starts with digit)\n * ```\n */\nexport function isValidVarName(name: string): boolean {\n if (!name || reservedWords.has(name as 'valueOf')) {\n return false\n }\n return /^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(name)\n}\n","import { camelCase } from './casing.ts'\nimport { isValidVarName } from './reserved.ts'\n\nexport type URLObject = {\n /**\n * The resolved URL string (Express-style or template literal, depending on context).\n */\n url: string\n /**\n * Extracted path parameters as a key-value map, or `undefined` when the path has none.\n */\n params?: Record<string, string>\n}\n\ntype ObjectOptions = {\n /**\n * Controls whether the `url` is rendered as an Express path or a template literal.\n * @default 'path'\n */\n type?: 'path' | 'template'\n /**\n * Optional transform applied to each extracted parameter name.\n */\n replacer?: (pathParam: string) => string\n /**\n * When `true`, the result is serialized to a string expression instead of a plain object.\n */\n stringify?: boolean\n}\n\n/**\n * Supported identifier casing strategies for path parameters.\n */\ntype PathCasing = 'camelcase'\n\ntype Options = {\n /**\n * Casing strategy applied to path parameter names.\n * @default undefined (original identifier preserved)\n */\n casing?: PathCasing\n}\n\n/**\n * Parses and transforms an OpenAPI/Swagger path string into various URL formats.\n *\n * @example\n * const p = new URLPath('/pet/{petId}')\n * p.URL // '/pet/:petId'\n * p.template // '`/pet/${petId}`'\n */\nexport class URLPath {\n /**\n * The raw OpenAPI/Swagger path string, e.g. `/pet/{petId}`.\n */\n path: string\n\n #options: Options\n\n constructor(path: string, options: Options = {}) {\n this.path = path\n this.#options = options\n }\n\n /** Converts the OpenAPI path to Express-style colon syntax, e.g. `/pet/{petId}` → `/pet/:petId`.\n *\n * @example\n * ```ts\n * new URLPath('/pet/{petId}').URL // '/pet/:petId'\n * ```\n */\n get URL(): string {\n return this.toURLPath()\n }\n\n /** Returns `true` when `path` is a fully-qualified URL (e.g. starts with `https://`).\n *\n * @example\n * ```ts\n * new URLPath('https://petstore.swagger.io/v2/pet').isURL // true\n * new URLPath('/pet/{petId}').isURL // false\n * ```\n */\n get isURL(): boolean {\n try {\n return !!new URL(this.path).href\n } catch {\n return false\n }\n }\n\n /**\n * Converts the OpenAPI path to a TypeScript template literal string.\n *\n * @example\n * new URLPath('/pet/{petId}').template // '`/pet/${petId}`'\n * new URLPath('/account/monetary-accountID').template // '`/account/${monetaryAccountId}`'\n */\n get template(): string {\n return this.toTemplateString()\n }\n\n /** Returns the path and its extracted params as a structured `URLObject`, or as a stringified expression when `stringify` is set.\n *\n * @example\n * ```ts\n * new URLPath('/pet/{petId}').object\n * // { url: '/pet/:petId', params: { petId: 'petId' } }\n * ```\n */\n get object(): URLObject | string {\n return this.toObject()\n }\n\n /** Returns a map of path parameter names, or `undefined` when the path has no parameters.\n *\n * @example\n * ```ts\n * new URLPath('/pet/{petId}').params // { petId: 'petId' }\n * new URLPath('/pet').params // undefined\n * ```\n */\n get params(): Record<string, string> | undefined {\n return this.toParamsObject()\n }\n\n #transformParam(raw: string): string {\n const param = isValidVarName(raw) ? raw : camelCase(raw)\n return this.#options.casing === 'camelcase' ? camelCase(param) : param\n }\n\n /**\n * Iterates over every `{param}` token in `path`, calling `fn` with the raw token and transformed name.\n */\n #eachParam(fn: (raw: string, param: string) => void): void {\n for (const match of this.path.matchAll(/\\{([^}]+)\\}/g)) {\n const raw = match[1]!\n fn(raw, this.#transformParam(raw))\n }\n }\n\n toObject({ type = 'path', replacer, stringify }: ObjectOptions = {}): URLObject | string {\n const object = {\n url: type === 'path' ? this.toURLPath() : this.toTemplateString({ replacer }),\n params: this.toParamsObject(),\n }\n\n if (stringify) {\n if (type === 'template') {\n return JSON.stringify(object).replaceAll(\"'\", '').replaceAll(`\"`, '')\n }\n\n if (object.params) {\n return `{ url: '${object.url}', params: ${JSON.stringify(object.params).replaceAll(\"'\", '').replaceAll(`\"`, '')} }`\n }\n\n return `{ url: '${object.url}' }`\n }\n\n return object\n }\n\n /**\n * Converts the OpenAPI path to a TypeScript template literal string.\n * An optional `replacer` can transform each extracted parameter name before interpolation.\n *\n * @example\n * new URLPath('/pet/{petId}').toTemplateString() // '`/pet/${petId}`'\n */\n toTemplateString({ prefix = '', replacer }: { prefix?: string; replacer?: (pathParam: string) => string } = {}): string {\n const parts = this.path.split(/\\{([^}]+)\\}/)\n const result = parts\n .map((part, i) => {\n if (i % 2 === 0) return part\n const param = this.#transformParam(part)\n return `\\${${replacer ? replacer(param) : param}}`\n })\n .join('')\n\n return `\\`${prefix}${result}\\``\n }\n\n /**\n * Extracts all `{param}` segments from the path and returns them as a key-value map.\n * An optional `replacer` transforms each parameter name in both key and value positions.\n * Returns `undefined` when no path parameters are found.\n *\n * @example\n * ```ts\n * new URLPath('/pet/{petId}/tag/{tagId}').toParamsObject()\n * // { petId: 'petId', tagId: 'tagId' }\n * ```\n */\n toParamsObject(replacer?: (pathParam: string) => string): Record<string, string> | undefined {\n const params: Record<string, string> = {}\n\n this.#eachParam((_raw, param) => {\n const key = replacer ? replacer(param) : param\n params[key] = key\n })\n\n return Object.keys(params).length > 0 ? params : undefined\n }\n\n /** Converts the OpenAPI path to Express-style colon syntax.\n *\n * @example\n * ```ts\n * new URLPath('/pet/{petId}').toURLPath() // '/pet/:petId'\n * ```\n */\n toURLPath(): string {\n return this.path.replace(/\\{([^}]+)\\}/g, ':$1')\n }\n}\n","import { URLPath } from '@internals/utils'\nimport { ast } from '@kubb/core'\n\nexport type ContentTypeInfo = {\n contentTypes: string[]\n isMultipleContentTypes: boolean\n contentTypeUnion: string\n defaultContentType: string\n hasFormData: boolean\n}\n\nexport type RequestConfigResolver = {\n resolveDataName(node: ast.OperationNode): string\n}\n\nexport type ResponseStatusNameResolver = {\n resolveResponseStatusName(node: ast.OperationNode, statusCode: ast.StatusCode): string\n}\n\nexport type ResponseNameResolver = ResponseStatusNameResolver & {\n resolveResponseName(node: ast.OperationNode): string\n}\n\nexport type OperationTypeNameResolver = RequestConfigResolver &\n ResponseNameResolver & {\n resolvePathParamsName(node: ast.OperationNode, param: ast.ParameterNode): string\n resolveQueryParamsName(node: ast.OperationNode, param: ast.ParameterNode): string\n resolveHeaderParamsName(node: ast.OperationNode, param: ast.ParameterNode): string\n }\n\nexport type OperationCommentLink = 'pathTemplate' | 'urlPath' | false | ((node: ast.OperationNode) => string | undefined)\n\nexport type BuildOperationCommentsOptions = {\n link?: OperationCommentLink\n linkPosition?: 'beforeDeprecated' | 'afterDeprecated'\n splitLines?: boolean\n}\n\ntype ResponseLike = {\n statusCode: ast.StatusCode | number | string\n}\n\nexport type OperationParameterGroups = Record<ast.ParameterNode['in'], Array<ast.ParameterNode>>\n\nexport type ResolveOperationTypeNameOptions = {\n paramsCasing?: 'camelcase'\n responseStatusNames?: boolean | 'error'\n exclude?: ReadonlyArray<string | undefined>\n order?: 'params-first' | 'body-response-first'\n}\n\nfunction getOperationLink(node: ast.OperationNode, link: OperationCommentLink): string | undefined {\n if (!link) {\n return undefined\n }\n\n if (typeof link === 'function') {\n return link(node)\n }\n\n if (link === 'urlPath') {\n return node.path ? `{@link ${new URLPath(node.path).URL}}` : undefined\n }\n\n return `{@link ${node.path.replaceAll('{', ':').replaceAll('}', '')}}`\n}\n\nexport function getContentTypeInfo(node: ast.OperationNode): ContentTypeInfo {\n const contentTypes = node.requestBody?.content?.map((e) => e.contentType) ?? []\n const isMultipleContentTypes = contentTypes.length > 1\n\n return {\n contentTypes,\n isMultipleContentTypes,\n contentTypeUnion: isMultipleContentTypes ? contentTypes.map((ct) => JSON.stringify(ct)).join(' | ') : '',\n defaultContentType: contentTypes[0] ?? 'application/json',\n hasFormData: contentTypes.some((ct) => ct === 'multipart/form-data'),\n }\n}\n\nexport function buildRequestConfigType(node: ast.OperationNode, resolver: RequestConfigResolver): string {\n const requestName = node.requestBody?.content?.[0]?.schema ? resolver.resolveDataName(node) : undefined\n const { isMultipleContentTypes, contentTypeUnion } = getContentTypeInfo(node)\n const configType = requestName ? `Partial<RequestConfig<${requestName}>>` : 'Partial<RequestConfig>'\n const configProps = ['client?: Client', isMultipleContentTypes ? `contentType?: ${contentTypeUnion}` : undefined].filter(Boolean).join('; ')\n\n return `${configType} & { ${configProps} }`\n}\n\nexport function buildOperationComments(node: ast.OperationNode, options: BuildOperationCommentsOptions = {}): Array<string> {\n const { link = 'pathTemplate', linkPosition = 'afterDeprecated', splitLines = false } = options\n const linkComment = getOperationLink(node, link)\n const comments =\n linkPosition === 'beforeDeprecated'\n ? [node.description && `@description ${node.description}`, node.summary && `@summary ${node.summary}`, linkComment, node.deprecated && '@deprecated']\n : [node.description && `@description ${node.description}`, node.summary && `@summary ${node.summary}`, node.deprecated && '@deprecated', linkComment]\n\n const filteredComments = comments.filter((comment): comment is string => Boolean(comment))\n\n if (!splitLines) {\n return filteredComments\n }\n\n return filteredComments.flatMap((text) => text.split(/\\r?\\n/).map((line) => line.trim())).filter((comment): comment is string => Boolean(comment))\n}\n\nexport function getOperationParameters(node: ast.OperationNode, options: { paramsCasing?: 'camelcase' } = {}): OperationParameterGroups {\n const params = ast.caseParams(node.parameters, options.paramsCasing)\n\n return {\n path: params.filter((param) => param.in === 'path'),\n query: params.filter((param) => param.in === 'query'),\n header: params.filter((param) => param.in === 'header'),\n cookie: params.filter((param) => param.in === 'cookie'),\n }\n}\n\nexport function getStatusCodeNumber(statusCode: ast.StatusCode | number | string): number | undefined {\n const code = Number(statusCode)\n\n return Number.isNaN(code) ? undefined : code\n}\n\nexport function isSuccessStatusCode(statusCode: ast.StatusCode | number | string): boolean {\n const code = getStatusCodeNumber(statusCode)\n\n return code !== undefined && code >= 200 && code < 300\n}\n\nexport function isErrorStatusCode(statusCode: ast.StatusCode | number | string): boolean {\n const code = getStatusCodeNumber(statusCode)\n\n return code !== undefined && code >= 400\n}\n\nexport function getSuccessResponses<TResponse extends ResponseLike>(responses: ReadonlyArray<TResponse>): Array<TResponse> {\n return responses.filter((response) => isSuccessStatusCode(response.statusCode))\n}\n\nexport function getOperationSuccessResponses(node: ast.OperationNode): Array<ast.ResponseNode> {\n return getSuccessResponses(node.responses)\n}\n\nexport function getPrimarySuccessResponse(node: ast.OperationNode): ast.ResponseNode | undefined {\n return getOperationSuccessResponses(node)[0]\n}\n\nexport function resolveErrorNames(node: ast.OperationNode, resolver: ResponseStatusNameResolver): string[] {\n return node.responses\n .filter((response) => isErrorStatusCode(response.statusCode))\n .map((response) => resolver.resolveResponseStatusName(node, response.statusCode))\n}\n\nexport function resolveStatusCodeNames(node: ast.OperationNode, resolver: ResponseStatusNameResolver): string[] {\n return node.responses.map((response) => resolver.resolveResponseStatusName(node, response.statusCode))\n}\n\nexport function resolveOperationTypeNames(\n node: ast.OperationNode,\n resolver: OperationTypeNameResolver,\n options: ResolveOperationTypeNameOptions = {},\n): string[] {\n const { path, query, header } = getOperationParameters(node, { paramsCasing: options.paramsCasing })\n const responseStatusNames =\n options.responseStatusNames === 'error'\n ? resolveErrorNames(node, resolver)\n : options.responseStatusNames === false\n ? []\n : resolveStatusCodeNames(node, resolver)\n const exclude = new Set(options.exclude ?? [])\n const paramNames = [\n ...path.map((param) => resolver.resolvePathParamsName(node, param)),\n ...query.map((param) => resolver.resolveQueryParamsName(node, param)),\n ...header.map((param) => resolver.resolveHeaderParamsName(node, param)),\n ]\n const bodyAndResponseNames = [node.requestBody?.content?.[0]?.schema ? resolver.resolveDataName(node) : undefined, resolver.resolveResponseName(node)]\n const names =\n options.order === 'body-response-first'\n ? [...bodyAndResponseNames, ...paramNames, ...responseStatusNames]\n : [...paramNames, ...bodyAndResponseNames, ...responseStatusNames]\n\n return names.filter((name): name is string => Boolean(name) && !exclude.has(name))\n}\n\nexport function resolveResponseTypes(node: ast.OperationNode, resolver: ResponseNameResolver): Array<[statusCode: number | 'default', typeName: string]> {\n const types: Array<[number | 'default', string]> = []\n\n for (const response of node.responses) {\n if (response.statusCode === 'default') {\n types.push(['default', resolver.resolveResponseName(node)])\n continue\n }\n\n const code = getStatusCodeNumber(response.statusCode)\n if (code === undefined) {\n continue\n }\n\n types.push([code, isSuccessStatusCode(code) ? resolver.resolveResponseName(node) : resolver.resolveResponseStatusName(node, response.statusCode)])\n }\n\n return types\n}\n\nexport function findSuccessStatusCode(responses: Array<{ statusCode: ast.StatusCode | number | string }>): ast.StatusCode | undefined {\n for (const response of responses) {\n if (isSuccessStatusCode(response.statusCode)) {\n return response.statusCode as ast.StatusCode\n }\n }\n\n return undefined\n}\n","export function buildParamsMapping<TParam extends { name: string }>(\n originalParams: ReadonlyArray<TParam>,\n mappedParams: ReadonlyArray<TParam>,\n): Record<string, string> | undefined {\n const mapping: Record<string, string> = {}\n let hasChanged = false\n\n originalParams.forEach((param, i) => {\n const mappedName = mappedParams[i]?.name ?? param.name\n mapping[param.name] = mappedName\n\n if (param.name !== mappedName) {\n hasChanged = true\n }\n })\n\n return hasChanged ? mapping : undefined\n}\n\nexport function buildTransformedParamsMapping<TParam extends { name: string }>(\n params: ReadonlyArray<TParam>,\n transformName: (name: string) => string,\n): Record<string, string> | undefined {\n if (!params.length) {\n return undefined\n }\n\n return buildParamsMapping(\n params,\n params.map((param) => ({ ...param, name: transformName(param.name) })),\n )\n}\n","import { buildOperationComments, buildTransformedParamsMapping, getOperationParameters } from '@internals/shared'\nimport { camelCase, isValidVarName, URLPath } from '@internals/utils'\nimport { ast } from '@kubb/core'\nimport type { ResolverTs } from '@kubb/plugin-ts'\nimport { functionPrinter } from '@kubb/plugin-ts'\nimport { File, Function } from '@kubb/renderer-jsx'\nimport type { KubbReactNode } from '@kubb/renderer-jsx/types'\nimport type { PluginMcp } from '../types.ts'\n\ntype Props = {\n /**\n * Name of the handler function.\n */\n name: string\n /**\n * AST operation node.\n */\n node: ast.OperationNode\n /**\n * TypeScript resolver for resolving param/data/response type names.\n */\n resolver: ResolverTs\n /**\n * Base URL prepended to every generated request URL.\n */\n baseURL: string | undefined\n /**\n * Return type when calling fetch.\n * - 'data' returns response data only.\n * - 'full' returns the full response object.\n * @default 'data'\n */\n dataReturnType: PluginMcp['resolvedOptions']['client']['dataReturnType']\n /**\n * How to style your params.\n */\n paramsCasing?: PluginMcp['resolvedOptions']['paramsCasing']\n}\n\n/**\n * Generate a remapping statement: `const mappedX = x ? { \"orig\": x.camel, ... } : undefined`\n */\nfunction buildRemappingCode(mapping: Record<string, string>, varName: string, sourceName: string): string {\n const pairs = Object.entries(mapping)\n .map(([orig, camel]) => `\"${orig}\": ${sourceName}.${camel}`)\n .join(', ')\n return `const ${varName} = ${sourceName} ? { ${pairs} } : undefined`\n}\n\nconst declarationPrinter = functionPrinter({ mode: 'declaration' })\n\nexport function McpHandler({ name, node, resolver, baseURL, dataReturnType, paramsCasing }: Props): KubbReactNode {\n const urlPath = new URLPath(node.path)\n const contentType = node.requestBody?.content?.[0]?.contentType\n const isFormData = contentType === 'multipart/form-data'\n\n const { query: queryParams, header: headerParams } = getOperationParameters(node, { paramsCasing })\n const { path: originalPathParams, query: originalQueryParams, header: originalHeaderParams } = getOperationParameters(node)\n\n const requestName = node.requestBody?.content?.[0]?.schema ? resolver.resolveDataName(node) : undefined\n const responseName = resolver.resolveResponseName(node)\n\n const errorResponses = node.responses.filter((r) => Number(r.statusCode) >= 400).map((r) => resolver.resolveResponseStatusName(node, r.statusCode))\n const errorType = errorResponses.length > 0 ? errorResponses.join(' | ') : 'Error'\n\n const TError = `ResponseErrorConfig<${errorType}>`\n const generics = [responseName, TError, requestName || 'unknown'].filter(Boolean)\n\n const paramsNode = ast.createOperationParams(node, {\n paramsType: 'object',\n pathParamsType: 'inline',\n resolver,\n paramsCasing,\n })\n const baseParamsSignature = declarationPrinter.print(paramsNode) ?? ''\n const paramsSignature = baseParamsSignature\n ? `${baseParamsSignature}, request: RequestHandlerExtra<ServerRequest, ServerNotification>`\n : 'request: RequestHandlerExtra<ServerRequest, ServerNotification>'\n\n const pathParamsMapping = paramsCasing ? buildTransformedParamsMapping(originalPathParams, camelCase) : undefined\n const queryParamsMapping = paramsCasing ? buildTransformedParamsMapping(originalQueryParams, camelCase) : undefined\n const headerParamsMapping = paramsCasing ? buildTransformedParamsMapping(originalHeaderParams, camelCase) : undefined\n\n const contentTypeHeader =\n contentType && contentType !== 'application/json' && contentType !== 'multipart/form-data' ? `'Content-Type': '${contentType}'` : undefined\n const headers = [headerParams.length ? (headerParamsMapping ? '...mappedHeaders' : '...headers') : undefined, contentTypeHeader].filter(Boolean)\n\n const fetchConfig: string[] = []\n fetchConfig.push(`method: ${JSON.stringify(node.method.toUpperCase())}`)\n fetchConfig.push(`url: ${urlPath.template}`)\n if (baseURL) fetchConfig.push(`baseURL: \\`${baseURL}\\``)\n if (queryParams.length) fetchConfig.push(queryParamsMapping ? 'params: mappedParams' : 'params')\n if (requestName) fetchConfig.push(`data: ${isFormData ? 'formData as FormData' : 'requestData'}`)\n if (headers.length) fetchConfig.push(`headers: { ${headers.join(', ')} }`)\n\n const callToolResult =\n dataReturnType === 'data'\n ? `return {\n content: [\n {\n type: 'text',\n text: JSON.stringify(res.data)\n }\n ],\n structuredContent: { data: res.data }\n }`\n : `return {\n content: [\n {\n type: 'text',\n text: JSON.stringify(res)\n }\n ],\n structuredContent: { data: res.data }\n }`\n\n return (\n <File.Source name={name} isExportable isIndexable>\n <Function\n name={name}\n async\n export\n params={paramsSignature}\n JSDoc={{\n comments: buildOperationComments(node),\n }}\n returnType={'Promise<CallToolResult>'}\n >\n {''}\n <br />\n <br />\n {pathParamsMapping &&\n Object.entries(pathParamsMapping)\n .filter(([originalName, camelCaseName]) => originalName !== camelCaseName && isValidVarName(originalName))\n .map(([originalName, camelCaseName]) => `const ${originalName} = ${camelCaseName}`)\n .join('\\n')}\n {pathParamsMapping && (\n <>\n <br />\n <br />\n </>\n )}\n {queryParamsMapping && queryParams.length > 0 && (\n <>\n {buildRemappingCode(queryParamsMapping, 'mappedParams', 'params')}\n <br />\n <br />\n </>\n )}\n {headerParamsMapping && headerParams.length > 0 && (\n <>\n {buildRemappingCode(headerParamsMapping, 'mappedHeaders', 'headers')}\n <br />\n <br />\n </>\n )}\n {requestName && 'const requestData = data'}\n <br />\n {isFormData && requestName && 'const formData = buildFormData(requestData)'}\n <br />\n {`const res = await fetch<${generics.join(', ')}>({ ${fetchConfig.join(', ')} }, request)`}\n <br />\n {callToolResult}\n </Function>\n </File.Source>\n )\n}\n","import type { ast } from '@kubb/core'\n\nexport type ZodParam = {\n name: string\n schemaName: string\n}\n\n/**\n * Render a group param value — compose individual schemas into `z.object({ ... })`,\n * or use a schema name string directly.\n */\nexport function zodGroupExpr(entry: string | Array<ZodParam>): string {\n if (typeof entry === 'string') {\n return entry\n }\n const entries = entry.map((p) => `${JSON.stringify(p.name)}: ${p.schemaName}`)\n return `z.object({ ${entries.join(', ')} })`\n}\n\n/**\n * Convert a SchemaNode type to an inline Zod expression string.\n * Used as fallback when no named zod schema is available for a path parameter.\n */\nexport function zodExprFromSchemaNode(schema: ast.SchemaNode): string {\n let expr: string\n switch (schema.type) {\n case 'enum': {\n // namedEnumValues takes priority over enumValues\n const rawValues: Array<string | number | boolean> = schema.namedEnumValues?.length\n ? schema.namedEnumValues.map((v) => v.value)\n : (schema.enumValues ?? []).filter((v): v is string | number | boolean => v !== null)\n\n if (rawValues.length > 0 && rawValues.every((v) => typeof v === 'string')) {\n expr = `z.enum([${rawValues.map((v) => JSON.stringify(v)).join(', ')}])`\n } else if (rawValues.length > 0) {\n const literals = rawValues.map((v) => `z.literal(${JSON.stringify(v)})`)\n expr = literals.length === 1 ? literals[0]! : `z.union([${literals.join(', ')}])`\n } else {\n expr = 'z.string()'\n }\n break\n }\n case 'integer':\n expr = 'z.coerce.number()'\n break\n case 'number':\n expr = 'z.number()'\n break\n case 'boolean':\n expr = 'z.boolean()'\n break\n case 'array':\n expr = 'z.array(z.unknown())'\n break\n default:\n expr = 'z.string()'\n }\n\n if (schema.nullable) {\n expr = `${expr}.nullable()`\n }\n\n return expr\n}\n","import { getOperationParameters } from '@internals/shared'\nimport { ast } from '@kubb/core'\nimport { functionPrinter } from '@kubb/plugin-ts'\nimport { Const, File, Function } from '@kubb/renderer-jsx'\nimport type { KubbReactNode } from '@kubb/renderer-jsx/types'\nimport type { PluginMcp } from '../types.ts'\nimport type { ZodParam } from '../utils.ts'\nimport { zodExprFromSchemaNode, zodGroupExpr } from '../utils.ts'\n\ntype Props = {\n /**\n * Variable name for the MCP server instance (e.g. 'server').\n */\n name: string\n /**\n * Human-readable server name passed to `new McpServer({ name })`.\n */\n serverName: string\n /**\n * Semantic version string passed to `new McpServer({ version })`.\n */\n serverVersion: string\n /**\n * How to style your params.\n */\n paramsCasing?: PluginMcp['resolvedOptions']['paramsCasing']\n /**\n * Operations to register as MCP tools, each carrying its handler,\n * zod schema, and AST node metadata.\n */\n operations: Array<{\n tool: {\n name: string\n title?: string\n description: string\n }\n mcp: {\n name: string\n file: ast.FileNode\n }\n zod: {\n pathParams: Array<ZodParam>\n /**\n * Query params — individual schemas to compose into `z.object({ ... })`.\n */\n queryParams?: string | Array<ZodParam>\n /**\n * Header params — individual schemas to compose into `z.object({ ... })`.\n */\n headerParams?: string | Array<ZodParam>\n requestName?: string\n responseName?: string\n }\n node: ast.OperationNode\n }>\n}\n\nconst keysPrinter = functionPrinter({ mode: 'keys' })\n\nexport function Server({ name, serverName, serverVersion, paramsCasing, operations }: Props): KubbReactNode {\n return (\n <File.Source name={name} isExportable isIndexable>\n <Const name={'server'} export>\n {`\n new McpServer({\n name: '${serverName}',\n version: '${serverVersion}',\n})\n `}\n </Const>\n\n {operations\n .map(({ tool, mcp, zod, node }) => {\n const { path: pathParams } = getOperationParameters(node, { paramsCasing })\n\n const pathEntries: Array<{ key: string; value: string }> = []\n const otherEntries: Array<{ key: string; value: string }> = []\n\n for (const p of pathParams) {\n const zodParam = zod.pathParams.find((zp) => zp.name === p.name)\n pathEntries.push({ key: p.name, value: zodParam ? zodParam.schemaName : zodExprFromSchemaNode(p.schema) })\n }\n\n if (zod.requestName) {\n otherEntries.push({ key: 'data', value: zod.requestName })\n }\n\n if (zod.queryParams) {\n otherEntries.push({ key: 'params', value: zodGroupExpr(zod.queryParams) })\n }\n\n if (zod.headerParams) {\n otherEntries.push({ key: 'headers', value: zodGroupExpr(zod.headerParams) })\n }\n\n otherEntries.sort((a, b) => a.key.localeCompare(b.key))\n const entries = [...pathEntries, ...otherEntries]\n\n const paramsNode = entries.length\n ? ast.createFunctionParameters({\n params: [\n ast.createParameterGroup({\n properties: entries.map((e) => ast.createFunctionParameter({ name: e.key, optional: false })),\n }),\n ],\n })\n : undefined\n\n const destructured = paramsNode ? (keysPrinter.print(paramsNode) ?? '') : ''\n const inputSchema = entries.length ? `{ ${entries.map((e) => `${e.key}: ${e.value}`).join(', ')} }` : undefined\n const outputSchema = zod.responseName\n\n const config = [\n tool.title ? `title: ${JSON.stringify(tool.title)}` : null,\n `description: ${JSON.stringify(tool.description)}`,\n outputSchema ? `outputSchema: { data: ${outputSchema} }` : null,\n ]\n .filter(Boolean)\n .join(',\\n ')\n\n if (inputSchema) {\n return `\nserver.registerTool(${JSON.stringify(tool.name)}, {\n ${config},\n inputSchema: ${inputSchema},\n}, async (${destructured}, request) => {\n return ${mcp.name}(${destructured}, request)\n})\n `\n }\n\n return `\nserver.registerTool(${JSON.stringify(tool.name)}, {\n ${config},\n}, async (request) => {\n return ${mcp.name}(request)\n})\n `\n })\n .filter(Boolean)}\n\n <Function name=\"startServer\" async export>\n {`try {\n const transport = new StdioServerTransport()\n await server.connect(transport)\n\n } catch (error) {\n console.error('Failed to start server:', error)\n process.exit(1)\n }`}\n </Function>\n </File.Source>\n )\n}\n","import path from 'node:path'\nimport { resolveOperationTypeNames } from '@internals/shared'\nimport { defineGenerator } from '@kubb/core'\nimport { pluginTsName } from '@kubb/plugin-ts'\nimport { File, jsxRenderer } from '@kubb/renderer-jsx'\nimport { McpHandler } from '../components/McpHandler.tsx'\nimport type { PluginMcp } from '../types.ts'\n\nexport const mcpGenerator = defineGenerator<PluginMcp>({\n name: 'mcp',\n renderer: jsxRenderer,\n operation(node, ctx) {\n const { resolver, driver, root } = ctx\n const { output, client, paramsCasing, group } = ctx.options\n\n const pluginTs = driver.getPlugin(pluginTsName)\n\n if (!pluginTs) {\n return null\n }\n\n const tsResolver = driver.getResolver(pluginTsName)\n\n const importedTypeNames = resolveOperationTypeNames(node, tsResolver, { paramsCasing, responseStatusNames: 'error' })\n\n const meta = {\n name: resolver.resolveHandlerName(node),\n file: resolver.resolveFile({ name: node.operationId, extname: '.ts', tag: node.tags[0] ?? 'default', path: node.path }, { root, output, group }),\n fileTs: tsResolver.resolveFile(\n { name: node.operationId, extname: '.ts', tag: node.tags[0] ?? 'default', path: node.path },\n {\n root,\n output: pluginTs.options?.output ?? output,\n group: pluginTs.options?.group,\n },\n ),\n } as const\n\n return (\n <File baseName={meta.file.baseName} path={meta.file.path} meta={meta.file.meta}>\n {meta.fileTs && importedTypeNames.length > 0 && (\n <File.Import name={Array.from(new Set(importedTypeNames)).sort()} root={meta.file.path} path={meta.fileTs.path} isTypeOnly />\n )}\n <File.Import name={['CallToolResult', 'ServerNotification', 'ServerRequest']} path={'@modelcontextprotocol/sdk/types'} isTypeOnly />\n <File.Import name={['RequestHandlerExtra']} path={'@modelcontextprotocol/sdk/shared/protocol'} isTypeOnly />\n <File.Import name={['buildFormData']} root={meta.file.path} path={path.resolve(root, '.kubb/config.ts')} />\n {client.importPath ? (\n <>\n <File.Import name={['Client', 'RequestConfig', 'ResponseErrorConfig']} path={client.importPath} isTypeOnly />\n <File.Import name={'fetch'} path={client.importPath} />\n {client.dataReturnType === 'full' && <File.Import name={['ResponseConfig']} path={client.importPath} isTypeOnly />}\n </>\n ) : (\n <>\n <File.Import\n name={['Client', 'RequestConfig', 'ResponseErrorConfig']}\n root={meta.file.path}\n path={path.resolve(root, '.kubb/fetch.ts')}\n isTypeOnly\n />\n <File.Import name={['fetch']} root={meta.file.path} path={path.resolve(root, '.kubb/fetch.ts')} />\n {client.dataReturnType === 'full' && (\n <File.Import name={['ResponseConfig']} root={meta.file.path} path={path.resolve(root, '.kubb/fetch.ts')} isTypeOnly />\n )}\n </>\n )}\n\n <McpHandler\n name={meta.name}\n node={node}\n resolver={tsResolver}\n baseURL={client.baseURL}\n dataReturnType={client.dataReturnType || 'data'}\n paramsCasing={paramsCasing}\n />\n </File>\n )\n },\n})\n","import path from 'node:path'\nimport { findSuccessStatusCode, getOperationParameters } from '@internals/shared'\nimport { defineGenerator } from '@kubb/core'\nimport { pluginZodName } from '@kubb/plugin-zod'\nimport { File, jsxRenderer } from '@kubb/renderer-jsx'\nimport { Server } from '../components/Server.tsx'\nimport type { PluginMcp } from '../types.ts'\n\n/**\n * Default v5 server generator for `@kubb/plugin-mcp`.\n *\n * Uses individual zod schemas for each param (e.g. `createPetsPathUuidSchema`, `createPetsQueryOffsetSchema`)\n * and `resolveResponseStatusName` for per-status response schemas.\n * Query and header params are composed into `z.object({ ... })` from individual schemas.\n */\nexport const serverGenerator = defineGenerator<PluginMcp>({\n name: 'operations',\n renderer: jsxRenderer,\n operations(nodes, ctx) {\n const { adapter, config, resolver, plugin, driver, root } = ctx\n const { output, paramsCasing, group } = ctx.options\n\n const pluginZod = driver.getPlugin(pluginZodName)\n\n if (!pluginZod) {\n return\n }\n\n const zodResolver = driver.getResolver(pluginZodName)\n\n const name = 'server'\n const serverFilePath = path.resolve(root, output.path, 'server.ts')\n const serverFile = {\n baseName: 'server.ts' as const,\n path: serverFilePath,\n meta: { pluginName: plugin.name },\n }\n\n const jsonFilePath = path.resolve(root, output.path, '.mcp.json')\n const jsonFile = {\n baseName: '.mcp.json' as const,\n path: jsonFilePath,\n meta: { pluginName: plugin.name },\n }\n\n const operationsMapped = nodes.map((node) => {\n const { path: pathParams, query: queryParams, header: headerParams } = getOperationParameters(node, { paramsCasing })\n\n const mcpFile = resolver.resolveFile({ name: node.operationId, extname: '.ts', tag: node.tags[0] ?? 'default', path: node.path }, { root, output, group })\n\n const zodFile = zodResolver.resolveFile(\n { name: node.operationId, extname: '.ts', tag: node.tags[0] ?? 'default', path: node.path },\n {\n root,\n output: pluginZod.options?.output ?? output,\n group: pluginZod.options?.group,\n },\n )\n\n const requestName = node.requestBody?.content?.[0]?.schema ? zodResolver.resolveDataName(node) : undefined\n const successStatus = findSuccessStatusCode(node.responses)\n const responseName = successStatus ? zodResolver.resolveResponseStatusName(node, successStatus) : undefined\n\n const resolveParams = (params: typeof pathParams) => params.map((p) => ({ name: p.name, schemaName: zodResolver.resolveParamName(node, p) }))\n\n return {\n tool: {\n name: node.operationId,\n title: node.summary || undefined,\n description: node.description || `Make a ${node.method.toUpperCase()} request to ${node.path}`,\n },\n mcp: {\n name: resolver.resolveHandlerName(node),\n file: mcpFile,\n },\n zod: {\n pathParams: resolveParams(pathParams),\n queryParams: queryParams.length ? resolveParams(queryParams) : undefined,\n headerParams: headerParams.length ? resolveParams(headerParams) : undefined,\n requestName,\n responseName,\n file: zodFile,\n },\n node: node,\n }\n })\n\n const imports = operationsMapped.flatMap(({ mcp, zod }) => {\n const zodNames = [\n ...zod.pathParams.map((p) => p.schemaName),\n ...(zod.queryParams ?? []).map((p) => p.schemaName),\n ...(zod.headerParams ?? []).map((p) => p.schemaName),\n zod.requestName,\n zod.responseName,\n ].filter((name): name is string => Boolean(name))\n\n const uniqueNames = [...new Set(zodNames)].sort()\n\n return [\n <File.Import key={mcp.name} name={[mcp.name]} root={serverFile.path} path={mcp.file.path} />,\n uniqueNames.length > 0 && <File.Import key={`zod-${mcp.name}`} name={uniqueNames} root={serverFile.path} path={zod.file.path} />,\n ].filter(Boolean)\n })\n\n return (\n <>\n <File\n baseName={serverFile.baseName}\n path={serverFile.path}\n meta={serverFile.meta}\n banner={resolver.resolveBanner(adapter.inputNode, { output, config })}\n footer={resolver.resolveFooter(adapter.inputNode, { output, config })}\n >\n <File.Import name={['McpServer']} path={'@modelcontextprotocol/sdk/server/mcp'} />\n <File.Import name={['z']} path={'zod'} />\n <File.Import name={['StdioServerTransport']} path={'@modelcontextprotocol/sdk/server/stdio'} />\n\n {imports}\n <Server\n name={name}\n serverName={adapter.inputNode?.meta?.title ?? 'server'}\n serverVersion={adapter.inputNode?.meta?.version ?? '0.0.0'}\n paramsCasing={paramsCasing}\n operations={operationsMapped}\n />\n </File>\n\n <File baseName={jsonFile.baseName} path={jsonFile.path} meta={jsonFile.meta}>\n <File.Source name={name}>\n {`\n {\n \"mcpServers\": {\n \"${adapter.inputNode?.meta?.title || 'server'}\": {\n \"type\": \"stdio\",\n \"command\": \"npx\",\n \"args\": [\"tsx\", \"${path.relative(path.dirname(jsonFile.path), serverFile.path)}\"]\n }\n }\n }\n `}\n </File.Source>\n </File>\n </>\n )\n },\n})\n","import { camelCase } from '@internals/utils'\nimport { defineResolver } from '@kubb/core'\nimport type { PluginMcp } from '../types.ts'\n\n/**\n * Naming convention resolver for MCP plugin.\n *\n * Provides default naming helpers using camelCase with a `handler` suffix for functions.\n *\n * @example\n * `resolverMcp.default('addPet', 'function') // → 'addPetHandler'`\n */\nexport const resolverMcp = defineResolver<PluginMcp>(() => ({\n name: 'default',\n pluginName: 'plugin-mcp',\n default(name, type) {\n if (type === 'file') {\n return camelCase(name, { isFile: true })\n }\n return camelCase(name, { suffix: 'handler' })\n },\n resolveName(name) {\n return this.default(name, 'function')\n },\n resolvePathName(name, type) {\n return this.default(name, type)\n },\n resolveHandlerName(node) {\n return this.resolveName(node.operationId)\n },\n}))\n","import path from 'node:path'\nimport { camelCase } from '@internals/utils'\n\nimport { ast, definePlugin, type Group } from '@kubb/core'\nimport { pluginClientName } from '@kubb/plugin-client'\nimport { source as axiosClientSource } from '@kubb/plugin-client/templates/clients/axios.source'\nimport { source as fetchClientSource } from '@kubb/plugin-client/templates/clients/fetch.source'\nimport { source as configSource } from '@kubb/plugin-client/templates/config.source'\nimport { pluginTsName } from '@kubb/plugin-ts'\nimport { pluginZodName } from '@kubb/plugin-zod'\nimport { mcpGenerator } from './generators/mcpGenerator.tsx'\nimport { serverGenerator } from './generators/serverGenerator.tsx'\nimport { resolverMcp } from './resolvers/resolverMcp.ts'\nimport type { PluginMcp } from './types.ts'\n\nexport const pluginMcpName = 'plugin-mcp' satisfies PluginMcp['name']\n\nexport const pluginMcp = definePlugin<PluginMcp>((options) => {\n const {\n output = { path: 'mcp', barrelType: 'named' },\n group,\n exclude = [],\n include,\n override = [],\n paramsCasing,\n client,\n resolver: userResolver,\n transformer: userTransformer,\n generators: userGenerators = [],\n } = options\n\n const clientName = client?.client ?? 'axios'\n const clientImportPath = client?.importPath ?? (!client?.bundle ? `@kubb/plugin-client/clients/${clientName}` : undefined)\n\n const groupConfig = group\n ? ({\n ...group,\n name: group.name\n ? group.name\n : (ctx: { group: string }) => {\n if (group.type === 'path') {\n return `${ctx.group.split('/')[1]}`\n }\n return `${camelCase(ctx.group)}Requests`\n },\n } satisfies Group)\n : undefined\n\n return {\n name: pluginMcpName,\n options,\n dependencies: [pluginTsName, pluginZodName],\n hooks: {\n 'kubb:plugin:setup'(ctx) {\n const resolver = userResolver ? { ...resolverMcp, ...userResolver } : resolverMcp\n\n ctx.setOptions({\n output,\n exclude,\n include,\n override,\n group: groupConfig,\n paramsCasing,\n client: {\n client: clientName,\n clientType: client?.clientType ?? 'function',\n importPath: clientImportPath,\n dataReturnType: client?.dataReturnType ?? 'data',\n bundle: client?.bundle,\n baseURL: client?.baseURL,\n paramsCasing: client?.paramsCasing,\n },\n resolver,\n })\n ctx.setResolver(resolver)\n if (userTransformer) {\n ctx.setTransformer(userTransformer)\n }\n ctx.addGenerator(mcpGenerator)\n ctx.addGenerator(serverGenerator)\n for (const gen of userGenerators) {\n ctx.addGenerator(gen)\n }\n\n const root = path.resolve(ctx.config.root, ctx.config.output.path)\n const hasClientPlugin = ctx.config.plugins?.some((p) => p.name === pluginClientName)\n\n if (client?.bundle && !hasClientPlugin && !clientImportPath) {\n ctx.injectFile({\n baseName: 'fetch.ts',\n path: path.resolve(root, '.kubb/fetch.ts'),\n sources: [\n ast.createSource({\n name: 'fetch',\n nodes: [ast.createText(clientName === 'fetch' ? fetchClientSource : axiosClientSource)],\n isExportable: true,\n isIndexable: true,\n }),\n ],\n })\n }\n\n if (!hasClientPlugin) {\n ctx.injectFile({\n baseName: 'config.ts',\n path: path.resolve(root, '.kubb/config.ts'),\n sources: [\n ast.createSource({\n name: 'config',\n nodes: [ast.createText(configSource)],\n isExportable: false,\n isIndexable: false,\n }),\n ],\n })\n }\n },\n },\n }\n})\n\nexport default pluginMcp\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAsBA,SAAS,gBAAgB,MAAc,QAAyB;CAS9D,OARmB,KAChB,MAAM,CACN,QAAQ,qBAAqB,QAAQ,CACrC,QAAQ,yBAAyB,QAAQ,CACzC,QAAQ,gBAAgB,QAEH,CAAC,MAAM,gBAAgB,CAAC,OAAO,QAE3C,CACT,KAAK,MAAM,MAAM;EAEhB,IADiB,KAAK,SAAS,KAAK,SAAS,KAAK,aAAa,EACjD,OAAO;EACrB,IAAI,MAAM,KAAK,CAAC,QAAQ,OAAO,KAAK,OAAO,EAAE,CAAC,aAAa,GAAG,KAAK,MAAM,EAAE;EAC3E,OAAO,KAAK,OAAO,EAAE,CAAC,aAAa,GAAG,KAAK,MAAM,EAAE;GACnD,CACD,KAAK,GAAG,CACR,QAAQ,iBAAiB,GAAG;;;;;;;;;;AAWjC,SAAS,iBAAiB,MAAc,eAAkE;CACxG,MAAM,QAAQ,KAAK,MAAM,iBAAiB;CAC1C,OAAO,MAAM,KAAK,MAAM,MAAM,cAAc,MAAM,MAAM,MAAM,SAAS,EAAE,CAAC,CAAC,KAAK,IAAI;;;;;;;;;;AAWtF,SAAgB,UAAU,MAAc,EAAE,QAAQ,SAAS,IAAI,SAAS,OAAgB,EAAE,EAAU;CAClG,IAAI,QACF,OAAO,iBAAiB,OAAO,MAAM,WAAW,UAAU,MAAM,SAAS;EAAE;EAAQ;EAAQ,GAAG,EAAE,CAAC,CAAC;CAGpG,OAAO,gBAAgB,GAAG,OAAO,GAAG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,SAAS,QAAQ;KACjB,cAAc,QAAQ;KACvB;IACD;IACD,CAAC;GACF,IAAI,YAAY,SAAS;GACzB,IAAI,iBACF,IAAI,eAAe,gBAAgB;GAErC,IAAI,aAAa,aAAa;GAC9B,IAAI,aAAa,gBAAgB;GACjC,KAAK,MAAM,OAAO,gBAChB,IAAI,aAAa,IAAI;GAGvB,MAAM,OAAOC,YAAAA,QAAK,QAAQ,IAAI,OAAO,MAAM,IAAI,OAAO,OAAO,KAAK;GAClE,MAAM,kBAAkB,IAAI,OAAO,SAAS,MAAM,MAAM,EAAE,SAASC,oBAAAA,iBAAiB;GAEpF,IAAI,QAAQ,UAAU,CAAC,mBAAmB,CAAC,kBACzC,IAAI,WAAW;IACb,UAAU;IACV,MAAMD,YAAAA,QAAK,QAAQ,MAAM,iBAAiB;IAC1C,SAAS,CACPE,WAAAA,IAAI,aAAa;KACf,MAAM;KACN,OAAO,CAACA,WAAAA,IAAI,WAAW,eAAe,UAAUC,mDAAAA,SAAoBC,mDAAAA,OAAkB,CAAC;KACvF,cAAc;KACd,aAAa;KACd,CAAC,CACH;IACF,CAAC;GAGJ,IAAI,CAAC,iBACH,IAAI,WAAW;IACb,UAAU;IACV,MAAMJ,YAAAA,QAAK,QAAQ,MAAM,kBAAkB;IAC3C,SAAS,CACPE,WAAAA,IAAI,aAAa;KACf,MAAM;KACN,OAAO,CAACA,WAAAA,IAAI,WAAWG,4CAAAA,OAAa,CAAC;KACrC,cAAc;KACd,aAAa;KACd,CAAC,CACH;IACF,CAAC;KAGP;EACF;EACD"}
1
+ {"version":3,"file":"index.cjs","names":["#options","#transformParam","#eachParam","ast","ast","File","Function","File","Const","ast","Function","jsxRendererSync","pluginTsName","File","path","jsxRendererSync","pluginZodName","path","File","pluginTsName","pluginZodName","path","pluginClientName","ast","fetchClientSource","axiosClientSource","configSource"],"sources":["../../../internals/utils/src/casing.ts","../../../internals/utils/src/reserved.ts","../../../internals/utils/src/urlPath.ts","../../../internals/shared/src/operation.ts","../../../internals/shared/src/params.ts","../src/components/McpHandler.tsx","../src/utils.ts","../src/components/Server.tsx","../src/generators/mcpGenerator.tsx","../src/generators/serverGenerator.tsx","../src/resolvers/resolverMcp.ts","../src/plugin.ts"],"sourcesContent":["type Options = {\n /**\n * When `true`, dot-separated segments are split on `.` and joined with `/` after casing.\n */\n isFile?: boolean\n /**\n * Text prepended before casing is applied.\n */\n prefix?: string\n /**\n * Text appended before casing is applied.\n */\n suffix?: string\n}\n\n/**\n * Shared implementation for camelCase and PascalCase conversion.\n * Splits on common word boundaries (spaces, hyphens, underscores, dots, slashes, colons)\n * and capitalizes each word according to `pascal`.\n *\n * When `pascal` is `true` the first word is also capitalized (PascalCase), otherwise only subsequent words are.\n */\nfunction toCamelOrPascal(text: string, pascal: boolean): string {\n const normalized = text\n .trim()\n .replace(/([a-z\\d])([A-Z])/g, '$1 $2')\n .replace(/([A-Z]+)([A-Z][a-z])/g, '$1 $2')\n .replace(/(\\d)([a-z])/g, '$1 $2')\n\n const words = normalized.split(/[\\s\\-_./\\\\:]+/).filter(Boolean)\n\n return words\n .map((word, i) => {\n const allUpper = word.length > 1 && word === word.toUpperCase()\n if (allUpper) return word\n if (i === 0 && !pascal) return word.charAt(0).toLowerCase() + word.slice(1)\n return word.charAt(0).toUpperCase() + word.slice(1)\n })\n .join('')\n .replace(/[^a-zA-Z0-9]/g, '')\n}\n\n/**\n * Splits `text` on `.` and applies `transformPart` to each segment.\n * The last segment receives `isLast = true`, all earlier segments receive `false`.\n * Segments are joined with `/` to form a file path.\n *\n * Only splits on dots followed by a letter so that version numbers\n * embedded in operationIds (e.g. `v2025.0`) are kept intact.\n */\nfunction applyToFileParts(text: string, transformPart: (part: string, isLast: boolean) => string): string {\n const parts = text.split(/\\.(?=[a-zA-Z])/)\n return parts.map((part, i) => transformPart(part, i === parts.length - 1)).join('/')\n}\n\n/**\n * Converts `text` to camelCase.\n * When `isFile` is `true`, dot-separated segments are each cased independently and joined with `/`.\n *\n * @example\n * camelCase('hello-world') // 'helloWorld'\n * camelCase('pet.petId', { isFile: true }) // 'pet/petId'\n */\nexport function camelCase(text: string, { isFile, prefix = '', suffix = '' }: Options = {}): string {\n if (isFile) {\n return applyToFileParts(text, (part, isLast) => camelCase(part, isLast ? { prefix, suffix } : {}))\n }\n\n return toCamelOrPascal(`${prefix} ${text} ${suffix}`, false)\n}\n\n/**\n * Converts `text` to PascalCase.\n * When `isFile` is `true`, the last dot-separated segment is PascalCased and earlier segments are camelCased.\n *\n * @example\n * pascalCase('hello-world') // 'HelloWorld'\n * pascalCase('pet.petId', { isFile: true }) // 'pet/PetId'\n */\nexport function pascalCase(text: string, { isFile, prefix = '', suffix = '' }: Options = {}): string {\n if (isFile) {\n return applyToFileParts(text, (part, isLast) => (isLast ? pascalCase(part, { prefix, suffix }) : camelCase(part)))\n }\n\n return toCamelOrPascal(`${prefix} ${text} ${suffix}`, true)\n}\n\n/**\n * Converts `text` to snake_case.\n *\n * @example\n * snakeCase('helloWorld') // 'hello_world'\n * snakeCase('Hello-World') // 'hello_world'\n */\nexport function snakeCase(text: string, { prefix = '', suffix = '' }: Omit<Options, 'isFile'> = {}): string {\n const processed = `${prefix} ${text} ${suffix}`.trim()\n return processed\n .replace(/([a-z])([A-Z])/g, '$1_$2')\n .replace(/[\\s\\-.]+/g, '_')\n .replace(/[^a-zA-Z0-9_]/g, '')\n .toLowerCase()\n .split('_')\n .filter(Boolean)\n .join('_')\n}\n\n/**\n * Converts `text` to SCREAMING_SNAKE_CASE.\n *\n * @example\n * screamingSnakeCase('helloWorld') // 'HELLO_WORLD'\n */\nexport function screamingSnakeCase(text: string, { prefix = '', suffix = '' }: Omit<Options, 'isFile'> = {}): string {\n return snakeCase(text, { prefix, suffix }).toUpperCase()\n}\n","/**\n * JavaScript and Java reserved words.\n * @link https://github.com/jonschlinkert/reserved/blob/master/index.js\n */\nconst reservedWords = new Set([\n 'abstract',\n 'arguments',\n 'boolean',\n 'break',\n 'byte',\n 'case',\n 'catch',\n 'char',\n 'class',\n 'const',\n 'continue',\n 'debugger',\n 'default',\n 'delete',\n 'do',\n 'double',\n 'else',\n 'enum',\n 'eval',\n 'export',\n 'extends',\n 'false',\n 'final',\n 'finally',\n 'float',\n 'for',\n 'function',\n 'goto',\n 'if',\n 'implements',\n 'import',\n 'in',\n 'instanceof',\n 'int',\n 'interface',\n 'let',\n 'long',\n 'native',\n 'new',\n 'null',\n 'package',\n 'private',\n 'protected',\n 'public',\n 'return',\n 'short',\n 'static',\n 'super',\n 'switch',\n 'synchronized',\n 'this',\n 'throw',\n 'throws',\n 'transient',\n 'true',\n 'try',\n 'typeof',\n 'var',\n 'void',\n 'volatile',\n 'while',\n 'with',\n 'yield',\n 'Array',\n 'Date',\n 'hasOwnProperty',\n 'Infinity',\n 'isFinite',\n 'isNaN',\n 'isPrototypeOf',\n 'length',\n 'Math',\n 'name',\n 'NaN',\n 'Number',\n 'Object',\n 'prototype',\n 'String',\n 'toString',\n 'undefined',\n 'valueOf',\n] as const)\n\n/**\n * Returns `true` when `name` is a syntactically valid JavaScript variable name.\n *\n * @example\n * ```ts\n * isValidVarName('status') // true\n * isValidVarName('class') // false (reserved word)\n * isValidVarName('42foo') // false (starts with digit)\n * ```\n */\nexport function isValidVarName(name: string): boolean {\n if (!name || reservedWords.has(name as 'valueOf')) {\n return false\n }\n return /^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(name)\n}\n","import { camelCase } from './casing.ts'\nimport { isValidVarName } from './reserved.ts'\n\nexport type URLObject = {\n /**\n * The resolved URL string (Express-style or template literal, depending on context).\n */\n url: string\n /**\n * Extracted path parameters as a key-value map, or `undefined` when the path has none.\n */\n params?: Record<string, string>\n}\n\ntype ObjectOptions = {\n /**\n * Controls whether the `url` is rendered as an Express path or a template literal.\n * @default 'path'\n */\n type?: 'path' | 'template'\n /**\n * Optional transform applied to each extracted parameter name.\n */\n replacer?: (pathParam: string) => string\n /**\n * When `true`, the result is serialized to a string expression instead of a plain object.\n */\n stringify?: boolean\n}\n\n/**\n * Supported identifier casing strategies for path parameters.\n */\ntype PathCasing = 'camelcase'\n\ntype Options = {\n /**\n * Casing strategy applied to path parameter names.\n * @default undefined (original identifier preserved)\n */\n casing?: PathCasing\n}\n\n/**\n * Parses and transforms an OpenAPI/Swagger path string into various URL formats.\n *\n * @example\n * const p = new URLPath('/pet/{petId}')\n * p.URL // '/pet/:petId'\n * p.template // '`/pet/${petId}`'\n */\nexport class URLPath {\n /**\n * The raw OpenAPI/Swagger path string, e.g. `/pet/{petId}`.\n */\n path: string\n\n #options: Options\n\n constructor(path: string, options: Options = {}) {\n this.path = path\n this.#options = options\n }\n\n /** Converts the OpenAPI path to Express-style colon syntax, e.g. `/pet/{petId}` → `/pet/:petId`.\n *\n * @example\n * ```ts\n * new URLPath('/pet/{petId}').URL // '/pet/:petId'\n * ```\n */\n get URL(): string {\n return this.toURLPath()\n }\n\n /** Returns `true` when `path` is a fully-qualified URL (e.g. starts with `https://`).\n *\n * @example\n * ```ts\n * new URLPath('https://petstore.swagger.io/v2/pet').isURL // true\n * new URLPath('/pet/{petId}').isURL // false\n * ```\n */\n get isURL(): boolean {\n try {\n return !!new URL(this.path).href\n } catch {\n return false\n }\n }\n\n /**\n * Converts the OpenAPI path to a TypeScript template literal string.\n *\n * @example\n * new URLPath('/pet/{petId}').template // '`/pet/${petId}`'\n * new URLPath('/account/monetary-accountID').template // '`/account/${monetaryAccountId}`'\n */\n get template(): string {\n return this.toTemplateString()\n }\n\n /** Returns the path and its extracted params as a structured `URLObject`, or as a stringified expression when `stringify` is set.\n *\n * @example\n * ```ts\n * new URLPath('/pet/{petId}').object\n * // { url: '/pet/:petId', params: { petId: 'petId' } }\n * ```\n */\n get object(): URLObject | string {\n return this.toObject()\n }\n\n /** Returns a map of path parameter names, or `undefined` when the path has no parameters.\n *\n * @example\n * ```ts\n * new URLPath('/pet/{petId}').params // { petId: 'petId' }\n * new URLPath('/pet').params // undefined\n * ```\n */\n get params(): Record<string, string> | undefined {\n return this.toParamsObject()\n }\n\n #transformParam(raw: string): string {\n const param = isValidVarName(raw) ? raw : camelCase(raw)\n return this.#options.casing === 'camelcase' ? camelCase(param) : param\n }\n\n /**\n * Iterates over every `{param}` token in `path`, calling `fn` with the raw token and transformed name.\n */\n #eachParam(fn: (raw: string, param: string) => void): void {\n for (const match of this.path.matchAll(/\\{([^}]+)\\}/g)) {\n const raw = match[1]!\n fn(raw, this.#transformParam(raw))\n }\n }\n\n toObject({ type = 'path', replacer, stringify }: ObjectOptions = {}): URLObject | string {\n const object = {\n url: type === 'path' ? this.toURLPath() : this.toTemplateString({ replacer }),\n params: this.toParamsObject(),\n }\n\n if (stringify) {\n if (type === 'template') {\n return JSON.stringify(object).replaceAll(\"'\", '').replaceAll(`\"`, '')\n }\n\n if (object.params) {\n return `{ url: '${object.url}', params: ${JSON.stringify(object.params).replaceAll(\"'\", '').replaceAll(`\"`, '')} }`\n }\n\n return `{ url: '${object.url}' }`\n }\n\n return object\n }\n\n /**\n * Converts the OpenAPI path to a TypeScript template literal string.\n * An optional `replacer` can transform each extracted parameter name before interpolation.\n *\n * @example\n * new URLPath('/pet/{petId}').toTemplateString() // '`/pet/${petId}`'\n */\n toTemplateString({ prefix = '', replacer }: { prefix?: string; replacer?: (pathParam: string) => string } = {}): string {\n const parts = this.path.split(/\\{([^}]+)\\}/)\n const result = parts\n .map((part, i) => {\n if (i % 2 === 0) return part\n const param = this.#transformParam(part)\n return `\\${${replacer ? replacer(param) : param}}`\n })\n .join('')\n\n return `\\`${prefix}${result}\\``\n }\n\n /**\n * Extracts all `{param}` segments from the path and returns them as a key-value map.\n * An optional `replacer` transforms each parameter name in both key and value positions.\n * Returns `undefined` when no path parameters are found.\n *\n * @example\n * ```ts\n * new URLPath('/pet/{petId}/tag/{tagId}').toParamsObject()\n * // { petId: 'petId', tagId: 'tagId' }\n * ```\n */\n toParamsObject(replacer?: (pathParam: string) => string): Record<string, string> | undefined {\n const params: Record<string, string> = {}\n\n this.#eachParam((_raw, param) => {\n const key = replacer ? replacer(param) : param\n params[key] = key\n })\n\n return Object.keys(params).length > 0 ? params : undefined\n }\n\n /** Converts the OpenAPI path to Express-style colon syntax.\n *\n * @example\n * ```ts\n * new URLPath('/pet/{petId}').toURLPath() // '/pet/:petId'\n * ```\n */\n toURLPath(): string {\n return this.path.replace(/\\{([^}]+)\\}/g, ':$1')\n }\n}\n","import { URLPath } from '@internals/utils'\nimport { ast } from '@kubb/core'\n\nexport type ContentTypeInfo = {\n contentTypes: string[]\n isMultipleContentTypes: boolean\n contentTypeUnion: string\n defaultContentType: string\n hasFormData: boolean\n}\n\nexport type RequestConfigResolver = {\n resolveDataName(node: ast.OperationNode): string\n}\n\nexport type ResponseStatusNameResolver = {\n resolveResponseStatusName(node: ast.OperationNode, statusCode: ast.StatusCode): string\n}\n\nexport type ResponseNameResolver = ResponseStatusNameResolver & {\n resolveResponseName(node: ast.OperationNode): string\n}\n\nexport type OperationTypeNameResolver = RequestConfigResolver &\n ResponseNameResolver & {\n resolvePathParamsName(node: ast.OperationNode, param: ast.ParameterNode): string\n resolveQueryParamsName(node: ast.OperationNode, param: ast.ParameterNode): string\n resolveHeaderParamsName(node: ast.OperationNode, param: ast.ParameterNode): string\n }\n\nexport type OperationCommentLink = 'pathTemplate' | 'urlPath' | false | ((node: ast.OperationNode) => string | undefined)\n\nexport type BuildOperationCommentsOptions = {\n link?: OperationCommentLink\n linkPosition?: 'beforeDeprecated' | 'afterDeprecated'\n splitLines?: boolean\n}\n\ntype ResponseLike = {\n statusCode: ast.StatusCode | number | string\n}\n\nexport type OperationParameterGroups = Record<ast.ParameterNode['in'], Array<ast.ParameterNode>>\n\nexport type ResolveOperationTypeNameOptions = {\n paramsCasing?: 'camelcase'\n responseStatusNames?: boolean | 'error'\n exclude?: ReadonlyArray<string | undefined>\n order?: 'params-first' | 'body-response-first'\n}\n\nfunction getOperationLink(node: ast.OperationNode, link: OperationCommentLink): string | undefined {\n if (!link) {\n return undefined\n }\n\n if (typeof link === 'function') {\n return link(node)\n }\n\n if (link === 'urlPath') {\n return node.path ? `{@link ${new URLPath(node.path).URL}}` : undefined\n }\n\n return `{@link ${node.path.replaceAll('{', ':').replaceAll('}', '')}}`\n}\n\nexport function getContentTypeInfo(node: ast.OperationNode): ContentTypeInfo {\n const contentTypes = node.requestBody?.content?.map((e) => e.contentType) ?? []\n const isMultipleContentTypes = contentTypes.length > 1\n\n return {\n contentTypes,\n isMultipleContentTypes,\n contentTypeUnion: isMultipleContentTypes ? contentTypes.map((ct) => JSON.stringify(ct)).join(' | ') : '',\n defaultContentType: contentTypes[0] ?? 'application/json',\n hasFormData: contentTypes.some((ct) => ct === 'multipart/form-data'),\n }\n}\n\nexport function buildRequestConfigType(node: ast.OperationNode, resolver: RequestConfigResolver): string {\n const requestName = node.requestBody?.content?.[0]?.schema ? resolver.resolveDataName(node) : undefined\n const { isMultipleContentTypes, contentTypeUnion } = getContentTypeInfo(node)\n const configType = requestName ? `Partial<RequestConfig<${requestName}>>` : 'Partial<RequestConfig>'\n const configProps = ['client?: Client', isMultipleContentTypes ? `contentType?: ${contentTypeUnion}` : undefined].filter(Boolean).join('; ')\n\n return `${configType} & { ${configProps} }`\n}\n\nexport function buildOperationComments(node: ast.OperationNode, options: BuildOperationCommentsOptions = {}): Array<string> {\n const { link = 'pathTemplate', linkPosition = 'afterDeprecated', splitLines = false } = options\n const linkComment = getOperationLink(node, link)\n const comments =\n linkPosition === 'beforeDeprecated'\n ? [node.description && `@description ${node.description}`, node.summary && `@summary ${node.summary}`, linkComment, node.deprecated && '@deprecated']\n : [node.description && `@description ${node.description}`, node.summary && `@summary ${node.summary}`, node.deprecated && '@deprecated', linkComment]\n\n const filteredComments = comments.filter((comment): comment is string => Boolean(comment))\n\n if (!splitLines) {\n return filteredComments\n }\n\n return filteredComments.flatMap((text) => text.split(/\\r?\\n/).map((line) => line.trim())).filter((comment): comment is string => Boolean(comment))\n}\n\nexport function getOperationParameters(node: ast.OperationNode, options: { paramsCasing?: 'camelcase' } = {}): OperationParameterGroups {\n const params = ast.caseParams(node.parameters, options.paramsCasing)\n\n return {\n path: params.filter((param) => param.in === 'path'),\n query: params.filter((param) => param.in === 'query'),\n header: params.filter((param) => param.in === 'header'),\n cookie: params.filter((param) => param.in === 'cookie'),\n }\n}\n\nexport function getStatusCodeNumber(statusCode: ast.StatusCode | number | string): number | undefined {\n const code = Number(statusCode)\n\n return Number.isNaN(code) ? undefined : code\n}\n\nexport function isSuccessStatusCode(statusCode: ast.StatusCode | number | string): boolean {\n const code = getStatusCodeNumber(statusCode)\n\n return code !== undefined && code >= 200 && code < 300\n}\n\nexport function isErrorStatusCode(statusCode: ast.StatusCode | number | string): boolean {\n const code = getStatusCodeNumber(statusCode)\n\n return code !== undefined && code >= 400\n}\n\nexport function getSuccessResponses<TResponse extends ResponseLike>(responses: ReadonlyArray<TResponse>): Array<TResponse> {\n return responses.filter((response) => isSuccessStatusCode(response.statusCode))\n}\n\nexport function getOperationSuccessResponses(node: ast.OperationNode): Array<ast.ResponseNode> {\n return getSuccessResponses(node.responses)\n}\n\nexport function getPrimarySuccessResponse(node: ast.OperationNode): ast.ResponseNode | undefined {\n return getOperationSuccessResponses(node)[0]\n}\n\nexport function resolveErrorNames(node: ast.OperationNode, resolver: ResponseStatusNameResolver): string[] {\n return node.responses\n .filter((response) => isErrorStatusCode(response.statusCode))\n .map((response) => resolver.resolveResponseStatusName(node, response.statusCode))\n}\n\nexport function resolveStatusCodeNames(node: ast.OperationNode, resolver: ResponseStatusNameResolver): string[] {\n return node.responses.map((response) => resolver.resolveResponseStatusName(node, response.statusCode))\n}\n\nconst typeNamesByResolver = new WeakMap<OperationTypeNameResolver, Map<string, string[]>>()\n\nexport function resolveOperationTypeNames(\n node: ast.OperationNode,\n resolver: OperationTypeNameResolver,\n options: ResolveOperationTypeNameOptions = {},\n): string[] {\n const cacheKey = `${node.operationId}\\0${options.paramsCasing ?? ''}\\0${options.order ?? ''}\\0${options.responseStatusNames ?? ''}\\0${(options.exclude ?? []).join(',')}`\n let byResolver = typeNamesByResolver.get(resolver)\n if (byResolver) {\n const cached = byResolver.get(cacheKey)\n if (cached) return cached\n } else {\n byResolver = new Map()\n typeNamesByResolver.set(resolver, byResolver)\n }\n\n const { path, query, header } = getOperationParameters(node, { paramsCasing: options.paramsCasing })\n const responseStatusNames =\n options.responseStatusNames === 'error'\n ? resolveErrorNames(node, resolver)\n : options.responseStatusNames === false\n ? []\n : resolveStatusCodeNames(node, resolver)\n const exclude = new Set(options.exclude ?? [])\n const paramNames = [\n ...path.map((param) => resolver.resolvePathParamsName(node, param)),\n ...query.map((param) => resolver.resolveQueryParamsName(node, param)),\n ...header.map((param) => resolver.resolveHeaderParamsName(node, param)),\n ]\n const bodyAndResponseNames = [node.requestBody?.content?.[0]?.schema ? resolver.resolveDataName(node) : undefined, resolver.resolveResponseName(node)]\n const names =\n options.order === 'body-response-first'\n ? [...bodyAndResponseNames, ...paramNames, ...responseStatusNames]\n : [...paramNames, ...bodyAndResponseNames, ...responseStatusNames]\n\n const result = names.filter((name): name is string => Boolean(name) && !exclude.has(name))\n byResolver.set(cacheKey, result)\n return result\n}\n\nexport function resolveResponseTypes(node: ast.OperationNode, resolver: ResponseNameResolver): Array<[statusCode: number | 'default', typeName: string]> {\n const types: Array<[number | 'default', string]> = []\n\n for (const response of node.responses) {\n if (response.statusCode === 'default') {\n types.push(['default', resolver.resolveResponseName(node)])\n continue\n }\n\n const code = getStatusCodeNumber(response.statusCode)\n if (code === undefined) {\n continue\n }\n\n types.push([code, isSuccessStatusCode(code) ? resolver.resolveResponseName(node) : resolver.resolveResponseStatusName(node, response.statusCode)])\n }\n\n return types\n}\n\nexport function findSuccessStatusCode(responses: Array<{ statusCode: ast.StatusCode | number | string }>): ast.StatusCode | undefined {\n for (const response of responses) {\n if (isSuccessStatusCode(response.statusCode)) {\n return response.statusCode as ast.StatusCode\n }\n }\n\n return undefined\n}\n","export function buildParamsMapping<TParam extends { name: string }>(\n originalParams: ReadonlyArray<TParam>,\n mappedParams: ReadonlyArray<TParam>,\n): Record<string, string> | undefined {\n const mapping: Record<string, string> = {}\n let hasChanged = false\n\n originalParams.forEach((param, i) => {\n const mappedName = mappedParams[i]?.name ?? param.name\n mapping[param.name] = mappedName\n\n if (param.name !== mappedName) {\n hasChanged = true\n }\n })\n\n return hasChanged ? mapping : undefined\n}\n\nexport function buildTransformedParamsMapping<TParam extends { name: string }>(\n params: ReadonlyArray<TParam>,\n transformName: (name: string) => string,\n): Record<string, string> | undefined {\n if (!params.length) {\n return undefined\n }\n\n return buildParamsMapping(\n params,\n params.map((param) => ({ ...param, name: transformName(param.name) })),\n )\n}\n","import { buildOperationComments, buildTransformedParamsMapping, getOperationParameters } from '@internals/shared'\nimport { camelCase, isValidVarName, URLPath } from '@internals/utils'\nimport { ast } from '@kubb/core'\nimport type { ResolverTs } from '@kubb/plugin-ts'\nimport { functionPrinter } from '@kubb/plugin-ts'\nimport { File, Function } from '@kubb/renderer-jsx'\nimport type { KubbReactNode } from '@kubb/renderer-jsx/types'\nimport type { PluginMcp } from '../types.ts'\n\ntype Props = {\n /**\n * Name of the handler function.\n */\n name: string\n /**\n * AST operation node.\n */\n node: ast.OperationNode\n /**\n * TypeScript resolver for resolving param/data/response type names.\n */\n resolver: ResolverTs\n /**\n * Base URL prepended to every generated request URL.\n */\n baseURL: string | undefined\n /**\n * Return type when calling fetch.\n * - 'data' returns response data only.\n * - 'full' returns the full response object.\n * @default 'data'\n */\n dataReturnType: PluginMcp['resolvedOptions']['client']['dataReturnType']\n /**\n * How to style your params.\n */\n paramsCasing?: PluginMcp['resolvedOptions']['paramsCasing']\n}\n\n/**\n * Generate a remapping statement: `const mappedX = x ? { \"orig\": x.camel, ... } : undefined`\n */\nfunction buildRemappingCode(mapping: Record<string, string>, varName: string, sourceName: string): string {\n const pairs = Object.entries(mapping)\n .map(([orig, camel]) => `\"${orig}\": ${sourceName}.${camel}`)\n .join(', ')\n return `const ${varName} = ${sourceName} ? { ${pairs} } : undefined`\n}\n\nconst declarationPrinter = functionPrinter({ mode: 'declaration' })\n\nexport function McpHandler({ name, node, resolver, baseURL, dataReturnType, paramsCasing }: Props): KubbReactNode {\n const urlPath = new URLPath(node.path)\n const contentType = node.requestBody?.content?.[0]?.contentType\n const isFormData = contentType === 'multipart/form-data'\n\n const { query: queryParams, header: headerParams } = getOperationParameters(node, { paramsCasing })\n const { path: originalPathParams, query: originalQueryParams, header: originalHeaderParams } = getOperationParameters(node)\n\n const requestName = node.requestBody?.content?.[0]?.schema ? resolver.resolveDataName(node) : undefined\n const responseName = resolver.resolveResponseName(node)\n\n const errorResponses = node.responses.filter((r) => Number(r.statusCode) >= 400).map((r) => resolver.resolveResponseStatusName(node, r.statusCode))\n const errorType = errorResponses.length > 0 ? errorResponses.join(' | ') : 'Error'\n\n const TError = `ResponseErrorConfig<${errorType}>`\n const generics = [responseName, TError, requestName || 'unknown'].filter(Boolean)\n\n const paramsNode = ast.createOperationParams(node, {\n paramsType: 'object',\n pathParamsType: 'inline',\n resolver,\n paramsCasing,\n })\n const baseParamsSignature = declarationPrinter.print(paramsNode) ?? ''\n const paramsSignature = baseParamsSignature\n ? `${baseParamsSignature}, request: RequestHandlerExtra<ServerRequest, ServerNotification>`\n : 'request: RequestHandlerExtra<ServerRequest, ServerNotification>'\n\n const pathParamsMapping = paramsCasing ? buildTransformedParamsMapping(originalPathParams, camelCase) : undefined\n const queryParamsMapping = paramsCasing ? buildTransformedParamsMapping(originalQueryParams, camelCase) : undefined\n const headerParamsMapping = paramsCasing ? buildTransformedParamsMapping(originalHeaderParams, camelCase) : undefined\n\n const contentTypeHeader =\n contentType && contentType !== 'application/json' && contentType !== 'multipart/form-data' ? `'Content-Type': '${contentType}'` : undefined\n const headers = [headerParams.length ? (headerParamsMapping ? '...mappedHeaders' : '...headers') : undefined, contentTypeHeader].filter(Boolean)\n\n const fetchConfig: string[] = []\n fetchConfig.push(`method: ${JSON.stringify(node.method.toUpperCase())}`)\n fetchConfig.push(`url: ${urlPath.template}`)\n if (baseURL) fetchConfig.push(`baseURL: \\`${baseURL}\\``)\n if (queryParams.length) fetchConfig.push(queryParamsMapping ? 'params: mappedParams' : 'params')\n if (requestName) fetchConfig.push(`data: ${isFormData ? 'formData as FormData' : 'requestData'}`)\n if (headers.length) fetchConfig.push(`headers: { ${headers.join(', ')} }`)\n\n const callToolResult =\n dataReturnType === 'data'\n ? `return {\n content: [\n {\n type: 'text',\n text: JSON.stringify(res.data)\n }\n ],\n structuredContent: { data: res.data }\n }`\n : `return {\n content: [\n {\n type: 'text',\n text: JSON.stringify(res)\n }\n ],\n structuredContent: { data: res.data }\n }`\n\n return (\n <File.Source name={name} isExportable isIndexable>\n <Function\n name={name}\n async\n export\n params={paramsSignature}\n JSDoc={{\n comments: buildOperationComments(node),\n }}\n returnType={'Promise<CallToolResult>'}\n >\n {''}\n <br />\n <br />\n {pathParamsMapping &&\n Object.entries(pathParamsMapping)\n .filter(([originalName, camelCaseName]) => originalName !== camelCaseName && isValidVarName(originalName))\n .map(([originalName, camelCaseName]) => `const ${originalName} = ${camelCaseName}`)\n .join('\\n')}\n {pathParamsMapping && (\n <>\n <br />\n <br />\n </>\n )}\n {queryParamsMapping && queryParams.length > 0 && (\n <>\n {buildRemappingCode(queryParamsMapping, 'mappedParams', 'params')}\n <br />\n <br />\n </>\n )}\n {headerParamsMapping && headerParams.length > 0 && (\n <>\n {buildRemappingCode(headerParamsMapping, 'mappedHeaders', 'headers')}\n <br />\n <br />\n </>\n )}\n {requestName && 'const requestData = data'}\n <br />\n {isFormData && requestName && 'const formData = buildFormData(requestData)'}\n <br />\n {`const res = await fetch<${generics.join(', ')}>({ ${fetchConfig.join(', ')} }, request)`}\n <br />\n {callToolResult}\n </Function>\n </File.Source>\n )\n}\n","import type { ast } from '@kubb/core'\n\nexport type ZodParam = {\n name: string\n schemaName: string\n}\n\n/**\n * Render a group param value — compose individual schemas into `z.object({ ... })`,\n * or use a schema name string directly.\n */\nexport function zodGroupExpr(entry: string | Array<ZodParam>): string {\n if (typeof entry === 'string') {\n return entry\n }\n const entries = entry.map((p) => `${JSON.stringify(p.name)}: ${p.schemaName}`)\n return `z.object({ ${entries.join(', ')} })`\n}\n\n/**\n * Convert a SchemaNode type to an inline Zod expression string.\n * Used as fallback when no named zod schema is available for a path parameter.\n */\nexport function zodExprFromSchemaNode(schema: ast.SchemaNode): string {\n let expr: string\n switch (schema.type) {\n case 'enum': {\n // namedEnumValues takes priority over enumValues\n const rawValues: Array<string | number | boolean> = schema.namedEnumValues?.length\n ? schema.namedEnumValues.map((v) => v.value)\n : (schema.enumValues ?? []).filter((v): v is string | number | boolean => v !== null)\n\n if (rawValues.length > 0 && rawValues.every((v) => typeof v === 'string')) {\n expr = `z.enum([${rawValues.map((v) => JSON.stringify(v)).join(', ')}])`\n } else if (rawValues.length > 0) {\n const literals = rawValues.map((v) => `z.literal(${JSON.stringify(v)})`)\n expr = literals.length === 1 ? literals[0]! : `z.union([${literals.join(', ')}])`\n } else {\n expr = 'z.string()'\n }\n break\n }\n case 'integer':\n expr = 'z.coerce.number()'\n break\n case 'number':\n expr = 'z.number()'\n break\n case 'boolean':\n expr = 'z.boolean()'\n break\n case 'array':\n expr = 'z.array(z.unknown())'\n break\n default:\n expr = 'z.string()'\n }\n\n if (schema.nullable) {\n expr = `${expr}.nullable()`\n }\n\n return expr\n}\n","import { getOperationParameters } from '@internals/shared'\nimport { ast } from '@kubb/core'\nimport { functionPrinter } from '@kubb/plugin-ts'\nimport { Const, File, Function } from '@kubb/renderer-jsx'\nimport type { KubbReactNode } from '@kubb/renderer-jsx/types'\nimport type { PluginMcp } from '../types.ts'\nimport type { ZodParam } from '../utils.ts'\nimport { zodExprFromSchemaNode, zodGroupExpr } from '../utils.ts'\n\ntype Props = {\n /**\n * Variable name for the MCP server instance (e.g. 'server').\n */\n name: string\n /**\n * Human-readable server name passed to `new McpServer({ name })`.\n */\n serverName: string\n /**\n * Semantic version string passed to `new McpServer({ version })`.\n */\n serverVersion: string\n /**\n * How to style your params.\n */\n paramsCasing?: PluginMcp['resolvedOptions']['paramsCasing']\n /**\n * Operations to register as MCP tools, each carrying its handler,\n * zod schema, and AST node metadata.\n */\n operations: Array<{\n tool: {\n name: string\n title?: string\n description: string\n }\n mcp: {\n name: string\n file: ast.FileNode\n }\n zod: {\n pathParams: Array<ZodParam>\n /**\n * Query params — individual schemas to compose into `z.object({ ... })`.\n */\n queryParams?: string | Array<ZodParam>\n /**\n * Header params — individual schemas to compose into `z.object({ ... })`.\n */\n headerParams?: string | Array<ZodParam>\n requestName?: string\n responseName?: string\n }\n node: ast.OperationNode\n }>\n}\n\nconst keysPrinter = functionPrinter({ mode: 'keys' })\n\nexport function Server({ name, serverName, serverVersion, paramsCasing, operations }: Props): KubbReactNode {\n return (\n <File.Source name={name} isExportable isIndexable>\n <Const name={'server'} export>\n {`\n new McpServer({\n name: '${serverName}',\n version: '${serverVersion}',\n})\n `}\n </Const>\n\n {operations\n .map(({ tool, mcp, zod, node }) => {\n const { path: pathParams } = getOperationParameters(node, { paramsCasing })\n\n const pathEntries: Array<{ key: string; value: string }> = []\n const otherEntries: Array<{ key: string; value: string }> = []\n\n for (const p of pathParams) {\n const zodParam = zod.pathParams.find((zp) => zp.name === p.name)\n pathEntries.push({ key: p.name, value: zodParam ? zodParam.schemaName : zodExprFromSchemaNode(p.schema) })\n }\n\n if (zod.requestName) {\n otherEntries.push({ key: 'data', value: zod.requestName })\n }\n\n if (zod.queryParams) {\n otherEntries.push({ key: 'params', value: zodGroupExpr(zod.queryParams) })\n }\n\n if (zod.headerParams) {\n otherEntries.push({ key: 'headers', value: zodGroupExpr(zod.headerParams) })\n }\n\n otherEntries.sort((a, b) => a.key.localeCompare(b.key))\n const entries = [...pathEntries, ...otherEntries]\n\n const paramsNode = entries.length\n ? ast.createFunctionParameters({\n params: [\n ast.createParameterGroup({\n properties: entries.map((e) => ast.createFunctionParameter({ name: e.key, optional: false })),\n }),\n ],\n })\n : undefined\n\n const destructured = paramsNode ? (keysPrinter.print(paramsNode) ?? '') : ''\n const inputSchema = entries.length ? `{ ${entries.map((e) => `${e.key}: ${e.value}`).join(', ')} }` : undefined\n const outputSchema = zod.responseName\n\n const config = [\n tool.title ? `title: ${JSON.stringify(tool.title)}` : null,\n `description: ${JSON.stringify(tool.description)}`,\n outputSchema ? `outputSchema: { data: ${outputSchema} }` : null,\n ]\n .filter(Boolean)\n .join(',\\n ')\n\n if (inputSchema) {\n return `\nserver.registerTool(${JSON.stringify(tool.name)}, {\n ${config},\n inputSchema: ${inputSchema},\n}, async (${destructured}, request) => {\n return ${mcp.name}(${destructured}, request)\n})\n `\n }\n\n return `\nserver.registerTool(${JSON.stringify(tool.name)}, {\n ${config},\n}, async (request) => {\n return ${mcp.name}(request)\n})\n `\n })\n .filter(Boolean)}\n\n <Function name=\"startServer\" async export>\n {`try {\n const transport = new StdioServerTransport()\n await server.connect(transport)\n\n } catch (error) {\n console.error('Failed to start server:', error)\n process.exit(1)\n }`}\n </Function>\n </File.Source>\n )\n}\n","import path from 'node:path'\nimport { resolveOperationTypeNames } from '@internals/shared'\nimport { defineGenerator } from '@kubb/core'\nimport { pluginTsName } from '@kubb/plugin-ts'\nimport { File, jsxRendererSync } from '@kubb/renderer-jsx'\nimport { McpHandler } from '../components/McpHandler.tsx'\nimport type { PluginMcp } from '../types.ts'\n\nexport const mcpGenerator = defineGenerator<PluginMcp>({\n name: 'mcp',\n renderer: jsxRendererSync,\n operation(node, ctx) {\n const { resolver, driver, root } = ctx\n const { output, client, paramsCasing, group } = ctx.options\n\n const pluginTs = driver.getPlugin(pluginTsName)\n\n if (!pluginTs) {\n return null\n }\n\n const tsResolver = driver.getResolver(pluginTsName)\n\n const importedTypeNames = resolveOperationTypeNames(node, tsResolver, { paramsCasing, responseStatusNames: 'error' })\n\n const meta = {\n name: resolver.resolveHandlerName(node),\n file: resolver.resolveFile({ name: node.operationId, extname: '.ts', tag: node.tags[0] ?? 'default', path: node.path }, { root, output, group }),\n fileTs: tsResolver.resolveFile(\n { name: node.operationId, extname: '.ts', tag: node.tags[0] ?? 'default', path: node.path },\n {\n root,\n output: pluginTs.options?.output ?? output,\n group: pluginTs.options?.group,\n },\n ),\n } as const\n\n return (\n <File baseName={meta.file.baseName} path={meta.file.path} meta={meta.file.meta}>\n {meta.fileTs && importedTypeNames.length > 0 && (\n <File.Import name={Array.from(new Set(importedTypeNames)).sort()} root={meta.file.path} path={meta.fileTs.path} isTypeOnly />\n )}\n <File.Import name={['CallToolResult', 'ServerNotification', 'ServerRequest']} path={'@modelcontextprotocol/sdk/types'} isTypeOnly />\n <File.Import name={['RequestHandlerExtra']} path={'@modelcontextprotocol/sdk/shared/protocol'} isTypeOnly />\n <File.Import name={['buildFormData']} root={meta.file.path} path={path.resolve(root, '.kubb/config.ts')} />\n {client.importPath ? (\n <>\n <File.Import name={['Client', 'RequestConfig', 'ResponseErrorConfig']} path={client.importPath} isTypeOnly />\n <File.Import name={'fetch'} path={client.importPath} />\n {client.dataReturnType === 'full' && <File.Import name={['ResponseConfig']} path={client.importPath} isTypeOnly />}\n </>\n ) : (\n <>\n <File.Import\n name={['Client', 'RequestConfig', 'ResponseErrorConfig']}\n root={meta.file.path}\n path={path.resolve(root, '.kubb/fetch.ts')}\n isTypeOnly\n />\n <File.Import name={['fetch']} root={meta.file.path} path={path.resolve(root, '.kubb/fetch.ts')} />\n {client.dataReturnType === 'full' && (\n <File.Import name={['ResponseConfig']} root={meta.file.path} path={path.resolve(root, '.kubb/fetch.ts')} isTypeOnly />\n )}\n </>\n )}\n\n <McpHandler\n name={meta.name}\n node={node}\n resolver={tsResolver}\n baseURL={client.baseURL}\n dataReturnType={client.dataReturnType || 'data'}\n paramsCasing={paramsCasing}\n />\n </File>\n )\n },\n})\n","import path from 'node:path'\nimport { findSuccessStatusCode, getOperationParameters } from '@internals/shared'\nimport { defineGenerator } from '@kubb/core'\nimport { pluginZodName } from '@kubb/plugin-zod'\nimport { File, jsxRendererSync } from '@kubb/renderer-jsx'\nimport { Server } from '../components/Server.tsx'\nimport type { PluginMcp } from '../types.ts'\n\n/**\n * Default v5 server generator for `@kubb/plugin-mcp`.\n *\n * Uses individual zod schemas for each param (e.g. `createPetsPathUuidSchema`, `createPetsQueryOffsetSchema`)\n * and `resolveResponseStatusName` for per-status response schemas.\n * Query and header params are composed into `z.object({ ... })` from individual schemas.\n */\nexport const serverGenerator = defineGenerator<PluginMcp>({\n name: 'operations',\n renderer: jsxRendererSync,\n operations(nodes, ctx) {\n const { config, resolver, plugin, driver, root, inputNode } = ctx\n const { output, paramsCasing, group } = ctx.options\n\n const pluginZod = driver.getPlugin(pluginZodName)\n\n if (!pluginZod) {\n return\n }\n\n const zodResolver = driver.getResolver(pluginZodName)\n\n const name = 'server'\n const serverFilePath = path.resolve(root, output.path, 'server.ts')\n const serverFile = {\n baseName: 'server.ts' as const,\n path: serverFilePath,\n meta: { pluginName: plugin.name },\n }\n\n const jsonFilePath = path.resolve(root, output.path, '.mcp.json')\n const jsonFile = {\n baseName: '.mcp.json' as const,\n path: jsonFilePath,\n meta: { pluginName: plugin.name },\n }\n\n const operationsMapped = nodes.map((node) => {\n const { path: pathParams, query: queryParams, header: headerParams } = getOperationParameters(node, { paramsCasing })\n\n const mcpFile = resolver.resolveFile({ name: node.operationId, extname: '.ts', tag: node.tags[0] ?? 'default', path: node.path }, { root, output, group })\n\n const zodFile = zodResolver.resolveFile(\n { name: node.operationId, extname: '.ts', tag: node.tags[0] ?? 'default', path: node.path },\n {\n root,\n output: pluginZod.options?.output ?? output,\n group: pluginZod.options?.group,\n },\n )\n\n const requestName = node.requestBody?.content?.[0]?.schema ? zodResolver.resolveDataName(node) : undefined\n const successStatus = findSuccessStatusCode(node.responses)\n const responseName = successStatus ? zodResolver.resolveResponseStatusName(node, successStatus) : undefined\n\n const resolveParams = (params: typeof pathParams) => params.map((p) => ({ name: p.name, schemaName: zodResolver.resolveParamName(node, p) }))\n\n return {\n tool: {\n name: node.operationId,\n title: node.summary || undefined,\n description: node.description || `Make a ${node.method.toUpperCase()} request to ${node.path}`,\n },\n mcp: {\n name: resolver.resolveHandlerName(node),\n file: mcpFile,\n },\n zod: {\n pathParams: resolveParams(pathParams),\n queryParams: queryParams.length ? resolveParams(queryParams) : undefined,\n headerParams: headerParams.length ? resolveParams(headerParams) : undefined,\n requestName,\n responseName,\n file: zodFile,\n },\n node: node,\n }\n })\n\n const imports = operationsMapped.flatMap(({ mcp, zod }) => {\n const zodNames = [\n ...zod.pathParams.map((p) => p.schemaName),\n ...(zod.queryParams ?? []).map((p) => p.schemaName),\n ...(zod.headerParams ?? []).map((p) => p.schemaName),\n zod.requestName,\n zod.responseName,\n ].filter((name): name is string => Boolean(name))\n\n const uniqueNames = [...new Set(zodNames)].sort()\n\n return [\n <File.Import key={mcp.name} name={[mcp.name]} root={serverFile.path} path={mcp.file.path} />,\n uniqueNames.length > 0 && <File.Import key={`zod-${mcp.name}`} name={uniqueNames} root={serverFile.path} path={zod.file.path} />,\n ].filter(Boolean)\n })\n\n return (\n <>\n <File\n baseName={serverFile.baseName}\n path={serverFile.path}\n meta={serverFile.meta}\n banner={resolver.resolveBanner(inputNode, { output, config })}\n footer={resolver.resolveFooter(inputNode, { output, config })}\n >\n <File.Import name={['McpServer']} path={'@modelcontextprotocol/sdk/server/mcp'} />\n <File.Import name={['z']} path={'zod'} />\n <File.Import name={['StdioServerTransport']} path={'@modelcontextprotocol/sdk/server/stdio'} />\n\n {imports}\n <Server\n name={name}\n serverName={inputNode.meta?.title ?? 'server'}\n serverVersion={inputNode.meta?.version ?? '0.0.0'}\n paramsCasing={paramsCasing}\n operations={operationsMapped}\n />\n </File>\n\n <File baseName={jsonFile.baseName} path={jsonFile.path} meta={jsonFile.meta}>\n <File.Source name={name}>\n {`\n {\n \"mcpServers\": {\n \"${inputNode.meta?.title || 'server'}\": {\n \"type\": \"stdio\",\n \"command\": \"npx\",\n \"args\": [\"tsx\", \"${path.relative(path.dirname(jsonFile.path), serverFile.path)}\"]\n }\n }\n }\n `}\n </File.Source>\n </File>\n </>\n )\n },\n})\n","import { camelCase } from '@internals/utils'\nimport { defineResolver } from '@kubb/core'\nimport type { PluginMcp } from '../types.ts'\n\n/**\n * Naming convention resolver for MCP plugin.\n *\n * Provides default naming helpers using camelCase with a `handler` suffix for functions.\n *\n * @example\n * `resolverMcp.default('addPet', 'function') // → 'addPetHandler'`\n */\nexport const resolverMcp = defineResolver<PluginMcp>(() => ({\n name: 'default',\n pluginName: 'plugin-mcp',\n default(name, type) {\n if (type === 'file') {\n return camelCase(name, { isFile: true })\n }\n return camelCase(name, { suffix: 'handler' })\n },\n resolveName(name) {\n return this.default(name, 'function')\n },\n resolvePathName(name, type) {\n return this.default(name, type)\n },\n resolveHandlerName(node) {\n return this.resolveName(node.operationId)\n },\n}))\n","import path from 'node:path'\nimport { camelCase } from '@internals/utils'\n\nimport { ast, definePlugin, type Group } from '@kubb/core'\nimport { pluginClientName } from '@kubb/plugin-client'\nimport { source as axiosClientSource } from '@kubb/plugin-client/templates/clients/axios.source'\nimport { source as fetchClientSource } from '@kubb/plugin-client/templates/clients/fetch.source'\nimport { source as configSource } from '@kubb/plugin-client/templates/config.source'\nimport { pluginTsName } from '@kubb/plugin-ts'\nimport { pluginZodName } from '@kubb/plugin-zod'\nimport { mcpGenerator } from './generators/mcpGenerator.tsx'\nimport { serverGenerator } from './generators/serverGenerator.tsx'\nimport { resolverMcp } from './resolvers/resolverMcp.ts'\nimport type { PluginMcp } from './types.ts'\n\nexport const pluginMcpName = 'plugin-mcp' satisfies PluginMcp['name']\n\nexport const pluginMcp = definePlugin<PluginMcp>((options) => {\n const {\n output = { path: 'mcp', barrelType: 'named' },\n group,\n exclude = [],\n include,\n override = [],\n paramsCasing,\n client,\n resolver: userResolver,\n transformer: userTransformer,\n generators: userGenerators = [],\n } = options\n\n const clientName = client?.client ?? 'axios'\n const clientImportPath = client?.importPath ?? (!client?.bundle ? `@kubb/plugin-client/clients/${clientName}` : undefined)\n\n const groupConfig = group\n ? ({\n ...group,\n name: group.name\n ? group.name\n : (ctx: { group: string }) => {\n if (group.type === 'path') {\n return `${ctx.group.split('/')[1]}`\n }\n return `${camelCase(ctx.group)}Requests`\n },\n } satisfies Group)\n : undefined\n\n return {\n name: pluginMcpName,\n options,\n dependencies: [pluginTsName, pluginZodName],\n hooks: {\n 'kubb:plugin:setup'(ctx) {\n const resolver = userResolver ? { ...resolverMcp, ...userResolver } : resolverMcp\n\n ctx.setOptions({\n output,\n exclude,\n include,\n override,\n group: groupConfig,\n paramsCasing,\n client: {\n client: clientName,\n clientType: client?.clientType ?? 'function',\n importPath: clientImportPath,\n dataReturnType: client?.dataReturnType ?? 'data',\n bundle: client?.bundle,\n baseURL: client?.baseURL,\n paramsCasing: client?.paramsCasing,\n },\n resolver,\n })\n ctx.setResolver(resolver)\n if (userTransformer) {\n ctx.setTransformer(userTransformer)\n }\n ctx.addGenerator(mcpGenerator)\n ctx.addGenerator(serverGenerator)\n for (const gen of userGenerators) {\n ctx.addGenerator(gen)\n }\n\n const root = path.resolve(ctx.config.root, ctx.config.output.path)\n const hasClientPlugin = ctx.config.plugins?.some((p) => p.name === pluginClientName)\n\n if (client?.bundle && !hasClientPlugin && !clientImportPath) {\n ctx.injectFile({\n baseName: 'fetch.ts',\n path: path.resolve(root, '.kubb/fetch.ts'),\n sources: [\n ast.createSource({\n name: 'fetch',\n nodes: [ast.createText(clientName === 'fetch' ? fetchClientSource : axiosClientSource)],\n isExportable: true,\n isIndexable: true,\n }),\n ],\n })\n }\n\n if (!hasClientPlugin) {\n ctx.injectFile({\n baseName: 'config.ts',\n path: path.resolve(root, '.kubb/config.ts'),\n sources: [\n ast.createSource({\n name: 'config',\n nodes: [ast.createText(configSource)],\n isExportable: false,\n isIndexable: false,\n }),\n ],\n })\n }\n },\n },\n }\n})\n\nexport default pluginMcp\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAsBA,SAAS,gBAAgB,MAAc,QAAyB;CAS9D,OARmB,KAChB,MAAM,CACN,QAAQ,qBAAqB,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B,cAAc,QAAQ;KACvB;IACD;IACD,CAAC;GACF,IAAI,YAAY,SAAS;GACzB,IAAI,iBACF,IAAI,eAAe,gBAAgB;GAErC,IAAI,aAAa,aAAa;GAC9B,IAAI,aAAa,gBAAgB;GACjC,KAAK,MAAM,OAAO,gBAChB,IAAI,aAAa,IAAI;GAGvB,MAAM,OAAOC,YAAAA,QAAK,QAAQ,IAAI,OAAO,MAAM,IAAI,OAAO,OAAO,KAAK;GAClE,MAAM,kBAAkB,IAAI,OAAO,SAAS,MAAM,MAAM,EAAE,SAASC,oBAAAA,iBAAiB;GAEpF,IAAI,QAAQ,UAAU,CAAC,mBAAmB,CAAC,kBACzC,IAAI,WAAW;IACb,UAAU;IACV,MAAMD,YAAAA,QAAK,QAAQ,MAAM,iBAAiB;IAC1C,SAAS,CACPE,WAAAA,IAAI,aAAa;KACf,MAAM;KACN,OAAO,CAACA,WAAAA,IAAI,WAAW,eAAe,UAAUC,mDAAAA,SAAoBC,mDAAAA,OAAkB,CAAC;KACvF,cAAc;KACd,aAAa;KACd,CAAC,CACH;IACF,CAAC;GAGJ,IAAI,CAAC,iBACH,IAAI,WAAW;IACb,UAAU;IACV,MAAMJ,YAAAA,QAAK,QAAQ,MAAM,kBAAkB;IAC3C,SAAS,CACPE,WAAAA,IAAI,aAAa;KACf,MAAM;KACN,OAAO,CAACA,WAAAA,IAAI,WAAWG,4CAAAA,OAAa,CAAC;KACrC,cAAc;KACd,aAAa;KACd,CAAC,CACH;IACF,CAAC;KAGP;EACF;EACD"}
package/dist/index.js CHANGED
@@ -2,7 +2,7 @@ import "./chunk--u3MIqq1.js";
2
2
  import path from "node:path";
3
3
  import { ast, defineGenerator, definePlugin, defineResolver } from "@kubb/core";
4
4
  import { functionPrinter, pluginTsName } from "@kubb/plugin-ts";
5
- import { Const, File, Function, jsxRenderer } from "@kubb/renderer-jsx";
5
+ import { Const, File, Function, jsxRendererSync } from "@kubb/renderer-jsx";
6
6
  import { Fragment, jsx, jsxs } from "@kubb/renderer-jsx/jsx-runtime";
7
7
  import { pluginZodName } from "@kubb/plugin-zod";
8
8
  import { pluginClientName } from "@kubb/plugin-client";
@@ -352,7 +352,17 @@ function resolveErrorNames(node, resolver) {
352
352
  function resolveStatusCodeNames(node, resolver) {
353
353
  return node.responses.map((response) => resolver.resolveResponseStatusName(node, response.statusCode));
354
354
  }
355
+ const typeNamesByResolver = /* @__PURE__ */ new WeakMap();
355
356
  function resolveOperationTypeNames(node, resolver, options = {}) {
357
+ const cacheKey = `${node.operationId}\0${options.paramsCasing ?? ""}\0${options.order ?? ""}\0${options.responseStatusNames ?? ""}\0${(options.exclude ?? []).join(",")}`;
358
+ let byResolver = typeNamesByResolver.get(resolver);
359
+ if (byResolver) {
360
+ const cached = byResolver.get(cacheKey);
361
+ if (cached) return cached;
362
+ } else {
363
+ byResolver = /* @__PURE__ */ new Map();
364
+ typeNamesByResolver.set(resolver, byResolver);
365
+ }
356
366
  const { path, query, header } = getOperationParameters(node, { paramsCasing: options.paramsCasing });
357
367
  const responseStatusNames = options.responseStatusNames === "error" ? resolveErrorNames(node, resolver) : options.responseStatusNames === false ? [] : resolveStatusCodeNames(node, resolver);
358
368
  const exclude = new Set(options.exclude ?? []);
@@ -362,7 +372,7 @@ function resolveOperationTypeNames(node, resolver, options = {}) {
362
372
  ...header.map((param) => resolver.resolveHeaderParamsName(node, param))
363
373
  ];
364
374
  const bodyAndResponseNames = [node.requestBody?.content?.[0]?.schema ? resolver.resolveDataName(node) : void 0, resolver.resolveResponseName(node)];
365
- return (options.order === "body-response-first" ? [
375
+ const result = (options.order === "body-response-first" ? [
366
376
  ...bodyAndResponseNames,
367
377
  ...paramNames,
368
378
  ...responseStatusNames
@@ -371,6 +381,8 @@ function resolveOperationTypeNames(node, resolver, options = {}) {
371
381
  ...bodyAndResponseNames,
372
382
  ...responseStatusNames
373
383
  ]).filter((name) => Boolean(name) && !exclude.has(name));
384
+ byResolver.set(cacheKey, result);
385
+ return result;
374
386
  }
375
387
  function findSuccessStatusCode(responses) {
376
388
  for (const response of responses) if (isSuccessStatusCode(response.statusCode)) return response.statusCode;
@@ -627,7 +639,7 @@ server.registerTool(${JSON.stringify(tool.name)}, {
627
639
  //#region src/generators/mcpGenerator.tsx
628
640
  const mcpGenerator = defineGenerator({
629
641
  name: "mcp",
630
- renderer: jsxRenderer,
642
+ renderer: jsxRendererSync,
631
643
  operation(node, ctx) {
632
644
  const { resolver, driver, root } = ctx;
633
645
  const { output, client, paramsCasing, group } = ctx.options;
@@ -756,9 +768,9 @@ const mcpGenerator = defineGenerator({
756
768
  */
757
769
  const serverGenerator = defineGenerator({
758
770
  name: "operations",
759
- renderer: jsxRenderer,
771
+ renderer: jsxRendererSync,
760
772
  operations(nodes, ctx) {
761
- const { adapter, config, resolver, plugin, driver, root } = ctx;
773
+ const { config, resolver, plugin, driver, root, inputNode } = ctx;
762
774
  const { output, paramsCasing, group } = ctx.options;
763
775
  const pluginZod = driver.getPlugin(pluginZodName);
764
776
  if (!pluginZod) return;
@@ -847,11 +859,11 @@ const serverGenerator = defineGenerator({
847
859
  baseName: serverFile.baseName,
848
860
  path: serverFile.path,
849
861
  meta: serverFile.meta,
850
- banner: resolver.resolveBanner(adapter.inputNode, {
862
+ banner: resolver.resolveBanner(inputNode, {
851
863
  output,
852
864
  config
853
865
  }),
854
- footer: resolver.resolveFooter(adapter.inputNode, {
866
+ footer: resolver.resolveFooter(inputNode, {
855
867
  output,
856
868
  config
857
869
  }),
@@ -871,8 +883,8 @@ const serverGenerator = defineGenerator({
871
883
  imports,
872
884
  /* @__PURE__ */ jsx(Server, {
873
885
  name,
874
- serverName: adapter.inputNode?.meta?.title ?? "server",
875
- serverVersion: adapter.inputNode?.meta?.version ?? "0.0.0",
886
+ serverName: inputNode.meta?.title ?? "server",
887
+ serverVersion: inputNode.meta?.version ?? "0.0.0",
876
888
  paramsCasing,
877
889
  operations: operationsMapped
878
890
  })
@@ -886,7 +898,7 @@ const serverGenerator = defineGenerator({
886
898
  children: `
887
899
  {
888
900
  "mcpServers": {
889
- "${adapter.inputNode?.meta?.title || "server"}": {
901
+ "${inputNode.meta?.title || "server"}": {
890
902
  "type": "stdio",
891
903
  "command": "npx",
892
904
  "args": ["tsx", "${path.relative(path.dirname(jsonFile.path), serverFile.path)}"]
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["#options","#transformParam","#eachParam","fetchClientSource","axiosClientSource","configSource"],"sources":["../../../internals/utils/src/casing.ts","../../../internals/utils/src/reserved.ts","../../../internals/utils/src/urlPath.ts","../../../internals/shared/src/operation.ts","../../../internals/shared/src/params.ts","../src/components/McpHandler.tsx","../src/utils.ts","../src/components/Server.tsx","../src/generators/mcpGenerator.tsx","../src/generators/serverGenerator.tsx","../src/resolvers/resolverMcp.ts","../src/plugin.ts"],"sourcesContent":["type Options = {\n /**\n * When `true`, dot-separated segments are split on `.` and joined with `/` after casing.\n */\n isFile?: boolean\n /**\n * Text prepended before casing is applied.\n */\n prefix?: string\n /**\n * Text appended before casing is applied.\n */\n suffix?: string\n}\n\n/**\n * Shared implementation for camelCase and PascalCase conversion.\n * Splits on common word boundaries (spaces, hyphens, underscores, dots, slashes, colons)\n * and capitalizes each word according to `pascal`.\n *\n * When `pascal` is `true` the first word is also capitalized (PascalCase), otherwise only subsequent words are.\n */\nfunction toCamelOrPascal(text: string, pascal: boolean): string {\n const normalized = text\n .trim()\n .replace(/([a-z\\d])([A-Z])/g, '$1 $2')\n .replace(/([A-Z]+)([A-Z][a-z])/g, '$1 $2')\n .replace(/(\\d)([a-z])/g, '$1 $2')\n\n const words = normalized.split(/[\\s\\-_./\\\\:]+/).filter(Boolean)\n\n return words\n .map((word, i) => {\n const allUpper = word.length > 1 && word === word.toUpperCase()\n if (allUpper) return word\n if (i === 0 && !pascal) return word.charAt(0).toLowerCase() + word.slice(1)\n return word.charAt(0).toUpperCase() + word.slice(1)\n })\n .join('')\n .replace(/[^a-zA-Z0-9]/g, '')\n}\n\n/**\n * Splits `text` on `.` and applies `transformPart` to each segment.\n * The last segment receives `isLast = true`, all earlier segments receive `false`.\n * Segments are joined with `/` to form a file path.\n *\n * Only splits on dots followed by a letter so that version numbers\n * embedded in operationIds (e.g. `v2025.0`) are kept intact.\n */\nfunction applyToFileParts(text: string, transformPart: (part: string, isLast: boolean) => string): string {\n const parts = text.split(/\\.(?=[a-zA-Z])/)\n return parts.map((part, i) => transformPart(part, i === parts.length - 1)).join('/')\n}\n\n/**\n * Converts `text` to camelCase.\n * When `isFile` is `true`, dot-separated segments are each cased independently and joined with `/`.\n *\n * @example\n * camelCase('hello-world') // 'helloWorld'\n * camelCase('pet.petId', { isFile: true }) // 'pet/petId'\n */\nexport function camelCase(text: string, { isFile, prefix = '', suffix = '' }: Options = {}): string {\n if (isFile) {\n return applyToFileParts(text, (part, isLast) => camelCase(part, isLast ? { prefix, suffix } : {}))\n }\n\n return toCamelOrPascal(`${prefix} ${text} ${suffix}`, false)\n}\n\n/**\n * Converts `text` to PascalCase.\n * When `isFile` is `true`, the last dot-separated segment is PascalCased and earlier segments are camelCased.\n *\n * @example\n * pascalCase('hello-world') // 'HelloWorld'\n * pascalCase('pet.petId', { isFile: true }) // 'pet/PetId'\n */\nexport function pascalCase(text: string, { isFile, prefix = '', suffix = '' }: Options = {}): string {\n if (isFile) {\n return applyToFileParts(text, (part, isLast) => (isLast ? pascalCase(part, { prefix, suffix }) : camelCase(part)))\n }\n\n return toCamelOrPascal(`${prefix} ${text} ${suffix}`, true)\n}\n\n/**\n * Converts `text` to snake_case.\n *\n * @example\n * snakeCase('helloWorld') // 'hello_world'\n * snakeCase('Hello-World') // 'hello_world'\n */\nexport function snakeCase(text: string, { prefix = '', suffix = '' }: Omit<Options, 'isFile'> = {}): string {\n const processed = `${prefix} ${text} ${suffix}`.trim()\n return processed\n .replace(/([a-z])([A-Z])/g, '$1_$2')\n .replace(/[\\s\\-.]+/g, '_')\n .replace(/[^a-zA-Z0-9_]/g, '')\n .toLowerCase()\n .split('_')\n .filter(Boolean)\n .join('_')\n}\n\n/**\n * Converts `text` to SCREAMING_SNAKE_CASE.\n *\n * @example\n * screamingSnakeCase('helloWorld') // 'HELLO_WORLD'\n */\nexport function screamingSnakeCase(text: string, { prefix = '', suffix = '' }: Omit<Options, 'isFile'> = {}): string {\n return snakeCase(text, { prefix, suffix }).toUpperCase()\n}\n","/**\n * JavaScript and Java reserved words.\n * @link https://github.com/jonschlinkert/reserved/blob/master/index.js\n */\nconst reservedWords = new Set([\n 'abstract',\n 'arguments',\n 'boolean',\n 'break',\n 'byte',\n 'case',\n 'catch',\n 'char',\n 'class',\n 'const',\n 'continue',\n 'debugger',\n 'default',\n 'delete',\n 'do',\n 'double',\n 'else',\n 'enum',\n 'eval',\n 'export',\n 'extends',\n 'false',\n 'final',\n 'finally',\n 'float',\n 'for',\n 'function',\n 'goto',\n 'if',\n 'implements',\n 'import',\n 'in',\n 'instanceof',\n 'int',\n 'interface',\n 'let',\n 'long',\n 'native',\n 'new',\n 'null',\n 'package',\n 'private',\n 'protected',\n 'public',\n 'return',\n 'short',\n 'static',\n 'super',\n 'switch',\n 'synchronized',\n 'this',\n 'throw',\n 'throws',\n 'transient',\n 'true',\n 'try',\n 'typeof',\n 'var',\n 'void',\n 'volatile',\n 'while',\n 'with',\n 'yield',\n 'Array',\n 'Date',\n 'hasOwnProperty',\n 'Infinity',\n 'isFinite',\n 'isNaN',\n 'isPrototypeOf',\n 'length',\n 'Math',\n 'name',\n 'NaN',\n 'Number',\n 'Object',\n 'prototype',\n 'String',\n 'toString',\n 'undefined',\n 'valueOf',\n] as const)\n\n/**\n * Returns `true` when `name` is a syntactically valid JavaScript variable name.\n *\n * @example\n * ```ts\n * isValidVarName('status') // true\n * isValidVarName('class') // false (reserved word)\n * isValidVarName('42foo') // false (starts with digit)\n * ```\n */\nexport function isValidVarName(name: string): boolean {\n if (!name || reservedWords.has(name as 'valueOf')) {\n return false\n }\n return /^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(name)\n}\n","import { camelCase } from './casing.ts'\nimport { isValidVarName } from './reserved.ts'\n\nexport type URLObject = {\n /**\n * The resolved URL string (Express-style or template literal, depending on context).\n */\n url: string\n /**\n * Extracted path parameters as a key-value map, or `undefined` when the path has none.\n */\n params?: Record<string, string>\n}\n\ntype ObjectOptions = {\n /**\n * Controls whether the `url` is rendered as an Express path or a template literal.\n * @default 'path'\n */\n type?: 'path' | 'template'\n /**\n * Optional transform applied to each extracted parameter name.\n */\n replacer?: (pathParam: string) => string\n /**\n * When `true`, the result is serialized to a string expression instead of a plain object.\n */\n stringify?: boolean\n}\n\n/**\n * Supported identifier casing strategies for path parameters.\n */\ntype PathCasing = 'camelcase'\n\ntype Options = {\n /**\n * Casing strategy applied to path parameter names.\n * @default undefined (original identifier preserved)\n */\n casing?: PathCasing\n}\n\n/**\n * Parses and transforms an OpenAPI/Swagger path string into various URL formats.\n *\n * @example\n * const p = new URLPath('/pet/{petId}')\n * p.URL // '/pet/:petId'\n * p.template // '`/pet/${petId}`'\n */\nexport class URLPath {\n /**\n * The raw OpenAPI/Swagger path string, e.g. `/pet/{petId}`.\n */\n path: string\n\n #options: Options\n\n constructor(path: string, options: Options = {}) {\n this.path = path\n this.#options = options\n }\n\n /** Converts the OpenAPI path to Express-style colon syntax, e.g. `/pet/{petId}` → `/pet/:petId`.\n *\n * @example\n * ```ts\n * new URLPath('/pet/{petId}').URL // '/pet/:petId'\n * ```\n */\n get URL(): string {\n return this.toURLPath()\n }\n\n /** Returns `true` when `path` is a fully-qualified URL (e.g. starts with `https://`).\n *\n * @example\n * ```ts\n * new URLPath('https://petstore.swagger.io/v2/pet').isURL // true\n * new URLPath('/pet/{petId}').isURL // false\n * ```\n */\n get isURL(): boolean {\n try {\n return !!new URL(this.path).href\n } catch {\n return false\n }\n }\n\n /**\n * Converts the OpenAPI path to a TypeScript template literal string.\n *\n * @example\n * new URLPath('/pet/{petId}').template // '`/pet/${petId}`'\n * new URLPath('/account/monetary-accountID').template // '`/account/${monetaryAccountId}`'\n */\n get template(): string {\n return this.toTemplateString()\n }\n\n /** Returns the path and its extracted params as a structured `URLObject`, or as a stringified expression when `stringify` is set.\n *\n * @example\n * ```ts\n * new URLPath('/pet/{petId}').object\n * // { url: '/pet/:petId', params: { petId: 'petId' } }\n * ```\n */\n get object(): URLObject | string {\n return this.toObject()\n }\n\n /** Returns a map of path parameter names, or `undefined` when the path has no parameters.\n *\n * @example\n * ```ts\n * new URLPath('/pet/{petId}').params // { petId: 'petId' }\n * new URLPath('/pet').params // undefined\n * ```\n */\n get params(): Record<string, string> | undefined {\n return this.toParamsObject()\n }\n\n #transformParam(raw: string): string {\n const param = isValidVarName(raw) ? raw : camelCase(raw)\n return this.#options.casing === 'camelcase' ? camelCase(param) : param\n }\n\n /**\n * Iterates over every `{param}` token in `path`, calling `fn` with the raw token and transformed name.\n */\n #eachParam(fn: (raw: string, param: string) => void): void {\n for (const match of this.path.matchAll(/\\{([^}]+)\\}/g)) {\n const raw = match[1]!\n fn(raw, this.#transformParam(raw))\n }\n }\n\n toObject({ type = 'path', replacer, stringify }: ObjectOptions = {}): URLObject | string {\n const object = {\n url: type === 'path' ? this.toURLPath() : this.toTemplateString({ replacer }),\n params: this.toParamsObject(),\n }\n\n if (stringify) {\n if (type === 'template') {\n return JSON.stringify(object).replaceAll(\"'\", '').replaceAll(`\"`, '')\n }\n\n if (object.params) {\n return `{ url: '${object.url}', params: ${JSON.stringify(object.params).replaceAll(\"'\", '').replaceAll(`\"`, '')} }`\n }\n\n return `{ url: '${object.url}' }`\n }\n\n return object\n }\n\n /**\n * Converts the OpenAPI path to a TypeScript template literal string.\n * An optional `replacer` can transform each extracted parameter name before interpolation.\n *\n * @example\n * new URLPath('/pet/{petId}').toTemplateString() // '`/pet/${petId}`'\n */\n toTemplateString({ prefix = '', replacer }: { prefix?: string; replacer?: (pathParam: string) => string } = {}): string {\n const parts = this.path.split(/\\{([^}]+)\\}/)\n const result = parts\n .map((part, i) => {\n if (i % 2 === 0) return part\n const param = this.#transformParam(part)\n return `\\${${replacer ? replacer(param) : param}}`\n })\n .join('')\n\n return `\\`${prefix}${result}\\``\n }\n\n /**\n * Extracts all `{param}` segments from the path and returns them as a key-value map.\n * An optional `replacer` transforms each parameter name in both key and value positions.\n * Returns `undefined` when no path parameters are found.\n *\n * @example\n * ```ts\n * new URLPath('/pet/{petId}/tag/{tagId}').toParamsObject()\n * // { petId: 'petId', tagId: 'tagId' }\n * ```\n */\n toParamsObject(replacer?: (pathParam: string) => string): Record<string, string> | undefined {\n const params: Record<string, string> = {}\n\n this.#eachParam((_raw, param) => {\n const key = replacer ? replacer(param) : param\n params[key] = key\n })\n\n return Object.keys(params).length > 0 ? params : undefined\n }\n\n /** Converts the OpenAPI path to Express-style colon syntax.\n *\n * @example\n * ```ts\n * new URLPath('/pet/{petId}').toURLPath() // '/pet/:petId'\n * ```\n */\n toURLPath(): string {\n return this.path.replace(/\\{([^}]+)\\}/g, ':$1')\n }\n}\n","import { URLPath } from '@internals/utils'\nimport { ast } from '@kubb/core'\n\nexport type ContentTypeInfo = {\n contentTypes: string[]\n isMultipleContentTypes: boolean\n contentTypeUnion: string\n defaultContentType: string\n hasFormData: boolean\n}\n\nexport type RequestConfigResolver = {\n resolveDataName(node: ast.OperationNode): string\n}\n\nexport type ResponseStatusNameResolver = {\n resolveResponseStatusName(node: ast.OperationNode, statusCode: ast.StatusCode): string\n}\n\nexport type ResponseNameResolver = ResponseStatusNameResolver & {\n resolveResponseName(node: ast.OperationNode): string\n}\n\nexport type OperationTypeNameResolver = RequestConfigResolver &\n ResponseNameResolver & {\n resolvePathParamsName(node: ast.OperationNode, param: ast.ParameterNode): string\n resolveQueryParamsName(node: ast.OperationNode, param: ast.ParameterNode): string\n resolveHeaderParamsName(node: ast.OperationNode, param: ast.ParameterNode): string\n }\n\nexport type OperationCommentLink = 'pathTemplate' | 'urlPath' | false | ((node: ast.OperationNode) => string | undefined)\n\nexport type BuildOperationCommentsOptions = {\n link?: OperationCommentLink\n linkPosition?: 'beforeDeprecated' | 'afterDeprecated'\n splitLines?: boolean\n}\n\ntype ResponseLike = {\n statusCode: ast.StatusCode | number | string\n}\n\nexport type OperationParameterGroups = Record<ast.ParameterNode['in'], Array<ast.ParameterNode>>\n\nexport type ResolveOperationTypeNameOptions = {\n paramsCasing?: 'camelcase'\n responseStatusNames?: boolean | 'error'\n exclude?: ReadonlyArray<string | undefined>\n order?: 'params-first' | 'body-response-first'\n}\n\nfunction getOperationLink(node: ast.OperationNode, link: OperationCommentLink): string | undefined {\n if (!link) {\n return undefined\n }\n\n if (typeof link === 'function') {\n return link(node)\n }\n\n if (link === 'urlPath') {\n return node.path ? `{@link ${new URLPath(node.path).URL}}` : undefined\n }\n\n return `{@link ${node.path.replaceAll('{', ':').replaceAll('}', '')}}`\n}\n\nexport function getContentTypeInfo(node: ast.OperationNode): ContentTypeInfo {\n const contentTypes = node.requestBody?.content?.map((e) => e.contentType) ?? []\n const isMultipleContentTypes = contentTypes.length > 1\n\n return {\n contentTypes,\n isMultipleContentTypes,\n contentTypeUnion: isMultipleContentTypes ? contentTypes.map((ct) => JSON.stringify(ct)).join(' | ') : '',\n defaultContentType: contentTypes[0] ?? 'application/json',\n hasFormData: contentTypes.some((ct) => ct === 'multipart/form-data'),\n }\n}\n\nexport function buildRequestConfigType(node: ast.OperationNode, resolver: RequestConfigResolver): string {\n const requestName = node.requestBody?.content?.[0]?.schema ? resolver.resolveDataName(node) : undefined\n const { isMultipleContentTypes, contentTypeUnion } = getContentTypeInfo(node)\n const configType = requestName ? `Partial<RequestConfig<${requestName}>>` : 'Partial<RequestConfig>'\n const configProps = ['client?: Client', isMultipleContentTypes ? `contentType?: ${contentTypeUnion}` : undefined].filter(Boolean).join('; ')\n\n return `${configType} & { ${configProps} }`\n}\n\nexport function buildOperationComments(node: ast.OperationNode, options: BuildOperationCommentsOptions = {}): Array<string> {\n const { link = 'pathTemplate', linkPosition = 'afterDeprecated', splitLines = false } = options\n const linkComment = getOperationLink(node, link)\n const comments =\n linkPosition === 'beforeDeprecated'\n ? [node.description && `@description ${node.description}`, node.summary && `@summary ${node.summary}`, linkComment, node.deprecated && '@deprecated']\n : [node.description && `@description ${node.description}`, node.summary && `@summary ${node.summary}`, node.deprecated && '@deprecated', linkComment]\n\n const filteredComments = comments.filter((comment): comment is string => Boolean(comment))\n\n if (!splitLines) {\n return filteredComments\n }\n\n return filteredComments.flatMap((text) => text.split(/\\r?\\n/).map((line) => line.trim())).filter((comment): comment is string => Boolean(comment))\n}\n\nexport function getOperationParameters(node: ast.OperationNode, options: { paramsCasing?: 'camelcase' } = {}): OperationParameterGroups {\n const params = ast.caseParams(node.parameters, options.paramsCasing)\n\n return {\n path: params.filter((param) => param.in === 'path'),\n query: params.filter((param) => param.in === 'query'),\n header: params.filter((param) => param.in === 'header'),\n cookie: params.filter((param) => param.in === 'cookie'),\n }\n}\n\nexport function getStatusCodeNumber(statusCode: ast.StatusCode | number | string): number | undefined {\n const code = Number(statusCode)\n\n return Number.isNaN(code) ? undefined : code\n}\n\nexport function isSuccessStatusCode(statusCode: ast.StatusCode | number | string): boolean {\n const code = getStatusCodeNumber(statusCode)\n\n return code !== undefined && code >= 200 && code < 300\n}\n\nexport function isErrorStatusCode(statusCode: ast.StatusCode | number | string): boolean {\n const code = getStatusCodeNumber(statusCode)\n\n return code !== undefined && code >= 400\n}\n\nexport function getSuccessResponses<TResponse extends ResponseLike>(responses: ReadonlyArray<TResponse>): Array<TResponse> {\n return responses.filter((response) => isSuccessStatusCode(response.statusCode))\n}\n\nexport function getOperationSuccessResponses(node: ast.OperationNode): Array<ast.ResponseNode> {\n return getSuccessResponses(node.responses)\n}\n\nexport function getPrimarySuccessResponse(node: ast.OperationNode): ast.ResponseNode | undefined {\n return getOperationSuccessResponses(node)[0]\n}\n\nexport function resolveErrorNames(node: ast.OperationNode, resolver: ResponseStatusNameResolver): string[] {\n return node.responses\n .filter((response) => isErrorStatusCode(response.statusCode))\n .map((response) => resolver.resolveResponseStatusName(node, response.statusCode))\n}\n\nexport function resolveStatusCodeNames(node: ast.OperationNode, resolver: ResponseStatusNameResolver): string[] {\n return node.responses.map((response) => resolver.resolveResponseStatusName(node, response.statusCode))\n}\n\nexport function resolveOperationTypeNames(\n node: ast.OperationNode,\n resolver: OperationTypeNameResolver,\n options: ResolveOperationTypeNameOptions = {},\n): string[] {\n const { path, query, header } = getOperationParameters(node, { paramsCasing: options.paramsCasing })\n const responseStatusNames =\n options.responseStatusNames === 'error'\n ? resolveErrorNames(node, resolver)\n : options.responseStatusNames === false\n ? []\n : resolveStatusCodeNames(node, resolver)\n const exclude = new Set(options.exclude ?? [])\n const paramNames = [\n ...path.map((param) => resolver.resolvePathParamsName(node, param)),\n ...query.map((param) => resolver.resolveQueryParamsName(node, param)),\n ...header.map((param) => resolver.resolveHeaderParamsName(node, param)),\n ]\n const bodyAndResponseNames = [node.requestBody?.content?.[0]?.schema ? resolver.resolveDataName(node) : undefined, resolver.resolveResponseName(node)]\n const names =\n options.order === 'body-response-first'\n ? [...bodyAndResponseNames, ...paramNames, ...responseStatusNames]\n : [...paramNames, ...bodyAndResponseNames, ...responseStatusNames]\n\n return names.filter((name): name is string => Boolean(name) && !exclude.has(name))\n}\n\nexport function resolveResponseTypes(node: ast.OperationNode, resolver: ResponseNameResolver): Array<[statusCode: number | 'default', typeName: string]> {\n const types: Array<[number | 'default', string]> = []\n\n for (const response of node.responses) {\n if (response.statusCode === 'default') {\n types.push(['default', resolver.resolveResponseName(node)])\n continue\n }\n\n const code = getStatusCodeNumber(response.statusCode)\n if (code === undefined) {\n continue\n }\n\n types.push([code, isSuccessStatusCode(code) ? resolver.resolveResponseName(node) : resolver.resolveResponseStatusName(node, response.statusCode)])\n }\n\n return types\n}\n\nexport function findSuccessStatusCode(responses: Array<{ statusCode: ast.StatusCode | number | string }>): ast.StatusCode | undefined {\n for (const response of responses) {\n if (isSuccessStatusCode(response.statusCode)) {\n return response.statusCode as ast.StatusCode\n }\n }\n\n return undefined\n}\n","export function buildParamsMapping<TParam extends { name: string }>(\n originalParams: ReadonlyArray<TParam>,\n mappedParams: ReadonlyArray<TParam>,\n): Record<string, string> | undefined {\n const mapping: Record<string, string> = {}\n let hasChanged = false\n\n originalParams.forEach((param, i) => {\n const mappedName = mappedParams[i]?.name ?? param.name\n mapping[param.name] = mappedName\n\n if (param.name !== mappedName) {\n hasChanged = true\n }\n })\n\n return hasChanged ? mapping : undefined\n}\n\nexport function buildTransformedParamsMapping<TParam extends { name: string }>(\n params: ReadonlyArray<TParam>,\n transformName: (name: string) => string,\n): Record<string, string> | undefined {\n if (!params.length) {\n return undefined\n }\n\n return buildParamsMapping(\n params,\n params.map((param) => ({ ...param, name: transformName(param.name) })),\n )\n}\n","import { buildOperationComments, buildTransformedParamsMapping, getOperationParameters } from '@internals/shared'\nimport { camelCase, isValidVarName, URLPath } from '@internals/utils'\nimport { ast } from '@kubb/core'\nimport type { ResolverTs } from '@kubb/plugin-ts'\nimport { functionPrinter } from '@kubb/plugin-ts'\nimport { File, Function } from '@kubb/renderer-jsx'\nimport type { KubbReactNode } from '@kubb/renderer-jsx/types'\nimport type { PluginMcp } from '../types.ts'\n\ntype Props = {\n /**\n * Name of the handler function.\n */\n name: string\n /**\n * AST operation node.\n */\n node: ast.OperationNode\n /**\n * TypeScript resolver for resolving param/data/response type names.\n */\n resolver: ResolverTs\n /**\n * Base URL prepended to every generated request URL.\n */\n baseURL: string | undefined\n /**\n * Return type when calling fetch.\n * - 'data' returns response data only.\n * - 'full' returns the full response object.\n * @default 'data'\n */\n dataReturnType: PluginMcp['resolvedOptions']['client']['dataReturnType']\n /**\n * How to style your params.\n */\n paramsCasing?: PluginMcp['resolvedOptions']['paramsCasing']\n}\n\n/**\n * Generate a remapping statement: `const mappedX = x ? { \"orig\": x.camel, ... } : undefined`\n */\nfunction buildRemappingCode(mapping: Record<string, string>, varName: string, sourceName: string): string {\n const pairs = Object.entries(mapping)\n .map(([orig, camel]) => `\"${orig}\": ${sourceName}.${camel}`)\n .join(', ')\n return `const ${varName} = ${sourceName} ? { ${pairs} } : undefined`\n}\n\nconst declarationPrinter = functionPrinter({ mode: 'declaration' })\n\nexport function McpHandler({ name, node, resolver, baseURL, dataReturnType, paramsCasing }: Props): KubbReactNode {\n const urlPath = new URLPath(node.path)\n const contentType = node.requestBody?.content?.[0]?.contentType\n const isFormData = contentType === 'multipart/form-data'\n\n const { query: queryParams, header: headerParams } = getOperationParameters(node, { paramsCasing })\n const { path: originalPathParams, query: originalQueryParams, header: originalHeaderParams } = getOperationParameters(node)\n\n const requestName = node.requestBody?.content?.[0]?.schema ? resolver.resolveDataName(node) : undefined\n const responseName = resolver.resolveResponseName(node)\n\n const errorResponses = node.responses.filter((r) => Number(r.statusCode) >= 400).map((r) => resolver.resolveResponseStatusName(node, r.statusCode))\n const errorType = errorResponses.length > 0 ? errorResponses.join(' | ') : 'Error'\n\n const TError = `ResponseErrorConfig<${errorType}>`\n const generics = [responseName, TError, requestName || 'unknown'].filter(Boolean)\n\n const paramsNode = ast.createOperationParams(node, {\n paramsType: 'object',\n pathParamsType: 'inline',\n resolver,\n paramsCasing,\n })\n const baseParamsSignature = declarationPrinter.print(paramsNode) ?? ''\n const paramsSignature = baseParamsSignature\n ? `${baseParamsSignature}, request: RequestHandlerExtra<ServerRequest, ServerNotification>`\n : 'request: RequestHandlerExtra<ServerRequest, ServerNotification>'\n\n const pathParamsMapping = paramsCasing ? buildTransformedParamsMapping(originalPathParams, camelCase) : undefined\n const queryParamsMapping = paramsCasing ? buildTransformedParamsMapping(originalQueryParams, camelCase) : undefined\n const headerParamsMapping = paramsCasing ? buildTransformedParamsMapping(originalHeaderParams, camelCase) : undefined\n\n const contentTypeHeader =\n contentType && contentType !== 'application/json' && contentType !== 'multipart/form-data' ? `'Content-Type': '${contentType}'` : undefined\n const headers = [headerParams.length ? (headerParamsMapping ? '...mappedHeaders' : '...headers') : undefined, contentTypeHeader].filter(Boolean)\n\n const fetchConfig: string[] = []\n fetchConfig.push(`method: ${JSON.stringify(node.method.toUpperCase())}`)\n fetchConfig.push(`url: ${urlPath.template}`)\n if (baseURL) fetchConfig.push(`baseURL: \\`${baseURL}\\``)\n if (queryParams.length) fetchConfig.push(queryParamsMapping ? 'params: mappedParams' : 'params')\n if (requestName) fetchConfig.push(`data: ${isFormData ? 'formData as FormData' : 'requestData'}`)\n if (headers.length) fetchConfig.push(`headers: { ${headers.join(', ')} }`)\n\n const callToolResult =\n dataReturnType === 'data'\n ? `return {\n content: [\n {\n type: 'text',\n text: JSON.stringify(res.data)\n }\n ],\n structuredContent: { data: res.data }\n }`\n : `return {\n content: [\n {\n type: 'text',\n text: JSON.stringify(res)\n }\n ],\n structuredContent: { data: res.data }\n }`\n\n return (\n <File.Source name={name} isExportable isIndexable>\n <Function\n name={name}\n async\n export\n params={paramsSignature}\n JSDoc={{\n comments: buildOperationComments(node),\n }}\n returnType={'Promise<CallToolResult>'}\n >\n {''}\n <br />\n <br />\n {pathParamsMapping &&\n Object.entries(pathParamsMapping)\n .filter(([originalName, camelCaseName]) => originalName !== camelCaseName && isValidVarName(originalName))\n .map(([originalName, camelCaseName]) => `const ${originalName} = ${camelCaseName}`)\n .join('\\n')}\n {pathParamsMapping && (\n <>\n <br />\n <br />\n </>\n )}\n {queryParamsMapping && queryParams.length > 0 && (\n <>\n {buildRemappingCode(queryParamsMapping, 'mappedParams', 'params')}\n <br />\n <br />\n </>\n )}\n {headerParamsMapping && headerParams.length > 0 && (\n <>\n {buildRemappingCode(headerParamsMapping, 'mappedHeaders', 'headers')}\n <br />\n <br />\n </>\n )}\n {requestName && 'const requestData = data'}\n <br />\n {isFormData && requestName && 'const formData = buildFormData(requestData)'}\n <br />\n {`const res = await fetch<${generics.join(', ')}>({ ${fetchConfig.join(', ')} }, request)`}\n <br />\n {callToolResult}\n </Function>\n </File.Source>\n )\n}\n","import type { ast } from '@kubb/core'\n\nexport type ZodParam = {\n name: string\n schemaName: string\n}\n\n/**\n * Render a group param value — compose individual schemas into `z.object({ ... })`,\n * or use a schema name string directly.\n */\nexport function zodGroupExpr(entry: string | Array<ZodParam>): string {\n if (typeof entry === 'string') {\n return entry\n }\n const entries = entry.map((p) => `${JSON.stringify(p.name)}: ${p.schemaName}`)\n return `z.object({ ${entries.join(', ')} })`\n}\n\n/**\n * Convert a SchemaNode type to an inline Zod expression string.\n * Used as fallback when no named zod schema is available for a path parameter.\n */\nexport function zodExprFromSchemaNode(schema: ast.SchemaNode): string {\n let expr: string\n switch (schema.type) {\n case 'enum': {\n // namedEnumValues takes priority over enumValues\n const rawValues: Array<string | number | boolean> = schema.namedEnumValues?.length\n ? schema.namedEnumValues.map((v) => v.value)\n : (schema.enumValues ?? []).filter((v): v is string | number | boolean => v !== null)\n\n if (rawValues.length > 0 && rawValues.every((v) => typeof v === 'string')) {\n expr = `z.enum([${rawValues.map((v) => JSON.stringify(v)).join(', ')}])`\n } else if (rawValues.length > 0) {\n const literals = rawValues.map((v) => `z.literal(${JSON.stringify(v)})`)\n expr = literals.length === 1 ? literals[0]! : `z.union([${literals.join(', ')}])`\n } else {\n expr = 'z.string()'\n }\n break\n }\n case 'integer':\n expr = 'z.coerce.number()'\n break\n case 'number':\n expr = 'z.number()'\n break\n case 'boolean':\n expr = 'z.boolean()'\n break\n case 'array':\n expr = 'z.array(z.unknown())'\n break\n default:\n expr = 'z.string()'\n }\n\n if (schema.nullable) {\n expr = `${expr}.nullable()`\n }\n\n return expr\n}\n","import { getOperationParameters } from '@internals/shared'\nimport { ast } from '@kubb/core'\nimport { functionPrinter } from '@kubb/plugin-ts'\nimport { Const, File, Function } from '@kubb/renderer-jsx'\nimport type { KubbReactNode } from '@kubb/renderer-jsx/types'\nimport type { PluginMcp } from '../types.ts'\nimport type { ZodParam } from '../utils.ts'\nimport { zodExprFromSchemaNode, zodGroupExpr } from '../utils.ts'\n\ntype Props = {\n /**\n * Variable name for the MCP server instance (e.g. 'server').\n */\n name: string\n /**\n * Human-readable server name passed to `new McpServer({ name })`.\n */\n serverName: string\n /**\n * Semantic version string passed to `new McpServer({ version })`.\n */\n serverVersion: string\n /**\n * How to style your params.\n */\n paramsCasing?: PluginMcp['resolvedOptions']['paramsCasing']\n /**\n * Operations to register as MCP tools, each carrying its handler,\n * zod schema, and AST node metadata.\n */\n operations: Array<{\n tool: {\n name: string\n title?: string\n description: string\n }\n mcp: {\n name: string\n file: ast.FileNode\n }\n zod: {\n pathParams: Array<ZodParam>\n /**\n * Query params — individual schemas to compose into `z.object({ ... })`.\n */\n queryParams?: string | Array<ZodParam>\n /**\n * Header params — individual schemas to compose into `z.object({ ... })`.\n */\n headerParams?: string | Array<ZodParam>\n requestName?: string\n responseName?: string\n }\n node: ast.OperationNode\n }>\n}\n\nconst keysPrinter = functionPrinter({ mode: 'keys' })\n\nexport function Server({ name, serverName, serverVersion, paramsCasing, operations }: Props): KubbReactNode {\n return (\n <File.Source name={name} isExportable isIndexable>\n <Const name={'server'} export>\n {`\n new McpServer({\n name: '${serverName}',\n version: '${serverVersion}',\n})\n `}\n </Const>\n\n {operations\n .map(({ tool, mcp, zod, node }) => {\n const { path: pathParams } = getOperationParameters(node, { paramsCasing })\n\n const pathEntries: Array<{ key: string; value: string }> = []\n const otherEntries: Array<{ key: string; value: string }> = []\n\n for (const p of pathParams) {\n const zodParam = zod.pathParams.find((zp) => zp.name === p.name)\n pathEntries.push({ key: p.name, value: zodParam ? zodParam.schemaName : zodExprFromSchemaNode(p.schema) })\n }\n\n if (zod.requestName) {\n otherEntries.push({ key: 'data', value: zod.requestName })\n }\n\n if (zod.queryParams) {\n otherEntries.push({ key: 'params', value: zodGroupExpr(zod.queryParams) })\n }\n\n if (zod.headerParams) {\n otherEntries.push({ key: 'headers', value: zodGroupExpr(zod.headerParams) })\n }\n\n otherEntries.sort((a, b) => a.key.localeCompare(b.key))\n const entries = [...pathEntries, ...otherEntries]\n\n const paramsNode = entries.length\n ? ast.createFunctionParameters({\n params: [\n ast.createParameterGroup({\n properties: entries.map((e) => ast.createFunctionParameter({ name: e.key, optional: false })),\n }),\n ],\n })\n : undefined\n\n const destructured = paramsNode ? (keysPrinter.print(paramsNode) ?? '') : ''\n const inputSchema = entries.length ? `{ ${entries.map((e) => `${e.key}: ${e.value}`).join(', ')} }` : undefined\n const outputSchema = zod.responseName\n\n const config = [\n tool.title ? `title: ${JSON.stringify(tool.title)}` : null,\n `description: ${JSON.stringify(tool.description)}`,\n outputSchema ? `outputSchema: { data: ${outputSchema} }` : null,\n ]\n .filter(Boolean)\n .join(',\\n ')\n\n if (inputSchema) {\n return `\nserver.registerTool(${JSON.stringify(tool.name)}, {\n ${config},\n inputSchema: ${inputSchema},\n}, async (${destructured}, request) => {\n return ${mcp.name}(${destructured}, request)\n})\n `\n }\n\n return `\nserver.registerTool(${JSON.stringify(tool.name)}, {\n ${config},\n}, async (request) => {\n return ${mcp.name}(request)\n})\n `\n })\n .filter(Boolean)}\n\n <Function name=\"startServer\" async export>\n {`try {\n const transport = new StdioServerTransport()\n await server.connect(transport)\n\n } catch (error) {\n console.error('Failed to start server:', error)\n process.exit(1)\n }`}\n </Function>\n </File.Source>\n )\n}\n","import path from 'node:path'\nimport { resolveOperationTypeNames } from '@internals/shared'\nimport { defineGenerator } from '@kubb/core'\nimport { pluginTsName } from '@kubb/plugin-ts'\nimport { File, jsxRenderer } from '@kubb/renderer-jsx'\nimport { McpHandler } from '../components/McpHandler.tsx'\nimport type { PluginMcp } from '../types.ts'\n\nexport const mcpGenerator = defineGenerator<PluginMcp>({\n name: 'mcp',\n renderer: jsxRenderer,\n operation(node, ctx) {\n const { resolver, driver, root } = ctx\n const { output, client, paramsCasing, group } = ctx.options\n\n const pluginTs = driver.getPlugin(pluginTsName)\n\n if (!pluginTs) {\n return null\n }\n\n const tsResolver = driver.getResolver(pluginTsName)\n\n const importedTypeNames = resolveOperationTypeNames(node, tsResolver, { paramsCasing, responseStatusNames: 'error' })\n\n const meta = {\n name: resolver.resolveHandlerName(node),\n file: resolver.resolveFile({ name: node.operationId, extname: '.ts', tag: node.tags[0] ?? 'default', path: node.path }, { root, output, group }),\n fileTs: tsResolver.resolveFile(\n { name: node.operationId, extname: '.ts', tag: node.tags[0] ?? 'default', path: node.path },\n {\n root,\n output: pluginTs.options?.output ?? output,\n group: pluginTs.options?.group,\n },\n ),\n } as const\n\n return (\n <File baseName={meta.file.baseName} path={meta.file.path} meta={meta.file.meta}>\n {meta.fileTs && importedTypeNames.length > 0 && (\n <File.Import name={Array.from(new Set(importedTypeNames)).sort()} root={meta.file.path} path={meta.fileTs.path} isTypeOnly />\n )}\n <File.Import name={['CallToolResult', 'ServerNotification', 'ServerRequest']} path={'@modelcontextprotocol/sdk/types'} isTypeOnly />\n <File.Import name={['RequestHandlerExtra']} path={'@modelcontextprotocol/sdk/shared/protocol'} isTypeOnly />\n <File.Import name={['buildFormData']} root={meta.file.path} path={path.resolve(root, '.kubb/config.ts')} />\n {client.importPath ? (\n <>\n <File.Import name={['Client', 'RequestConfig', 'ResponseErrorConfig']} path={client.importPath} isTypeOnly />\n <File.Import name={'fetch'} path={client.importPath} />\n {client.dataReturnType === 'full' && <File.Import name={['ResponseConfig']} path={client.importPath} isTypeOnly />}\n </>\n ) : (\n <>\n <File.Import\n name={['Client', 'RequestConfig', 'ResponseErrorConfig']}\n root={meta.file.path}\n path={path.resolve(root, '.kubb/fetch.ts')}\n isTypeOnly\n />\n <File.Import name={['fetch']} root={meta.file.path} path={path.resolve(root, '.kubb/fetch.ts')} />\n {client.dataReturnType === 'full' && (\n <File.Import name={['ResponseConfig']} root={meta.file.path} path={path.resolve(root, '.kubb/fetch.ts')} isTypeOnly />\n )}\n </>\n )}\n\n <McpHandler\n name={meta.name}\n node={node}\n resolver={tsResolver}\n baseURL={client.baseURL}\n dataReturnType={client.dataReturnType || 'data'}\n paramsCasing={paramsCasing}\n />\n </File>\n )\n },\n})\n","import path from 'node:path'\nimport { findSuccessStatusCode, getOperationParameters } from '@internals/shared'\nimport { defineGenerator } from '@kubb/core'\nimport { pluginZodName } from '@kubb/plugin-zod'\nimport { File, jsxRenderer } from '@kubb/renderer-jsx'\nimport { Server } from '../components/Server.tsx'\nimport type { PluginMcp } from '../types.ts'\n\n/**\n * Default v5 server generator for `@kubb/plugin-mcp`.\n *\n * Uses individual zod schemas for each param (e.g. `createPetsPathUuidSchema`, `createPetsQueryOffsetSchema`)\n * and `resolveResponseStatusName` for per-status response schemas.\n * Query and header params are composed into `z.object({ ... })` from individual schemas.\n */\nexport const serverGenerator = defineGenerator<PluginMcp>({\n name: 'operations',\n renderer: jsxRenderer,\n operations(nodes, ctx) {\n const { adapter, config, resolver, plugin, driver, root } = ctx\n const { output, paramsCasing, group } = ctx.options\n\n const pluginZod = driver.getPlugin(pluginZodName)\n\n if (!pluginZod) {\n return\n }\n\n const zodResolver = driver.getResolver(pluginZodName)\n\n const name = 'server'\n const serverFilePath = path.resolve(root, output.path, 'server.ts')\n const serverFile = {\n baseName: 'server.ts' as const,\n path: serverFilePath,\n meta: { pluginName: plugin.name },\n }\n\n const jsonFilePath = path.resolve(root, output.path, '.mcp.json')\n const jsonFile = {\n baseName: '.mcp.json' as const,\n path: jsonFilePath,\n meta: { pluginName: plugin.name },\n }\n\n const operationsMapped = nodes.map((node) => {\n const { path: pathParams, query: queryParams, header: headerParams } = getOperationParameters(node, { paramsCasing })\n\n const mcpFile = resolver.resolveFile({ name: node.operationId, extname: '.ts', tag: node.tags[0] ?? 'default', path: node.path }, { root, output, group })\n\n const zodFile = zodResolver.resolveFile(\n { name: node.operationId, extname: '.ts', tag: node.tags[0] ?? 'default', path: node.path },\n {\n root,\n output: pluginZod.options?.output ?? output,\n group: pluginZod.options?.group,\n },\n )\n\n const requestName = node.requestBody?.content?.[0]?.schema ? zodResolver.resolveDataName(node) : undefined\n const successStatus = findSuccessStatusCode(node.responses)\n const responseName = successStatus ? zodResolver.resolveResponseStatusName(node, successStatus) : undefined\n\n const resolveParams = (params: typeof pathParams) => params.map((p) => ({ name: p.name, schemaName: zodResolver.resolveParamName(node, p) }))\n\n return {\n tool: {\n name: node.operationId,\n title: node.summary || undefined,\n description: node.description || `Make a ${node.method.toUpperCase()} request to ${node.path}`,\n },\n mcp: {\n name: resolver.resolveHandlerName(node),\n file: mcpFile,\n },\n zod: {\n pathParams: resolveParams(pathParams),\n queryParams: queryParams.length ? resolveParams(queryParams) : undefined,\n headerParams: headerParams.length ? resolveParams(headerParams) : undefined,\n requestName,\n responseName,\n file: zodFile,\n },\n node: node,\n }\n })\n\n const imports = operationsMapped.flatMap(({ mcp, zod }) => {\n const zodNames = [\n ...zod.pathParams.map((p) => p.schemaName),\n ...(zod.queryParams ?? []).map((p) => p.schemaName),\n ...(zod.headerParams ?? []).map((p) => p.schemaName),\n zod.requestName,\n zod.responseName,\n ].filter((name): name is string => Boolean(name))\n\n const uniqueNames = [...new Set(zodNames)].sort()\n\n return [\n <File.Import key={mcp.name} name={[mcp.name]} root={serverFile.path} path={mcp.file.path} />,\n uniqueNames.length > 0 && <File.Import key={`zod-${mcp.name}`} name={uniqueNames} root={serverFile.path} path={zod.file.path} />,\n ].filter(Boolean)\n })\n\n return (\n <>\n <File\n baseName={serverFile.baseName}\n path={serverFile.path}\n meta={serverFile.meta}\n banner={resolver.resolveBanner(adapter.inputNode, { output, config })}\n footer={resolver.resolveFooter(adapter.inputNode, { output, config })}\n >\n <File.Import name={['McpServer']} path={'@modelcontextprotocol/sdk/server/mcp'} />\n <File.Import name={['z']} path={'zod'} />\n <File.Import name={['StdioServerTransport']} path={'@modelcontextprotocol/sdk/server/stdio'} />\n\n {imports}\n <Server\n name={name}\n serverName={adapter.inputNode?.meta?.title ?? 'server'}\n serverVersion={adapter.inputNode?.meta?.version ?? '0.0.0'}\n paramsCasing={paramsCasing}\n operations={operationsMapped}\n />\n </File>\n\n <File baseName={jsonFile.baseName} path={jsonFile.path} meta={jsonFile.meta}>\n <File.Source name={name}>\n {`\n {\n \"mcpServers\": {\n \"${adapter.inputNode?.meta?.title || 'server'}\": {\n \"type\": \"stdio\",\n \"command\": \"npx\",\n \"args\": [\"tsx\", \"${path.relative(path.dirname(jsonFile.path), serverFile.path)}\"]\n }\n }\n }\n `}\n </File.Source>\n </File>\n </>\n )\n },\n})\n","import { camelCase } from '@internals/utils'\nimport { defineResolver } from '@kubb/core'\nimport type { PluginMcp } from '../types.ts'\n\n/**\n * Naming convention resolver for MCP plugin.\n *\n * Provides default naming helpers using camelCase with a `handler` suffix for functions.\n *\n * @example\n * `resolverMcp.default('addPet', 'function') // → 'addPetHandler'`\n */\nexport const resolverMcp = defineResolver<PluginMcp>(() => ({\n name: 'default',\n pluginName: 'plugin-mcp',\n default(name, type) {\n if (type === 'file') {\n return camelCase(name, { isFile: true })\n }\n return camelCase(name, { suffix: 'handler' })\n },\n resolveName(name) {\n return this.default(name, 'function')\n },\n resolvePathName(name, type) {\n return this.default(name, type)\n },\n resolveHandlerName(node) {\n return this.resolveName(node.operationId)\n },\n}))\n","import path from 'node:path'\nimport { camelCase } from '@internals/utils'\n\nimport { ast, definePlugin, type Group } from '@kubb/core'\nimport { pluginClientName } from '@kubb/plugin-client'\nimport { source as axiosClientSource } from '@kubb/plugin-client/templates/clients/axios.source'\nimport { source as fetchClientSource } from '@kubb/plugin-client/templates/clients/fetch.source'\nimport { source as configSource } from '@kubb/plugin-client/templates/config.source'\nimport { pluginTsName } from '@kubb/plugin-ts'\nimport { pluginZodName } from '@kubb/plugin-zod'\nimport { mcpGenerator } from './generators/mcpGenerator.tsx'\nimport { serverGenerator } from './generators/serverGenerator.tsx'\nimport { resolverMcp } from './resolvers/resolverMcp.ts'\nimport type { PluginMcp } from './types.ts'\n\nexport const pluginMcpName = 'plugin-mcp' satisfies PluginMcp['name']\n\nexport const pluginMcp = definePlugin<PluginMcp>((options) => {\n const {\n output = { path: 'mcp', barrelType: 'named' },\n group,\n exclude = [],\n include,\n override = [],\n paramsCasing,\n client,\n resolver: userResolver,\n transformer: userTransformer,\n generators: userGenerators = [],\n } = options\n\n const clientName = client?.client ?? 'axios'\n const clientImportPath = client?.importPath ?? (!client?.bundle ? `@kubb/plugin-client/clients/${clientName}` : undefined)\n\n const groupConfig = group\n ? ({\n ...group,\n name: group.name\n ? group.name\n : (ctx: { group: string }) => {\n if (group.type === 'path') {\n return `${ctx.group.split('/')[1]}`\n }\n return `${camelCase(ctx.group)}Requests`\n },\n } satisfies Group)\n : undefined\n\n return {\n name: pluginMcpName,\n options,\n dependencies: [pluginTsName, pluginZodName],\n hooks: {\n 'kubb:plugin:setup'(ctx) {\n const resolver = userResolver ? { ...resolverMcp, ...userResolver } : resolverMcp\n\n ctx.setOptions({\n output,\n exclude,\n include,\n override,\n group: groupConfig,\n paramsCasing,\n client: {\n client: clientName,\n clientType: client?.clientType ?? 'function',\n importPath: clientImportPath,\n dataReturnType: client?.dataReturnType ?? 'data',\n bundle: client?.bundle,\n baseURL: client?.baseURL,\n paramsCasing: client?.paramsCasing,\n },\n resolver,\n })\n ctx.setResolver(resolver)\n if (userTransformer) {\n ctx.setTransformer(userTransformer)\n }\n ctx.addGenerator(mcpGenerator)\n ctx.addGenerator(serverGenerator)\n for (const gen of userGenerators) {\n ctx.addGenerator(gen)\n }\n\n const root = path.resolve(ctx.config.root, ctx.config.output.path)\n const hasClientPlugin = ctx.config.plugins?.some((p) => p.name === pluginClientName)\n\n if (client?.bundle && !hasClientPlugin && !clientImportPath) {\n ctx.injectFile({\n baseName: 'fetch.ts',\n path: path.resolve(root, '.kubb/fetch.ts'),\n sources: [\n ast.createSource({\n name: 'fetch',\n nodes: [ast.createText(clientName === 'fetch' ? fetchClientSource : axiosClientSource)],\n isExportable: true,\n isIndexable: true,\n }),\n ],\n })\n }\n\n if (!hasClientPlugin) {\n ctx.injectFile({\n baseName: 'config.ts',\n path: path.resolve(root, '.kubb/config.ts'),\n sources: [\n ast.createSource({\n name: 'config',\n nodes: [ast.createText(configSource)],\n isExportable: false,\n isIndexable: false,\n }),\n ],\n })\n }\n },\n },\n }\n})\n\nexport default pluginMcp\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAsBA,SAAS,gBAAgB,MAAc,QAAyB;CAS9D,O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,iBAAiB;IAC1C,SAAS,CACP,IAAI,aAAa;KACf,MAAM;KACN,OAAO,CAAC,IAAI,WAAW,eAAe,UAAUC,WAAoBC,OAAkB,CAAC;KACvF,cAAc;KACd,aAAa;KACd,CAAC,CACH;IACF,CAAC;GAGJ,IAAI,CAAC,iBACH,IAAI,WAAW;IACb,UAAU;IACV,MAAM,KAAK,QAAQ,MAAM,kBAAkB;IAC3C,SAAS,CACP,IAAI,aAAa;KACf,MAAM;KACN,OAAO,CAAC,IAAI,WAAWC,SAAa,CAAC;KACrC,cAAc;KACd,aAAa;KACd,CAAC,CACH;IACF,CAAC;KAGP;EACF;EACD"}
1
+ {"version":3,"file":"index.js","names":["#options","#transformParam","#eachParam","fetchClientSource","axiosClientSource","configSource"],"sources":["../../../internals/utils/src/casing.ts","../../../internals/utils/src/reserved.ts","../../../internals/utils/src/urlPath.ts","../../../internals/shared/src/operation.ts","../../../internals/shared/src/params.ts","../src/components/McpHandler.tsx","../src/utils.ts","../src/components/Server.tsx","../src/generators/mcpGenerator.tsx","../src/generators/serverGenerator.tsx","../src/resolvers/resolverMcp.ts","../src/plugin.ts"],"sourcesContent":["type Options = {\n /**\n * When `true`, dot-separated segments are split on `.` and joined with `/` after casing.\n */\n isFile?: boolean\n /**\n * Text prepended before casing is applied.\n */\n prefix?: string\n /**\n * Text appended before casing is applied.\n */\n suffix?: string\n}\n\n/**\n * Shared implementation for camelCase and PascalCase conversion.\n * Splits on common word boundaries (spaces, hyphens, underscores, dots, slashes, colons)\n * and capitalizes each word according to `pascal`.\n *\n * When `pascal` is `true` the first word is also capitalized (PascalCase), otherwise only subsequent words are.\n */\nfunction toCamelOrPascal(text: string, pascal: boolean): string {\n const normalized = text\n .trim()\n .replace(/([a-z\\d])([A-Z])/g, '$1 $2')\n .replace(/([A-Z]+)([A-Z][a-z])/g, '$1 $2')\n .replace(/(\\d)([a-z])/g, '$1 $2')\n\n const words = normalized.split(/[\\s\\-_./\\\\:]+/).filter(Boolean)\n\n return words\n .map((word, i) => {\n const allUpper = word.length > 1 && word === word.toUpperCase()\n if (allUpper) return word\n if (i === 0 && !pascal) return word.charAt(0).toLowerCase() + word.slice(1)\n return word.charAt(0).toUpperCase() + word.slice(1)\n })\n .join('')\n .replace(/[^a-zA-Z0-9]/g, '')\n}\n\n/**\n * Splits `text` on `.` and applies `transformPart` to each segment.\n * The last segment receives `isLast = true`, all earlier segments receive `false`.\n * Segments are joined with `/` to form a file path.\n *\n * Only splits on dots followed by a letter so that version numbers\n * embedded in operationIds (e.g. `v2025.0`) are kept intact.\n */\nfunction applyToFileParts(text: string, transformPart: (part: string, isLast: boolean) => string): string {\n const parts = text.split(/\\.(?=[a-zA-Z])/)\n return parts.map((part, i) => transformPart(part, i === parts.length - 1)).join('/')\n}\n\n/**\n * Converts `text` to camelCase.\n * When `isFile` is `true`, dot-separated segments are each cased independently and joined with `/`.\n *\n * @example\n * camelCase('hello-world') // 'helloWorld'\n * camelCase('pet.petId', { isFile: true }) // 'pet/petId'\n */\nexport function camelCase(text: string, { isFile, prefix = '', suffix = '' }: Options = {}): string {\n if (isFile) {\n return applyToFileParts(text, (part, isLast) => camelCase(part, isLast ? { prefix, suffix } : {}))\n }\n\n return toCamelOrPascal(`${prefix} ${text} ${suffix}`, false)\n}\n\n/**\n * Converts `text` to PascalCase.\n * When `isFile` is `true`, the last dot-separated segment is PascalCased and earlier segments are camelCased.\n *\n * @example\n * pascalCase('hello-world') // 'HelloWorld'\n * pascalCase('pet.petId', { isFile: true }) // 'pet/PetId'\n */\nexport function pascalCase(text: string, { isFile, prefix = '', suffix = '' }: Options = {}): string {\n if (isFile) {\n return applyToFileParts(text, (part, isLast) => (isLast ? pascalCase(part, { prefix, suffix }) : camelCase(part)))\n }\n\n return toCamelOrPascal(`${prefix} ${text} ${suffix}`, true)\n}\n\n/**\n * Converts `text` to snake_case.\n *\n * @example\n * snakeCase('helloWorld') // 'hello_world'\n * snakeCase('Hello-World') // 'hello_world'\n */\nexport function snakeCase(text: string, { prefix = '', suffix = '' }: Omit<Options, 'isFile'> = {}): string {\n const processed = `${prefix} ${text} ${suffix}`.trim()\n return processed\n .replace(/([a-z])([A-Z])/g, '$1_$2')\n .replace(/[\\s\\-.]+/g, '_')\n .replace(/[^a-zA-Z0-9_]/g, '')\n .toLowerCase()\n .split('_')\n .filter(Boolean)\n .join('_')\n}\n\n/**\n * Converts `text` to SCREAMING_SNAKE_CASE.\n *\n * @example\n * screamingSnakeCase('helloWorld') // 'HELLO_WORLD'\n */\nexport function screamingSnakeCase(text: string, { prefix = '', suffix = '' }: Omit<Options, 'isFile'> = {}): string {\n return snakeCase(text, { prefix, suffix }).toUpperCase()\n}\n","/**\n * JavaScript and Java reserved words.\n * @link https://github.com/jonschlinkert/reserved/blob/master/index.js\n */\nconst reservedWords = new Set([\n 'abstract',\n 'arguments',\n 'boolean',\n 'break',\n 'byte',\n 'case',\n 'catch',\n 'char',\n 'class',\n 'const',\n 'continue',\n 'debugger',\n 'default',\n 'delete',\n 'do',\n 'double',\n 'else',\n 'enum',\n 'eval',\n 'export',\n 'extends',\n 'false',\n 'final',\n 'finally',\n 'float',\n 'for',\n 'function',\n 'goto',\n 'if',\n 'implements',\n 'import',\n 'in',\n 'instanceof',\n 'int',\n 'interface',\n 'let',\n 'long',\n 'native',\n 'new',\n 'null',\n 'package',\n 'private',\n 'protected',\n 'public',\n 'return',\n 'short',\n 'static',\n 'super',\n 'switch',\n 'synchronized',\n 'this',\n 'throw',\n 'throws',\n 'transient',\n 'true',\n 'try',\n 'typeof',\n 'var',\n 'void',\n 'volatile',\n 'while',\n 'with',\n 'yield',\n 'Array',\n 'Date',\n 'hasOwnProperty',\n 'Infinity',\n 'isFinite',\n 'isNaN',\n 'isPrototypeOf',\n 'length',\n 'Math',\n 'name',\n 'NaN',\n 'Number',\n 'Object',\n 'prototype',\n 'String',\n 'toString',\n 'undefined',\n 'valueOf',\n] as const)\n\n/**\n * Returns `true` when `name` is a syntactically valid JavaScript variable name.\n *\n * @example\n * ```ts\n * isValidVarName('status') // true\n * isValidVarName('class') // false (reserved word)\n * isValidVarName('42foo') // false (starts with digit)\n * ```\n */\nexport function isValidVarName(name: string): boolean {\n if (!name || reservedWords.has(name as 'valueOf')) {\n return false\n }\n return /^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(name)\n}\n","import { camelCase } from './casing.ts'\nimport { isValidVarName } from './reserved.ts'\n\nexport type URLObject = {\n /**\n * The resolved URL string (Express-style or template literal, depending on context).\n */\n url: string\n /**\n * Extracted path parameters as a key-value map, or `undefined` when the path has none.\n */\n params?: Record<string, string>\n}\n\ntype ObjectOptions = {\n /**\n * Controls whether the `url` is rendered as an Express path or a template literal.\n * @default 'path'\n */\n type?: 'path' | 'template'\n /**\n * Optional transform applied to each extracted parameter name.\n */\n replacer?: (pathParam: string) => string\n /**\n * When `true`, the result is serialized to a string expression instead of a plain object.\n */\n stringify?: boolean\n}\n\n/**\n * Supported identifier casing strategies for path parameters.\n */\ntype PathCasing = 'camelcase'\n\ntype Options = {\n /**\n * Casing strategy applied to path parameter names.\n * @default undefined (original identifier preserved)\n */\n casing?: PathCasing\n}\n\n/**\n * Parses and transforms an OpenAPI/Swagger path string into various URL formats.\n *\n * @example\n * const p = new URLPath('/pet/{petId}')\n * p.URL // '/pet/:petId'\n * p.template // '`/pet/${petId}`'\n */\nexport class URLPath {\n /**\n * The raw OpenAPI/Swagger path string, e.g. `/pet/{petId}`.\n */\n path: string\n\n #options: Options\n\n constructor(path: string, options: Options = {}) {\n this.path = path\n this.#options = options\n }\n\n /** Converts the OpenAPI path to Express-style colon syntax, e.g. `/pet/{petId}` → `/pet/:petId`.\n *\n * @example\n * ```ts\n * new URLPath('/pet/{petId}').URL // '/pet/:petId'\n * ```\n */\n get URL(): string {\n return this.toURLPath()\n }\n\n /** Returns `true` when `path` is a fully-qualified URL (e.g. starts with `https://`).\n *\n * @example\n * ```ts\n * new URLPath('https://petstore.swagger.io/v2/pet').isURL // true\n * new URLPath('/pet/{petId}').isURL // false\n * ```\n */\n get isURL(): boolean {\n try {\n return !!new URL(this.path).href\n } catch {\n return false\n }\n }\n\n /**\n * Converts the OpenAPI path to a TypeScript template literal string.\n *\n * @example\n * new URLPath('/pet/{petId}').template // '`/pet/${petId}`'\n * new URLPath('/account/monetary-accountID').template // '`/account/${monetaryAccountId}`'\n */\n get template(): string {\n return this.toTemplateString()\n }\n\n /** Returns the path and its extracted params as a structured `URLObject`, or as a stringified expression when `stringify` is set.\n *\n * @example\n * ```ts\n * new URLPath('/pet/{petId}').object\n * // { url: '/pet/:petId', params: { petId: 'petId' } }\n * ```\n */\n get object(): URLObject | string {\n return this.toObject()\n }\n\n /** Returns a map of path parameter names, or `undefined` when the path has no parameters.\n *\n * @example\n * ```ts\n * new URLPath('/pet/{petId}').params // { petId: 'petId' }\n * new URLPath('/pet').params // undefined\n * ```\n */\n get params(): Record<string, string> | undefined {\n return this.toParamsObject()\n }\n\n #transformParam(raw: string): string {\n const param = isValidVarName(raw) ? raw : camelCase(raw)\n return this.#options.casing === 'camelcase' ? camelCase(param) : param\n }\n\n /**\n * Iterates over every `{param}` token in `path`, calling `fn` with the raw token and transformed name.\n */\n #eachParam(fn: (raw: string, param: string) => void): void {\n for (const match of this.path.matchAll(/\\{([^}]+)\\}/g)) {\n const raw = match[1]!\n fn(raw, this.#transformParam(raw))\n }\n }\n\n toObject({ type = 'path', replacer, stringify }: ObjectOptions = {}): URLObject | string {\n const object = {\n url: type === 'path' ? this.toURLPath() : this.toTemplateString({ replacer }),\n params: this.toParamsObject(),\n }\n\n if (stringify) {\n if (type === 'template') {\n return JSON.stringify(object).replaceAll(\"'\", '').replaceAll(`\"`, '')\n }\n\n if (object.params) {\n return `{ url: '${object.url}', params: ${JSON.stringify(object.params).replaceAll(\"'\", '').replaceAll(`\"`, '')} }`\n }\n\n return `{ url: '${object.url}' }`\n }\n\n return object\n }\n\n /**\n * Converts the OpenAPI path to a TypeScript template literal string.\n * An optional `replacer` can transform each extracted parameter name before interpolation.\n *\n * @example\n * new URLPath('/pet/{petId}').toTemplateString() // '`/pet/${petId}`'\n */\n toTemplateString({ prefix = '', replacer }: { prefix?: string; replacer?: (pathParam: string) => string } = {}): string {\n const parts = this.path.split(/\\{([^}]+)\\}/)\n const result = parts\n .map((part, i) => {\n if (i % 2 === 0) return part\n const param = this.#transformParam(part)\n return `\\${${replacer ? replacer(param) : param}}`\n })\n .join('')\n\n return `\\`${prefix}${result}\\``\n }\n\n /**\n * Extracts all `{param}` segments from the path and returns them as a key-value map.\n * An optional `replacer` transforms each parameter name in both key and value positions.\n * Returns `undefined` when no path parameters are found.\n *\n * @example\n * ```ts\n * new URLPath('/pet/{petId}/tag/{tagId}').toParamsObject()\n * // { petId: 'petId', tagId: 'tagId' }\n * ```\n */\n toParamsObject(replacer?: (pathParam: string) => string): Record<string, string> | undefined {\n const params: Record<string, string> = {}\n\n this.#eachParam((_raw, param) => {\n const key = replacer ? replacer(param) : param\n params[key] = key\n })\n\n return Object.keys(params).length > 0 ? params : undefined\n }\n\n /** Converts the OpenAPI path to Express-style colon syntax.\n *\n * @example\n * ```ts\n * new URLPath('/pet/{petId}').toURLPath() // '/pet/:petId'\n * ```\n */\n toURLPath(): string {\n return this.path.replace(/\\{([^}]+)\\}/g, ':$1')\n }\n}\n","import { URLPath } from '@internals/utils'\nimport { ast } from '@kubb/core'\n\nexport type ContentTypeInfo = {\n contentTypes: string[]\n isMultipleContentTypes: boolean\n contentTypeUnion: string\n defaultContentType: string\n hasFormData: boolean\n}\n\nexport type RequestConfigResolver = {\n resolveDataName(node: ast.OperationNode): string\n}\n\nexport type ResponseStatusNameResolver = {\n resolveResponseStatusName(node: ast.OperationNode, statusCode: ast.StatusCode): string\n}\n\nexport type ResponseNameResolver = ResponseStatusNameResolver & {\n resolveResponseName(node: ast.OperationNode): string\n}\n\nexport type OperationTypeNameResolver = RequestConfigResolver &\n ResponseNameResolver & {\n resolvePathParamsName(node: ast.OperationNode, param: ast.ParameterNode): string\n resolveQueryParamsName(node: ast.OperationNode, param: ast.ParameterNode): string\n resolveHeaderParamsName(node: ast.OperationNode, param: ast.ParameterNode): string\n }\n\nexport type OperationCommentLink = 'pathTemplate' | 'urlPath' | false | ((node: ast.OperationNode) => string | undefined)\n\nexport type BuildOperationCommentsOptions = {\n link?: OperationCommentLink\n linkPosition?: 'beforeDeprecated' | 'afterDeprecated'\n splitLines?: boolean\n}\n\ntype ResponseLike = {\n statusCode: ast.StatusCode | number | string\n}\n\nexport type OperationParameterGroups = Record<ast.ParameterNode['in'], Array<ast.ParameterNode>>\n\nexport type ResolveOperationTypeNameOptions = {\n paramsCasing?: 'camelcase'\n responseStatusNames?: boolean | 'error'\n exclude?: ReadonlyArray<string | undefined>\n order?: 'params-first' | 'body-response-first'\n}\n\nfunction getOperationLink(node: ast.OperationNode, link: OperationCommentLink): string | undefined {\n if (!link) {\n return undefined\n }\n\n if (typeof link === 'function') {\n return link(node)\n }\n\n if (link === 'urlPath') {\n return node.path ? `{@link ${new URLPath(node.path).URL}}` : undefined\n }\n\n return `{@link ${node.path.replaceAll('{', ':').replaceAll('}', '')}}`\n}\n\nexport function getContentTypeInfo(node: ast.OperationNode): ContentTypeInfo {\n const contentTypes = node.requestBody?.content?.map((e) => e.contentType) ?? []\n const isMultipleContentTypes = contentTypes.length > 1\n\n return {\n contentTypes,\n isMultipleContentTypes,\n contentTypeUnion: isMultipleContentTypes ? contentTypes.map((ct) => JSON.stringify(ct)).join(' | ') : '',\n defaultContentType: contentTypes[0] ?? 'application/json',\n hasFormData: contentTypes.some((ct) => ct === 'multipart/form-data'),\n }\n}\n\nexport function buildRequestConfigType(node: ast.OperationNode, resolver: RequestConfigResolver): string {\n const requestName = node.requestBody?.content?.[0]?.schema ? resolver.resolveDataName(node) : undefined\n const { isMultipleContentTypes, contentTypeUnion } = getContentTypeInfo(node)\n const configType = requestName ? `Partial<RequestConfig<${requestName}>>` : 'Partial<RequestConfig>'\n const configProps = ['client?: Client', isMultipleContentTypes ? `contentType?: ${contentTypeUnion}` : undefined].filter(Boolean).join('; ')\n\n return `${configType} & { ${configProps} }`\n}\n\nexport function buildOperationComments(node: ast.OperationNode, options: BuildOperationCommentsOptions = {}): Array<string> {\n const { link = 'pathTemplate', linkPosition = 'afterDeprecated', splitLines = false } = options\n const linkComment = getOperationLink(node, link)\n const comments =\n linkPosition === 'beforeDeprecated'\n ? [node.description && `@description ${node.description}`, node.summary && `@summary ${node.summary}`, linkComment, node.deprecated && '@deprecated']\n : [node.description && `@description ${node.description}`, node.summary && `@summary ${node.summary}`, node.deprecated && '@deprecated', linkComment]\n\n const filteredComments = comments.filter((comment): comment is string => Boolean(comment))\n\n if (!splitLines) {\n return filteredComments\n }\n\n return filteredComments.flatMap((text) => text.split(/\\r?\\n/).map((line) => line.trim())).filter((comment): comment is string => Boolean(comment))\n}\n\nexport function getOperationParameters(node: ast.OperationNode, options: { paramsCasing?: 'camelcase' } = {}): OperationParameterGroups {\n const params = ast.caseParams(node.parameters, options.paramsCasing)\n\n return {\n path: params.filter((param) => param.in === 'path'),\n query: params.filter((param) => param.in === 'query'),\n header: params.filter((param) => param.in === 'header'),\n cookie: params.filter((param) => param.in === 'cookie'),\n }\n}\n\nexport function getStatusCodeNumber(statusCode: ast.StatusCode | number | string): number | undefined {\n const code = Number(statusCode)\n\n return Number.isNaN(code) ? undefined : code\n}\n\nexport function isSuccessStatusCode(statusCode: ast.StatusCode | number | string): boolean {\n const code = getStatusCodeNumber(statusCode)\n\n return code !== undefined && code >= 200 && code < 300\n}\n\nexport function isErrorStatusCode(statusCode: ast.StatusCode | number | string): boolean {\n const code = getStatusCodeNumber(statusCode)\n\n return code !== undefined && code >= 400\n}\n\nexport function getSuccessResponses<TResponse extends ResponseLike>(responses: ReadonlyArray<TResponse>): Array<TResponse> {\n return responses.filter((response) => isSuccessStatusCode(response.statusCode))\n}\n\nexport function getOperationSuccessResponses(node: ast.OperationNode): Array<ast.ResponseNode> {\n return getSuccessResponses(node.responses)\n}\n\nexport function getPrimarySuccessResponse(node: ast.OperationNode): ast.ResponseNode | undefined {\n return getOperationSuccessResponses(node)[0]\n}\n\nexport function resolveErrorNames(node: ast.OperationNode, resolver: ResponseStatusNameResolver): string[] {\n return node.responses\n .filter((response) => isErrorStatusCode(response.statusCode))\n .map((response) => resolver.resolveResponseStatusName(node, response.statusCode))\n}\n\nexport function resolveStatusCodeNames(node: ast.OperationNode, resolver: ResponseStatusNameResolver): string[] {\n return node.responses.map((response) => resolver.resolveResponseStatusName(node, response.statusCode))\n}\n\nconst typeNamesByResolver = new WeakMap<OperationTypeNameResolver, Map<string, string[]>>()\n\nexport function resolveOperationTypeNames(\n node: ast.OperationNode,\n resolver: OperationTypeNameResolver,\n options: ResolveOperationTypeNameOptions = {},\n): string[] {\n const cacheKey = `${node.operationId}\\0${options.paramsCasing ?? ''}\\0${options.order ?? ''}\\0${options.responseStatusNames ?? ''}\\0${(options.exclude ?? []).join(',')}`\n let byResolver = typeNamesByResolver.get(resolver)\n if (byResolver) {\n const cached = byResolver.get(cacheKey)\n if (cached) return cached\n } else {\n byResolver = new Map()\n typeNamesByResolver.set(resolver, byResolver)\n }\n\n const { path, query, header } = getOperationParameters(node, { paramsCasing: options.paramsCasing })\n const responseStatusNames =\n options.responseStatusNames === 'error'\n ? resolveErrorNames(node, resolver)\n : options.responseStatusNames === false\n ? []\n : resolveStatusCodeNames(node, resolver)\n const exclude = new Set(options.exclude ?? [])\n const paramNames = [\n ...path.map((param) => resolver.resolvePathParamsName(node, param)),\n ...query.map((param) => resolver.resolveQueryParamsName(node, param)),\n ...header.map((param) => resolver.resolveHeaderParamsName(node, param)),\n ]\n const bodyAndResponseNames = [node.requestBody?.content?.[0]?.schema ? resolver.resolveDataName(node) : undefined, resolver.resolveResponseName(node)]\n const names =\n options.order === 'body-response-first'\n ? [...bodyAndResponseNames, ...paramNames, ...responseStatusNames]\n : [...paramNames, ...bodyAndResponseNames, ...responseStatusNames]\n\n const result = names.filter((name): name is string => Boolean(name) && !exclude.has(name))\n byResolver.set(cacheKey, result)\n return result\n}\n\nexport function resolveResponseTypes(node: ast.OperationNode, resolver: ResponseNameResolver): Array<[statusCode: number | 'default', typeName: string]> {\n const types: Array<[number | 'default', string]> = []\n\n for (const response of node.responses) {\n if (response.statusCode === 'default') {\n types.push(['default', resolver.resolveResponseName(node)])\n continue\n }\n\n const code = getStatusCodeNumber(response.statusCode)\n if (code === undefined) {\n continue\n }\n\n types.push([code, isSuccessStatusCode(code) ? resolver.resolveResponseName(node) : resolver.resolveResponseStatusName(node, response.statusCode)])\n }\n\n return types\n}\n\nexport function findSuccessStatusCode(responses: Array<{ statusCode: ast.StatusCode | number | string }>): ast.StatusCode | undefined {\n for (const response of responses) {\n if (isSuccessStatusCode(response.statusCode)) {\n return response.statusCode as ast.StatusCode\n }\n }\n\n return undefined\n}\n","export function buildParamsMapping<TParam extends { name: string }>(\n originalParams: ReadonlyArray<TParam>,\n mappedParams: ReadonlyArray<TParam>,\n): Record<string, string> | undefined {\n const mapping: Record<string, string> = {}\n let hasChanged = false\n\n originalParams.forEach((param, i) => {\n const mappedName = mappedParams[i]?.name ?? param.name\n mapping[param.name] = mappedName\n\n if (param.name !== mappedName) {\n hasChanged = true\n }\n })\n\n return hasChanged ? mapping : undefined\n}\n\nexport function buildTransformedParamsMapping<TParam extends { name: string }>(\n params: ReadonlyArray<TParam>,\n transformName: (name: string) => string,\n): Record<string, string> | undefined {\n if (!params.length) {\n return undefined\n }\n\n return buildParamsMapping(\n params,\n params.map((param) => ({ ...param, name: transformName(param.name) })),\n )\n}\n","import { buildOperationComments, buildTransformedParamsMapping, getOperationParameters } from '@internals/shared'\nimport { camelCase, isValidVarName, URLPath } from '@internals/utils'\nimport { ast } from '@kubb/core'\nimport type { ResolverTs } from '@kubb/plugin-ts'\nimport { functionPrinter } from '@kubb/plugin-ts'\nimport { File, Function } from '@kubb/renderer-jsx'\nimport type { KubbReactNode } from '@kubb/renderer-jsx/types'\nimport type { PluginMcp } from '../types.ts'\n\ntype Props = {\n /**\n * Name of the handler function.\n */\n name: string\n /**\n * AST operation node.\n */\n node: ast.OperationNode\n /**\n * TypeScript resolver for resolving param/data/response type names.\n */\n resolver: ResolverTs\n /**\n * Base URL prepended to every generated request URL.\n */\n baseURL: string | undefined\n /**\n * Return type when calling fetch.\n * - 'data' returns response data only.\n * - 'full' returns the full response object.\n * @default 'data'\n */\n dataReturnType: PluginMcp['resolvedOptions']['client']['dataReturnType']\n /**\n * How to style your params.\n */\n paramsCasing?: PluginMcp['resolvedOptions']['paramsCasing']\n}\n\n/**\n * Generate a remapping statement: `const mappedX = x ? { \"orig\": x.camel, ... } : undefined`\n */\nfunction buildRemappingCode(mapping: Record<string, string>, varName: string, sourceName: string): string {\n const pairs = Object.entries(mapping)\n .map(([orig, camel]) => `\"${orig}\": ${sourceName}.${camel}`)\n .join(', ')\n return `const ${varName} = ${sourceName} ? { ${pairs} } : undefined`\n}\n\nconst declarationPrinter = functionPrinter({ mode: 'declaration' })\n\nexport function McpHandler({ name, node, resolver, baseURL, dataReturnType, paramsCasing }: Props): KubbReactNode {\n const urlPath = new URLPath(node.path)\n const contentType = node.requestBody?.content?.[0]?.contentType\n const isFormData = contentType === 'multipart/form-data'\n\n const { query: queryParams, header: headerParams } = getOperationParameters(node, { paramsCasing })\n const { path: originalPathParams, query: originalQueryParams, header: originalHeaderParams } = getOperationParameters(node)\n\n const requestName = node.requestBody?.content?.[0]?.schema ? resolver.resolveDataName(node) : undefined\n const responseName = resolver.resolveResponseName(node)\n\n const errorResponses = node.responses.filter((r) => Number(r.statusCode) >= 400).map((r) => resolver.resolveResponseStatusName(node, r.statusCode))\n const errorType = errorResponses.length > 0 ? errorResponses.join(' | ') : 'Error'\n\n const TError = `ResponseErrorConfig<${errorType}>`\n const generics = [responseName, TError, requestName || 'unknown'].filter(Boolean)\n\n const paramsNode = ast.createOperationParams(node, {\n paramsType: 'object',\n pathParamsType: 'inline',\n resolver,\n paramsCasing,\n })\n const baseParamsSignature = declarationPrinter.print(paramsNode) ?? ''\n const paramsSignature = baseParamsSignature\n ? `${baseParamsSignature}, request: RequestHandlerExtra<ServerRequest, ServerNotification>`\n : 'request: RequestHandlerExtra<ServerRequest, ServerNotification>'\n\n const pathParamsMapping = paramsCasing ? buildTransformedParamsMapping(originalPathParams, camelCase) : undefined\n const queryParamsMapping = paramsCasing ? buildTransformedParamsMapping(originalQueryParams, camelCase) : undefined\n const headerParamsMapping = paramsCasing ? buildTransformedParamsMapping(originalHeaderParams, camelCase) : undefined\n\n const contentTypeHeader =\n contentType && contentType !== 'application/json' && contentType !== 'multipart/form-data' ? `'Content-Type': '${contentType}'` : undefined\n const headers = [headerParams.length ? (headerParamsMapping ? '...mappedHeaders' : '...headers') : undefined, contentTypeHeader].filter(Boolean)\n\n const fetchConfig: string[] = []\n fetchConfig.push(`method: ${JSON.stringify(node.method.toUpperCase())}`)\n fetchConfig.push(`url: ${urlPath.template}`)\n if (baseURL) fetchConfig.push(`baseURL: \\`${baseURL}\\``)\n if (queryParams.length) fetchConfig.push(queryParamsMapping ? 'params: mappedParams' : 'params')\n if (requestName) fetchConfig.push(`data: ${isFormData ? 'formData as FormData' : 'requestData'}`)\n if (headers.length) fetchConfig.push(`headers: { ${headers.join(', ')} }`)\n\n const callToolResult =\n dataReturnType === 'data'\n ? `return {\n content: [\n {\n type: 'text',\n text: JSON.stringify(res.data)\n }\n ],\n structuredContent: { data: res.data }\n }`\n : `return {\n content: [\n {\n type: 'text',\n text: JSON.stringify(res)\n }\n ],\n structuredContent: { data: res.data }\n }`\n\n return (\n <File.Source name={name} isExportable isIndexable>\n <Function\n name={name}\n async\n export\n params={paramsSignature}\n JSDoc={{\n comments: buildOperationComments(node),\n }}\n returnType={'Promise<CallToolResult>'}\n >\n {''}\n <br />\n <br />\n {pathParamsMapping &&\n Object.entries(pathParamsMapping)\n .filter(([originalName, camelCaseName]) => originalName !== camelCaseName && isValidVarName(originalName))\n .map(([originalName, camelCaseName]) => `const ${originalName} = ${camelCaseName}`)\n .join('\\n')}\n {pathParamsMapping && (\n <>\n <br />\n <br />\n </>\n )}\n {queryParamsMapping && queryParams.length > 0 && (\n <>\n {buildRemappingCode(queryParamsMapping, 'mappedParams', 'params')}\n <br />\n <br />\n </>\n )}\n {headerParamsMapping && headerParams.length > 0 && (\n <>\n {buildRemappingCode(headerParamsMapping, 'mappedHeaders', 'headers')}\n <br />\n <br />\n </>\n )}\n {requestName && 'const requestData = data'}\n <br />\n {isFormData && requestName && 'const formData = buildFormData(requestData)'}\n <br />\n {`const res = await fetch<${generics.join(', ')}>({ ${fetchConfig.join(', ')} }, request)`}\n <br />\n {callToolResult}\n </Function>\n </File.Source>\n )\n}\n","import type { ast } from '@kubb/core'\n\nexport type ZodParam = {\n name: string\n schemaName: string\n}\n\n/**\n * Render a group param value — compose individual schemas into `z.object({ ... })`,\n * or use a schema name string directly.\n */\nexport function zodGroupExpr(entry: string | Array<ZodParam>): string {\n if (typeof entry === 'string') {\n return entry\n }\n const entries = entry.map((p) => `${JSON.stringify(p.name)}: ${p.schemaName}`)\n return `z.object({ ${entries.join(', ')} })`\n}\n\n/**\n * Convert a SchemaNode type to an inline Zod expression string.\n * Used as fallback when no named zod schema is available for a path parameter.\n */\nexport function zodExprFromSchemaNode(schema: ast.SchemaNode): string {\n let expr: string\n switch (schema.type) {\n case 'enum': {\n // namedEnumValues takes priority over enumValues\n const rawValues: Array<string | number | boolean> = schema.namedEnumValues?.length\n ? schema.namedEnumValues.map((v) => v.value)\n : (schema.enumValues ?? []).filter((v): v is string | number | boolean => v !== null)\n\n if (rawValues.length > 0 && rawValues.every((v) => typeof v === 'string')) {\n expr = `z.enum([${rawValues.map((v) => JSON.stringify(v)).join(', ')}])`\n } else if (rawValues.length > 0) {\n const literals = rawValues.map((v) => `z.literal(${JSON.stringify(v)})`)\n expr = literals.length === 1 ? literals[0]! : `z.union([${literals.join(', ')}])`\n } else {\n expr = 'z.string()'\n }\n break\n }\n case 'integer':\n expr = 'z.coerce.number()'\n break\n case 'number':\n expr = 'z.number()'\n break\n case 'boolean':\n expr = 'z.boolean()'\n break\n case 'array':\n expr = 'z.array(z.unknown())'\n break\n default:\n expr = 'z.string()'\n }\n\n if (schema.nullable) {\n expr = `${expr}.nullable()`\n }\n\n return expr\n}\n","import { getOperationParameters } from '@internals/shared'\nimport { ast } from '@kubb/core'\nimport { functionPrinter } from '@kubb/plugin-ts'\nimport { Const, File, Function } from '@kubb/renderer-jsx'\nimport type { KubbReactNode } from '@kubb/renderer-jsx/types'\nimport type { PluginMcp } from '../types.ts'\nimport type { ZodParam } from '../utils.ts'\nimport { zodExprFromSchemaNode, zodGroupExpr } from '../utils.ts'\n\ntype Props = {\n /**\n * Variable name for the MCP server instance (e.g. 'server').\n */\n name: string\n /**\n * Human-readable server name passed to `new McpServer({ name })`.\n */\n serverName: string\n /**\n * Semantic version string passed to `new McpServer({ version })`.\n */\n serverVersion: string\n /**\n * How to style your params.\n */\n paramsCasing?: PluginMcp['resolvedOptions']['paramsCasing']\n /**\n * Operations to register as MCP tools, each carrying its handler,\n * zod schema, and AST node metadata.\n */\n operations: Array<{\n tool: {\n name: string\n title?: string\n description: string\n }\n mcp: {\n name: string\n file: ast.FileNode\n }\n zod: {\n pathParams: Array<ZodParam>\n /**\n * Query params — individual schemas to compose into `z.object({ ... })`.\n */\n queryParams?: string | Array<ZodParam>\n /**\n * Header params — individual schemas to compose into `z.object({ ... })`.\n */\n headerParams?: string | Array<ZodParam>\n requestName?: string\n responseName?: string\n }\n node: ast.OperationNode\n }>\n}\n\nconst keysPrinter = functionPrinter({ mode: 'keys' })\n\nexport function Server({ name, serverName, serverVersion, paramsCasing, operations }: Props): KubbReactNode {\n return (\n <File.Source name={name} isExportable isIndexable>\n <Const name={'server'} export>\n {`\n new McpServer({\n name: '${serverName}',\n version: '${serverVersion}',\n})\n `}\n </Const>\n\n {operations\n .map(({ tool, mcp, zod, node }) => {\n const { path: pathParams } = getOperationParameters(node, { paramsCasing })\n\n const pathEntries: Array<{ key: string; value: string }> = []\n const otherEntries: Array<{ key: string; value: string }> = []\n\n for (const p of pathParams) {\n const zodParam = zod.pathParams.find((zp) => zp.name === p.name)\n pathEntries.push({ key: p.name, value: zodParam ? zodParam.schemaName : zodExprFromSchemaNode(p.schema) })\n }\n\n if (zod.requestName) {\n otherEntries.push({ key: 'data', value: zod.requestName })\n }\n\n if (zod.queryParams) {\n otherEntries.push({ key: 'params', value: zodGroupExpr(zod.queryParams) })\n }\n\n if (zod.headerParams) {\n otherEntries.push({ key: 'headers', value: zodGroupExpr(zod.headerParams) })\n }\n\n otherEntries.sort((a, b) => a.key.localeCompare(b.key))\n const entries = [...pathEntries, ...otherEntries]\n\n const paramsNode = entries.length\n ? ast.createFunctionParameters({\n params: [\n ast.createParameterGroup({\n properties: entries.map((e) => ast.createFunctionParameter({ name: e.key, optional: false })),\n }),\n ],\n })\n : undefined\n\n const destructured = paramsNode ? (keysPrinter.print(paramsNode) ?? '') : ''\n const inputSchema = entries.length ? `{ ${entries.map((e) => `${e.key}: ${e.value}`).join(', ')} }` : undefined\n const outputSchema = zod.responseName\n\n const config = [\n tool.title ? `title: ${JSON.stringify(tool.title)}` : null,\n `description: ${JSON.stringify(tool.description)}`,\n outputSchema ? `outputSchema: { data: ${outputSchema} }` : null,\n ]\n .filter(Boolean)\n .join(',\\n ')\n\n if (inputSchema) {\n return `\nserver.registerTool(${JSON.stringify(tool.name)}, {\n ${config},\n inputSchema: ${inputSchema},\n}, async (${destructured}, request) => {\n return ${mcp.name}(${destructured}, request)\n})\n `\n }\n\n return `\nserver.registerTool(${JSON.stringify(tool.name)}, {\n ${config},\n}, async (request) => {\n return ${mcp.name}(request)\n})\n `\n })\n .filter(Boolean)}\n\n <Function name=\"startServer\" async export>\n {`try {\n const transport = new StdioServerTransport()\n await server.connect(transport)\n\n } catch (error) {\n console.error('Failed to start server:', error)\n process.exit(1)\n }`}\n </Function>\n </File.Source>\n )\n}\n","import path from 'node:path'\nimport { resolveOperationTypeNames } from '@internals/shared'\nimport { defineGenerator } from '@kubb/core'\nimport { pluginTsName } from '@kubb/plugin-ts'\nimport { File, jsxRendererSync } from '@kubb/renderer-jsx'\nimport { McpHandler } from '../components/McpHandler.tsx'\nimport type { PluginMcp } from '../types.ts'\n\nexport const mcpGenerator = defineGenerator<PluginMcp>({\n name: 'mcp',\n renderer: jsxRendererSync,\n operation(node, ctx) {\n const { resolver, driver, root } = ctx\n const { output, client, paramsCasing, group } = ctx.options\n\n const pluginTs = driver.getPlugin(pluginTsName)\n\n if (!pluginTs) {\n return null\n }\n\n const tsResolver = driver.getResolver(pluginTsName)\n\n const importedTypeNames = resolveOperationTypeNames(node, tsResolver, { paramsCasing, responseStatusNames: 'error' })\n\n const meta = {\n name: resolver.resolveHandlerName(node),\n file: resolver.resolveFile({ name: node.operationId, extname: '.ts', tag: node.tags[0] ?? 'default', path: node.path }, { root, output, group }),\n fileTs: tsResolver.resolveFile(\n { name: node.operationId, extname: '.ts', tag: node.tags[0] ?? 'default', path: node.path },\n {\n root,\n output: pluginTs.options?.output ?? output,\n group: pluginTs.options?.group,\n },\n ),\n } as const\n\n return (\n <File baseName={meta.file.baseName} path={meta.file.path} meta={meta.file.meta}>\n {meta.fileTs && importedTypeNames.length > 0 && (\n <File.Import name={Array.from(new Set(importedTypeNames)).sort()} root={meta.file.path} path={meta.fileTs.path} isTypeOnly />\n )}\n <File.Import name={['CallToolResult', 'ServerNotification', 'ServerRequest']} path={'@modelcontextprotocol/sdk/types'} isTypeOnly />\n <File.Import name={['RequestHandlerExtra']} path={'@modelcontextprotocol/sdk/shared/protocol'} isTypeOnly />\n <File.Import name={['buildFormData']} root={meta.file.path} path={path.resolve(root, '.kubb/config.ts')} />\n {client.importPath ? (\n <>\n <File.Import name={['Client', 'RequestConfig', 'ResponseErrorConfig']} path={client.importPath} isTypeOnly />\n <File.Import name={'fetch'} path={client.importPath} />\n {client.dataReturnType === 'full' && <File.Import name={['ResponseConfig']} path={client.importPath} isTypeOnly />}\n </>\n ) : (\n <>\n <File.Import\n name={['Client', 'RequestConfig', 'ResponseErrorConfig']}\n root={meta.file.path}\n path={path.resolve(root, '.kubb/fetch.ts')}\n isTypeOnly\n />\n <File.Import name={['fetch']} root={meta.file.path} path={path.resolve(root, '.kubb/fetch.ts')} />\n {client.dataReturnType === 'full' && (\n <File.Import name={['ResponseConfig']} root={meta.file.path} path={path.resolve(root, '.kubb/fetch.ts')} isTypeOnly />\n )}\n </>\n )}\n\n <McpHandler\n name={meta.name}\n node={node}\n resolver={tsResolver}\n baseURL={client.baseURL}\n dataReturnType={client.dataReturnType || 'data'}\n paramsCasing={paramsCasing}\n />\n </File>\n )\n },\n})\n","import path from 'node:path'\nimport { findSuccessStatusCode, getOperationParameters } from '@internals/shared'\nimport { defineGenerator } from '@kubb/core'\nimport { pluginZodName } from '@kubb/plugin-zod'\nimport { File, jsxRendererSync } from '@kubb/renderer-jsx'\nimport { Server } from '../components/Server.tsx'\nimport type { PluginMcp } from '../types.ts'\n\n/**\n * Default v5 server generator for `@kubb/plugin-mcp`.\n *\n * Uses individual zod schemas for each param (e.g. `createPetsPathUuidSchema`, `createPetsQueryOffsetSchema`)\n * and `resolveResponseStatusName` for per-status response schemas.\n * Query and header params are composed into `z.object({ ... })` from individual schemas.\n */\nexport const serverGenerator = defineGenerator<PluginMcp>({\n name: 'operations',\n renderer: jsxRendererSync,\n operations(nodes, ctx) {\n const { config, resolver, plugin, driver, root, inputNode } = ctx\n const { output, paramsCasing, group } = ctx.options\n\n const pluginZod = driver.getPlugin(pluginZodName)\n\n if (!pluginZod) {\n return\n }\n\n const zodResolver = driver.getResolver(pluginZodName)\n\n const name = 'server'\n const serverFilePath = path.resolve(root, output.path, 'server.ts')\n const serverFile = {\n baseName: 'server.ts' as const,\n path: serverFilePath,\n meta: { pluginName: plugin.name },\n }\n\n const jsonFilePath = path.resolve(root, output.path, '.mcp.json')\n const jsonFile = {\n baseName: '.mcp.json' as const,\n path: jsonFilePath,\n meta: { pluginName: plugin.name },\n }\n\n const operationsMapped = nodes.map((node) => {\n const { path: pathParams, query: queryParams, header: headerParams } = getOperationParameters(node, { paramsCasing })\n\n const mcpFile = resolver.resolveFile({ name: node.operationId, extname: '.ts', tag: node.tags[0] ?? 'default', path: node.path }, { root, output, group })\n\n const zodFile = zodResolver.resolveFile(\n { name: node.operationId, extname: '.ts', tag: node.tags[0] ?? 'default', path: node.path },\n {\n root,\n output: pluginZod.options?.output ?? output,\n group: pluginZod.options?.group,\n },\n )\n\n const requestName = node.requestBody?.content?.[0]?.schema ? zodResolver.resolveDataName(node) : undefined\n const successStatus = findSuccessStatusCode(node.responses)\n const responseName = successStatus ? zodResolver.resolveResponseStatusName(node, successStatus) : undefined\n\n const resolveParams = (params: typeof pathParams) => params.map((p) => ({ name: p.name, schemaName: zodResolver.resolveParamName(node, p) }))\n\n return {\n tool: {\n name: node.operationId,\n title: node.summary || undefined,\n description: node.description || `Make a ${node.method.toUpperCase()} request to ${node.path}`,\n },\n mcp: {\n name: resolver.resolveHandlerName(node),\n file: mcpFile,\n },\n zod: {\n pathParams: resolveParams(pathParams),\n queryParams: queryParams.length ? resolveParams(queryParams) : undefined,\n headerParams: headerParams.length ? resolveParams(headerParams) : undefined,\n requestName,\n responseName,\n file: zodFile,\n },\n node: node,\n }\n })\n\n const imports = operationsMapped.flatMap(({ mcp, zod }) => {\n const zodNames = [\n ...zod.pathParams.map((p) => p.schemaName),\n ...(zod.queryParams ?? []).map((p) => p.schemaName),\n ...(zod.headerParams ?? []).map((p) => p.schemaName),\n zod.requestName,\n zod.responseName,\n ].filter((name): name is string => Boolean(name))\n\n const uniqueNames = [...new Set(zodNames)].sort()\n\n return [\n <File.Import key={mcp.name} name={[mcp.name]} root={serverFile.path} path={mcp.file.path} />,\n uniqueNames.length > 0 && <File.Import key={`zod-${mcp.name}`} name={uniqueNames} root={serverFile.path} path={zod.file.path} />,\n ].filter(Boolean)\n })\n\n return (\n <>\n <File\n baseName={serverFile.baseName}\n path={serverFile.path}\n meta={serverFile.meta}\n banner={resolver.resolveBanner(inputNode, { output, config })}\n footer={resolver.resolveFooter(inputNode, { output, config })}\n >\n <File.Import name={['McpServer']} path={'@modelcontextprotocol/sdk/server/mcp'} />\n <File.Import name={['z']} path={'zod'} />\n <File.Import name={['StdioServerTransport']} path={'@modelcontextprotocol/sdk/server/stdio'} />\n\n {imports}\n <Server\n name={name}\n serverName={inputNode.meta?.title ?? 'server'}\n serverVersion={inputNode.meta?.version ?? '0.0.0'}\n paramsCasing={paramsCasing}\n operations={operationsMapped}\n />\n </File>\n\n <File baseName={jsonFile.baseName} path={jsonFile.path} meta={jsonFile.meta}>\n <File.Source name={name}>\n {`\n {\n \"mcpServers\": {\n \"${inputNode.meta?.title || 'server'}\": {\n \"type\": \"stdio\",\n \"command\": \"npx\",\n \"args\": [\"tsx\", \"${path.relative(path.dirname(jsonFile.path), serverFile.path)}\"]\n }\n }\n }\n `}\n </File.Source>\n </File>\n </>\n )\n },\n})\n","import { camelCase } from '@internals/utils'\nimport { defineResolver } from '@kubb/core'\nimport type { PluginMcp } from '../types.ts'\n\n/**\n * Naming convention resolver for MCP plugin.\n *\n * Provides default naming helpers using camelCase with a `handler` suffix for functions.\n *\n * @example\n * `resolverMcp.default('addPet', 'function') // → 'addPetHandler'`\n */\nexport const resolverMcp = defineResolver<PluginMcp>(() => ({\n name: 'default',\n pluginName: 'plugin-mcp',\n default(name, type) {\n if (type === 'file') {\n return camelCase(name, { isFile: true })\n }\n return camelCase(name, { suffix: 'handler' })\n },\n resolveName(name) {\n return this.default(name, 'function')\n },\n resolvePathName(name, type) {\n return this.default(name, type)\n },\n resolveHandlerName(node) {\n return this.resolveName(node.operationId)\n },\n}))\n","import path from 'node:path'\nimport { camelCase } from '@internals/utils'\n\nimport { ast, definePlugin, type Group } from '@kubb/core'\nimport { pluginClientName } from '@kubb/plugin-client'\nimport { source as axiosClientSource } from '@kubb/plugin-client/templates/clients/axios.source'\nimport { source as fetchClientSource } from '@kubb/plugin-client/templates/clients/fetch.source'\nimport { source as configSource } from '@kubb/plugin-client/templates/config.source'\nimport { pluginTsName } from '@kubb/plugin-ts'\nimport { pluginZodName } from '@kubb/plugin-zod'\nimport { mcpGenerator } from './generators/mcpGenerator.tsx'\nimport { serverGenerator } from './generators/serverGenerator.tsx'\nimport { resolverMcp } from './resolvers/resolverMcp.ts'\nimport type { PluginMcp } from './types.ts'\n\nexport const pluginMcpName = 'plugin-mcp' satisfies PluginMcp['name']\n\nexport const pluginMcp = definePlugin<PluginMcp>((options) => {\n const {\n output = { path: 'mcp', barrelType: 'named' },\n group,\n exclude = [],\n include,\n override = [],\n paramsCasing,\n client,\n resolver: userResolver,\n transformer: userTransformer,\n generators: userGenerators = [],\n } = options\n\n const clientName = client?.client ?? 'axios'\n const clientImportPath = client?.importPath ?? (!client?.bundle ? `@kubb/plugin-client/clients/${clientName}` : undefined)\n\n const groupConfig = group\n ? ({\n ...group,\n name: group.name\n ? group.name\n : (ctx: { group: string }) => {\n if (group.type === 'path') {\n return `${ctx.group.split('/')[1]}`\n }\n return `${camelCase(ctx.group)}Requests`\n },\n } satisfies Group)\n : undefined\n\n return {\n name: pluginMcpName,\n options,\n dependencies: [pluginTsName, pluginZodName],\n hooks: {\n 'kubb:plugin:setup'(ctx) {\n const resolver = userResolver ? { ...resolverMcp, ...userResolver } : resolverMcp\n\n ctx.setOptions({\n output,\n exclude,\n include,\n override,\n group: groupConfig,\n paramsCasing,\n client: {\n client: clientName,\n clientType: client?.clientType ?? 'function',\n importPath: clientImportPath,\n dataReturnType: client?.dataReturnType ?? 'data',\n bundle: client?.bundle,\n baseURL: client?.baseURL,\n paramsCasing: client?.paramsCasing,\n },\n resolver,\n })\n ctx.setResolver(resolver)\n if (userTransformer) {\n ctx.setTransformer(userTransformer)\n }\n ctx.addGenerator(mcpGenerator)\n ctx.addGenerator(serverGenerator)\n for (const gen of userGenerators) {\n ctx.addGenerator(gen)\n }\n\n const root = path.resolve(ctx.config.root, ctx.config.output.path)\n const hasClientPlugin = ctx.config.plugins?.some((p) => p.name === pluginClientName)\n\n if (client?.bundle && !hasClientPlugin && !clientImportPath) {\n ctx.injectFile({\n baseName: 'fetch.ts',\n path: path.resolve(root, '.kubb/fetch.ts'),\n sources: [\n ast.createSource({\n name: 'fetch',\n nodes: [ast.createText(clientName === 'fetch' ? fetchClientSource : axiosClientSource)],\n isExportable: true,\n isIndexable: true,\n }),\n ],\n })\n }\n\n if (!hasClientPlugin) {\n ctx.injectFile({\n baseName: 'config.ts',\n path: path.resolve(root, '.kubb/config.ts'),\n sources: [\n ast.createSource({\n name: 'config',\n nodes: [ast.createText(configSource)],\n isExportable: false,\n isIndexable: false,\n }),\n ],\n })\n }\n },\n },\n }\n})\n\nexport default pluginMcp\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAsBA,SAAS,gBAAgB,MAAc,QAAyB;CAS9D,OARmB,KAChB,MAAM,CACN,QAAQ,qBAAqB,QAAQ,CACrC,QAAQ,yBAAyB,QAAQ,CACzC,QAAQ,gBAAgB,QAEH,CAAC,MAAM,gBAAgB,CAAC,OAAO,QAE3C,CACT,KAAK,MAAM,MAAM;EAEhB,IADiB,KAAK,SAAS,KAAK,SAAS,KAAK,aAAa,EACjD,OAAO;EACrB,IAAI,MAAM,KAAK,CAAC,QAAQ,OAAO,KAAK,OAAO,EAAE,CAAC,aAAa,GAAG,KAAK,MAAM,EAAE;EAC3E,OAAO,KAAK,OAAO,EAAE,CAAC,aAAa,GAAG,KAAK,MAAM,EAAE;GACnD,CACD,KAAK,GAAG,CACR,QAAQ,iBAAiB,GAAG;;;;;;;;;;AAWjC,SAAS,iBAAiB,MAAc,eAAkE;CACxG,MAAM,QAAQ,KAAK,MAAM,iBAAiB;CAC1C,OAAO,MAAM,KAAK,MAAM,MAAM,cAAc,MAAM,MAAM,MAAM,SAAS,EAAE,CAAC,CAAC,KAAK,IAAI;;;;;;;;;;AAWtF,SAAgB,UAAU,MAAc,EAAE,QAAQ,SAAS,IAAI,SAAS,OAAgB,EAAE,EAAU;CAClG,IAAI,QACF,OAAO,iBAAi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d,aAAa;KACd,CAAC,CACH;IACF,CAAC;KAGP;EACF;EACD"}
package/extension.yaml CHANGED
@@ -70,7 +70,7 @@ options:
70
70
  type: "{ type: 'named' | 'all', nested?: boolean } | false"
71
71
  required: false
72
72
  default: "{ type: 'named' }"
73
- description: "Configure barrel file export strategy. Use `type` to control named vs. wildcard exports; set `nested: true` to generate hierarchical barrels in subdirectories."
73
+ description: 'Configure barrel file export strategy. Use `type` to control named vs. wildcard exports; set `nested: true` to generate hierarchical barrels in subdirectories.'
74
74
  examples:
75
75
  - name: all
76
76
  files:
@@ -84,6 +84,16 @@ options:
84
84
  code: |
85
85
  export { PetService } from './gen/petService.ts'
86
86
  twoslash: false
87
+ - name: nested
88
+ files:
89
+ - name: kubb.config.ts
90
+ lang: typescript
91
+ code: |
92
+ output: {
93
+ path: './gen',
94
+ barrel: { type: 'named', nested: true },
95
+ }
96
+ twoslash: false
87
97
  - name: 'false'
88
98
  files:
89
99
  - lang: typescript
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kubb/plugin-mcp",
3
- "version": "5.0.0-beta.10",
3
+ "version": "5.0.0-beta.15",
4
4
  "description": "Generate Model Context Protocol (MCP) tool definitions from your OpenAPI specification. Expose your REST APIs as AI-callable tools for LLMs, Claude, ChatGPT, and other AI assistants.",
5
5
  "keywords": [
6
6
  "ai",
@@ -47,18 +47,18 @@
47
47
  "registry": "https://registry.npmjs.org/"
48
48
  },
49
49
  "dependencies": {
50
- "@kubb/core": "5.0.0-beta.10",
51
- "@kubb/renderer-jsx": "5.0.0-beta.10",
52
- "@kubb/plugin-client": "5.0.0-beta.10",
53
- "@kubb/plugin-ts": "5.0.0-beta.10",
54
- "@kubb/plugin-zod": "5.0.0-beta.10"
50
+ "@kubb/core": "5.0.0-beta.19",
51
+ "@kubb/renderer-jsx": "5.0.0-beta.19",
52
+ "@kubb/plugin-client": "5.0.0-beta.15",
53
+ "@kubb/plugin-ts": "5.0.0-beta.15",
54
+ "@kubb/plugin-zod": "5.0.0-beta.15"
55
55
  },
56
56
  "devDependencies": {
57
57
  "@internals/shared": "0.0.0",
58
58
  "@internals/utils": "0.0.0"
59
59
  },
60
60
  "peerDependencies": {
61
- "@kubb/renderer-jsx": "5.0.0-beta.10"
61
+ "@kubb/renderer-jsx": "5.0.0-beta.19"
62
62
  },
63
63
  "size-limit": [
64
64
  {
@@ -2,13 +2,13 @@ import path from 'node:path'
2
2
  import { resolveOperationTypeNames } from '@internals/shared'
3
3
  import { defineGenerator } from '@kubb/core'
4
4
  import { pluginTsName } from '@kubb/plugin-ts'
5
- import { File, jsxRenderer } from '@kubb/renderer-jsx'
5
+ import { File, jsxRendererSync } from '@kubb/renderer-jsx'
6
6
  import { McpHandler } from '../components/McpHandler.tsx'
7
7
  import type { PluginMcp } from '../types.ts'
8
8
 
9
9
  export const mcpGenerator = defineGenerator<PluginMcp>({
10
10
  name: 'mcp',
11
- renderer: jsxRenderer,
11
+ renderer: jsxRendererSync,
12
12
  operation(node, ctx) {
13
13
  const { resolver, driver, root } = ctx
14
14
  const { output, client, paramsCasing, group } = ctx.options
@@ -2,7 +2,7 @@ import path from 'node:path'
2
2
  import { findSuccessStatusCode, getOperationParameters } from '@internals/shared'
3
3
  import { defineGenerator } from '@kubb/core'
4
4
  import { pluginZodName } from '@kubb/plugin-zod'
5
- import { File, jsxRenderer } from '@kubb/renderer-jsx'
5
+ import { File, jsxRendererSync } from '@kubb/renderer-jsx'
6
6
  import { Server } from '../components/Server.tsx'
7
7
  import type { PluginMcp } from '../types.ts'
8
8
 
@@ -15,9 +15,9 @@ import type { PluginMcp } from '../types.ts'
15
15
  */
16
16
  export const serverGenerator = defineGenerator<PluginMcp>({
17
17
  name: 'operations',
18
- renderer: jsxRenderer,
18
+ renderer: jsxRendererSync,
19
19
  operations(nodes, ctx) {
20
- const { adapter, config, resolver, plugin, driver, root } = ctx
20
+ const { config, resolver, plugin, driver, root, inputNode } = ctx
21
21
  const { output, paramsCasing, group } = ctx.options
22
22
 
23
23
  const pluginZod = driver.getPlugin(pluginZodName)
@@ -108,8 +108,8 @@ export const serverGenerator = defineGenerator<PluginMcp>({
108
108
  baseName={serverFile.baseName}
109
109
  path={serverFile.path}
110
110
  meta={serverFile.meta}
111
- banner={resolver.resolveBanner(adapter.inputNode, { output, config })}
112
- footer={resolver.resolveFooter(adapter.inputNode, { output, config })}
111
+ banner={resolver.resolveBanner(inputNode, { output, config })}
112
+ footer={resolver.resolveFooter(inputNode, { output, config })}
113
113
  >
114
114
  <File.Import name={['McpServer']} path={'@modelcontextprotocol/sdk/server/mcp'} />
115
115
  <File.Import name={['z']} path={'zod'} />
@@ -118,8 +118,8 @@ export const serverGenerator = defineGenerator<PluginMcp>({
118
118
  {imports}
119
119
  <Server
120
120
  name={name}
121
- serverName={adapter.inputNode?.meta?.title ?? 'server'}
122
- serverVersion={adapter.inputNode?.meta?.version ?? '0.0.0'}
121
+ serverName={inputNode.meta?.title ?? 'server'}
122
+ serverVersion={inputNode.meta?.version ?? '0.0.0'}
123
123
  paramsCasing={paramsCasing}
124
124
  operations={operationsMapped}
125
125
  />
@@ -130,7 +130,7 @@ export const serverGenerator = defineGenerator<PluginMcp>({
130
130
  {`
131
131
  {
132
132
  "mcpServers": {
133
- "${adapter.inputNode?.meta?.title || 'server'}": {
133
+ "${inputNode.meta?.title || 'server'}": {
134
134
  "type": "stdio",
135
135
  "command": "npx",
136
136
  "args": ["tsx", "${path.relative(path.dirname(jsonFile.path), serverFile.path)}"]