@kubb/plugin-mcp 4.20.3 → 4.21.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (38) hide show
  1. package/dist/{Server-DblKyNZ0.cjs → Server-9nmuwHl0.cjs} +12 -7
  2. package/dist/Server-9nmuwHl0.cjs.map +1 -0
  3. package/dist/{Server-BolLh_dK.js → Server-BCjV50o7.js} +12 -7
  4. package/dist/Server-BCjV50o7.js.map +1 -0
  5. package/dist/components.cjs +1 -1
  6. package/dist/components.d.cts +3 -1
  7. package/dist/components.d.ts +3 -1
  8. package/dist/components.js +1 -1
  9. package/dist/{generators-4PG9gQkq.js → generators-CrC1R2wh.js} +4 -3
  10. package/dist/generators-CrC1R2wh.js.map +1 -0
  11. package/dist/{generators-dnrz3jPX.cjs → generators-DOGoAPGT.cjs} +4 -3
  12. package/dist/generators-DOGoAPGT.cjs.map +1 -0
  13. package/dist/generators.cjs +1 -1
  14. package/dist/generators.d.cts +2 -2
  15. package/dist/generators.d.ts +2 -2
  16. package/dist/generators.js +1 -1
  17. package/dist/index-DNBGPN7Z.d.ts +548 -0
  18. package/dist/index-RsNfvceH.d.cts +549 -0
  19. package/dist/index.cjs +4 -3
  20. package/dist/index.cjs.map +1 -1
  21. package/dist/index.d.cts +4 -3
  22. package/dist/index.d.ts +4 -3
  23. package/dist/index.js +3 -2
  24. package/dist/index.js.map +1 -1
  25. package/dist/{types-BpFIHuV_.d.ts → types-BtFvu11q.d.ts} +14 -4
  26. package/dist/{types-1i7hEdhc.d.cts → types-Bw-588-z.d.cts} +14 -5
  27. package/package.json +8 -8
  28. package/src/components/Server.tsx +7 -5
  29. package/src/generators/mcpGenerator.tsx +1 -1
  30. package/src/generators/serverGenerator.tsx +7 -1
  31. package/src/plugin.ts +2 -0
  32. package/src/types.ts +9 -1
  33. package/dist/Server-BolLh_dK.js.map +0 -1
  34. package/dist/Server-DblKyNZ0.cjs.map +0 -1
  35. package/dist/generators-4PG9gQkq.js.map +0 -1
  36. package/dist/generators-dnrz3jPX.cjs.map +0 -1
  37. package/dist/index-CGe1JmIp.d.cts +0 -1208
  38. package/dist/index-D9FArzes.d.ts +0 -1207
@@ -29,15 +29,17 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
29
29
  }) : target, mod));
30
30
 
31
31
  //#endregion
32
- let _kubb_core_transformers = require("@kubb/core/transformers");
33
32
  let _kubb_plugin_oas_utils = require("@kubb/plugin-oas/utils");
34
33
  let _kubb_react_fabric = require("@kubb/react-fabric");
35
34
  let _kubb_react_fabric_jsx_runtime = require("@kubb/react-fabric/jsx-runtime");
36
35
  let _kubb_oas = require("@kubb/oas");
37
36
 
38
37
  //#region src/components/Server.tsx
39
- function getParams({ schemas }) {
40
- const pathParams = (0, _kubb_plugin_oas_utils.getPathParams)(schemas.pathParams, { typed: false });
38
+ function getParams({ schemas, paramsCasing }) {
39
+ const pathParams = (0, _kubb_plugin_oas_utils.getPathParams)(schemas.pathParams, {
40
+ typed: false,
41
+ casing: paramsCasing
42
+ });
41
43
  return _kubb_react_fabric.FunctionParams.factory({ data: {
42
44
  mode: "object",
43
45
  children: {
@@ -51,7 +53,7 @@ function getParams({ schemas }) {
51
53
  }
52
54
  return {
53
55
  ...acc,
54
- [(0, _kubb_core_transformers.camelCase)(key)]: param
56
+ [key]: param
55
57
  };
56
58
  }, {}),
57
59
  data: schemas.request?.name ? {
@@ -69,7 +71,7 @@ function getParams({ schemas }) {
69
71
  }
70
72
  } });
71
73
  }
72
- function Server({ name, serverName, serverVersion, operations }) {
74
+ function Server({ name, serverName, serverVersion, paramsCasing, operations }) {
73
75
  return /* @__PURE__ */ (0, _kubb_react_fabric_jsx_runtime.jsxs)(_kubb_react_fabric.File.Source, {
74
76
  name,
75
77
  isExportable: true,
@@ -86,7 +88,10 @@ function Server({ name, serverName, serverVersion, operations }) {
86
88
  `
87
89
  }),
88
90
  operations.map(({ tool, mcp, zod }) => {
89
- const paramsClient = getParams({ schemas: zod.schemas });
91
+ const paramsClient = getParams({
92
+ schemas: zod.schemas,
93
+ paramsCasing
94
+ });
90
95
  if (zod.schemas.request?.name || zod.schemas.headerParams?.name || zod.schemas.queryParams?.name || zod.schemas.pathParams?.name) return `
91
96
  server.tool(${JSON.stringify(tool.name)}, ${JSON.stringify(tool.description)}, ${paramsClient.toObjectValue()}, async (${paramsClient.toObject()}) => {
92
97
  return ${mcp.name}(${paramsClient.toObject()})
@@ -135,4 +140,4 @@ Object.defineProperty(exports, '__toESM', {
135
140
  return __toESM;
136
141
  }
137
142
  });
138
- //# sourceMappingURL=Server-DblKyNZ0.cjs.map
143
+ //# sourceMappingURL=Server-9nmuwHl0.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Server-9nmuwHl0.cjs","names":["FunctionParams","File","Const"],"sources":["../src/components/Server.tsx"],"sourcesContent":["import type { KubbFile } from '@kubb/fabric-core/types'\nimport { isNullable, isReference } from '@kubb/oas'\nimport type { OperationSchemas } from '@kubb/plugin-oas'\nimport { getPathParams, isOptional } from '@kubb/plugin-oas/utils'\nimport { Const, File, FunctionParams } from '@kubb/react-fabric'\nimport type { FabricReactNode } from '@kubb/react-fabric/types'\n\ntype Props = {\n name: string\n serverName: string\n serverVersion: string\n paramsCasing?: 'camelcase'\n operations: Array<{\n tool: {\n name: string\n description: string\n }\n mcp: {\n name: string\n file: KubbFile.File\n }\n zod: {\n name: string\n file: KubbFile.File\n schemas: OperationSchemas\n }\n type: {\n schemas: OperationSchemas\n }\n }>\n}\n\ntype GetParamsProps = {\n schemas: OperationSchemas\n paramsCasing?: 'camelcase'\n}\n\nfunction getParams({ schemas, paramsCasing }: GetParamsProps) {\n const pathParams = getPathParams(schemas.pathParams, {\n typed: false,\n casing: paramsCasing,\n })\n\n return FunctionParams.factory({\n data: {\n mode: 'object',\n children: {\n ...Object.entries(pathParams).reduce((acc, [key, param]) => {\n if (param && schemas.pathParams?.name) {\n let suffix = '.shape'\n\n if (isNullable(schemas.pathParams.schema)) {\n if (isReference(schemas.pathParams)) {\n suffix = '.unwrap().schema.unwrap().shape'\n } else {\n suffix = '.unwrap().shape'\n }\n } else {\n if (isReference(schemas.pathParams)) {\n suffix = '.schema.shape'\n }\n }\n\n param.value = `${schemas.pathParams?.name}${suffix}['${key}']`\n }\n\n return {\n ...acc,\n [key]: param,\n }\n }, {}),\n data: schemas.request?.name\n ? {\n value: schemas.request?.name,\n optional: isOptional(schemas.request?.schema),\n }\n : undefined,\n params: schemas.queryParams?.name\n ? {\n value: schemas.queryParams?.name,\n optional: isOptional(schemas.queryParams?.schema),\n }\n : undefined,\n headers: schemas.headerParams?.name\n ? {\n value: schemas.headerParams?.name,\n optional: isOptional(schemas.headerParams?.schema),\n }\n : undefined,\n },\n },\n })\n}\n\nexport function Server({ name, serverName, serverVersion, paramsCasing, operations }: Props): FabricReactNode {\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 }) => {\n const paramsClient = getParams({ schemas: zod.schemas, paramsCasing })\n\n if (zod.schemas.request?.name || zod.schemas.headerParams?.name || zod.schemas.queryParams?.name || zod.schemas.pathParams?.name) {\n return `\nserver.tool(${JSON.stringify(tool.name)}, ${JSON.stringify(tool.description)}, ${paramsClient.toObjectValue()}, async (${paramsClient.toObject()}) => {\n return ${mcp.name}(${paramsClient.toObject()})\n})\n `\n }\n\n return `\nserver.tool(${JSON.stringify(tool.name)}, ${JSON.stringify(tool.description)}, async () => {\n return ${mcp.name}(${paramsClient.toObject()})\n})\n `\n })\n .filter(Boolean)}\n\n {`\nasync function startServer() {\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}\n\nstartServer()\n`}\n </File.Source>\n )\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAqC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Q,YAAY,KAC1H,QAAO;cACL,KAAK,UAAU,KAAK,KAAK,CAAC,IAAI,KAAK,UAAU,KAAK,YAAY,CAAC,IAAI,aAAa,eAAe,CAAC,WAAW,aAAa,UAAU,CAAC;WACtI,IAAI,KAAK,GAAG,aAAa,UAAU,CAAC;;;AAKrC,WAAO;cACH,KAAK,UAAU,KAAK,KAAK,CAAC,IAAI,KAAK,UAAU,KAAK,YAAY,CAAC;WAClE,IAAI,KAAK,GAAG,aAAa,UAAU,CAAC;;;KAGrC,CACD,OAAO,QAAQ;GAEjB;;;;;;;;;;;;;;;GAcW"}
@@ -1,13 +1,15 @@
1
1
  import { t as __name } from "./chunk-eQyhnF5A.js";
2
- import { camelCase } from "@kubb/core/transformers";
3
2
  import { getPathParams, isOptional } from "@kubb/plugin-oas/utils";
4
3
  import { Const, File, FunctionParams } from "@kubb/react-fabric";
5
4
  import { jsx, jsxs } from "@kubb/react-fabric/jsx-runtime";
6
5
  import { isNullable, isReference } from "@kubb/oas";
7
6
 
8
7
  //#region src/components/Server.tsx
9
- function getParams({ schemas }) {
10
- const pathParams = getPathParams(schemas.pathParams, { typed: false });
8
+ function getParams({ schemas, paramsCasing }) {
9
+ const pathParams = getPathParams(schemas.pathParams, {
10
+ typed: false,
11
+ casing: paramsCasing
12
+ });
11
13
  return FunctionParams.factory({ data: {
12
14
  mode: "object",
13
15
  children: {
@@ -21,7 +23,7 @@ function getParams({ schemas }) {
21
23
  }
22
24
  return {
23
25
  ...acc,
24
- [camelCase(key)]: param
26
+ [key]: param
25
27
  };
26
28
  }, {}),
27
29
  data: schemas.request?.name ? {
@@ -39,7 +41,7 @@ function getParams({ schemas }) {
39
41
  }
40
42
  } });
41
43
  }
42
- function Server({ name, serverName, serverVersion, operations }) {
44
+ function Server({ name, serverName, serverVersion, paramsCasing, operations }) {
43
45
  return /* @__PURE__ */ jsxs(File.Source, {
44
46
  name,
45
47
  isExportable: true,
@@ -56,7 +58,10 @@ function Server({ name, serverName, serverVersion, operations }) {
56
58
  `
57
59
  }),
58
60
  operations.map(({ tool, mcp, zod }) => {
59
- const paramsClient = getParams({ schemas: zod.schemas });
61
+ const paramsClient = getParams({
62
+ schemas: zod.schemas,
63
+ paramsCasing
64
+ });
60
65
  if (zod.schemas.request?.name || zod.schemas.headerParams?.name || zod.schemas.queryParams?.name || zod.schemas.pathParams?.name) return `
61
66
  server.tool(${JSON.stringify(tool.name)}, ${JSON.stringify(tool.description)}, ${paramsClient.toObjectValue()}, async (${paramsClient.toObject()}) => {
62
67
  return ${mcp.name}(${paramsClient.toObject()})
@@ -88,4 +93,4 @@ startServer()
88
93
 
89
94
  //#endregion
90
95
  export { Server as t };
91
- //# sourceMappingURL=Server-BolLh_dK.js.map
96
+ //# sourceMappingURL=Server-BCjV50o7.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Server-BCjV50o7.js","names":[],"sources":["../src/components/Server.tsx"],"sourcesContent":["import type { KubbFile } from '@kubb/fabric-core/types'\nimport { isNullable, isReference } from '@kubb/oas'\nimport type { OperationSchemas } from '@kubb/plugin-oas'\nimport { getPathParams, isOptional } from '@kubb/plugin-oas/utils'\nimport { Const, File, FunctionParams } from '@kubb/react-fabric'\nimport type { FabricReactNode } from '@kubb/react-fabric/types'\n\ntype Props = {\n name: string\n serverName: string\n serverVersion: string\n paramsCasing?: 'camelcase'\n operations: Array<{\n tool: {\n name: string\n description: string\n }\n mcp: {\n name: string\n file: KubbFile.File\n }\n zod: {\n name: string\n file: KubbFile.File\n schemas: OperationSchemas\n }\n type: {\n schemas: OperationSchemas\n }\n }>\n}\n\ntype GetParamsProps = {\n schemas: OperationSchemas\n paramsCasing?: 'camelcase'\n}\n\nfunction getParams({ schemas, paramsCasing }: GetParamsProps) {\n const pathParams = getPathParams(schemas.pathParams, {\n typed: false,\n casing: paramsCasing,\n })\n\n return FunctionParams.factory({\n data: {\n mode: 'object',\n children: {\n ...Object.entries(pathParams).reduce((acc, [key, param]) => {\n if (param && schemas.pathParams?.name) {\n let suffix = '.shape'\n\n if (isNullable(schemas.pathParams.schema)) {\n if (isReference(schemas.pathParams)) {\n suffix = '.unwrap().schema.unwrap().shape'\n } else {\n suffix = '.unwrap().shape'\n }\n } else {\n if (isReference(schemas.pathParams)) {\n suffix = '.schema.shape'\n }\n }\n\n param.value = `${schemas.pathParams?.name}${suffix}['${key}']`\n }\n\n return {\n ...acc,\n [key]: param,\n }\n }, {}),\n data: schemas.request?.name\n ? {\n value: schemas.request?.name,\n optional: isOptional(schemas.request?.schema),\n }\n : undefined,\n params: schemas.queryParams?.name\n ? {\n value: schemas.queryParams?.name,\n optional: isOptional(schemas.queryParams?.schema),\n }\n : undefined,\n headers: schemas.headerParams?.name\n ? {\n value: schemas.headerParams?.name,\n optional: isOptional(schemas.headerParams?.schema),\n }\n : undefined,\n },\n },\n })\n}\n\nexport function Server({ name, serverName, serverVersion, paramsCasing, operations }: Props): FabricReactNode {\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 }) => {\n const paramsClient = getParams({ schemas: zod.schemas, paramsCasing })\n\n if (zod.schemas.request?.name || zod.schemas.headerParams?.name || zod.schemas.queryParams?.name || zod.schemas.pathParams?.name) {\n return `\nserver.tool(${JSON.stringify(tool.name)}, ${JSON.stringify(tool.description)}, ${paramsClient.toObjectValue()}, async (${paramsClient.toObject()}) => {\n return ${mcp.name}(${paramsClient.toObject()})\n})\n `\n }\n\n return `\nserver.tool(${JSON.stringify(tool.name)}, ${JSON.stringify(tool.description)}, async () => {\n return ${mcp.name}(${paramsClient.toObject()})\n})\n `\n })\n .filter(Boolean)}\n\n {`\nasync function startServer() {\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}\n\nstartServer()\n`}\n </File.Source>\n )\n}\n"],"mappings":";;;;;;;AAqCA,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AAa,QAAQ,IAAI,QAAQ,YAAY,KAC1H,QAAO;cACL,KAAK,UAAU,KAAK,KAAK,CAAC,IAAI,KAAK,UAAU,KAAK,YAAY,CAAC,IAAI,aAAa,eAAe,CAAC,WAAW,aAAa,UAAU,CAAC;WACtI,IAAI,KAAK,GAAG,aAAa,UAAU,CAAC;;;AAKrC,WAAO;cACH,KAAK,UAAU,KAAK,KAAK,CAAC,IAAI,KAAK,UAAU,KAAK,YAAY,CAAC;WAClE,IAAI,KAAK,GAAG,aAAa,UAAU,CAAC;;;KAGrC,CACD,OAAO,QAAQ;GAEjB;;;;;;;;;;;;;;;GAcW"}
@@ -1,3 +1,3 @@
1
- const require_Server = require('./Server-DblKyNZ0.cjs');
1
+ const require_Server = require('./Server-9nmuwHl0.cjs');
2
2
 
3
3
  exports.Server = require_Server.Server;
@@ -1,4 +1,4 @@
1
- import { a as OperationSchemas, h as __name } from "./index-CGe1JmIp.cjs";
1
+ import { a as OperationSchemas, u as __name } from "./index-RsNfvceH.cjs";
2
2
  import { KubbFile } from "@kubb/fabric-core/types";
3
3
  import { FabricReactNode } from "@kubb/react-fabric/types";
4
4
 
@@ -7,6 +7,7 @@ type Props = {
7
7
  name: string;
8
8
  serverName: string;
9
9
  serverVersion: string;
10
+ paramsCasing?: 'camelcase';
10
11
  operations: Array<{
11
12
  tool: {
12
13
  name: string;
@@ -30,6 +31,7 @@ declare function Server({
30
31
  name,
31
32
  serverName,
32
33
  serverVersion,
34
+ paramsCasing,
33
35
  operations
34
36
  }: Props): FabricReactNode;
35
37
  //#endregion
@@ -1,5 +1,5 @@
1
1
  import { t as __name } from "./chunk-eQyhnF5A.js";
2
- import { a as OperationSchemas } from "./index-D9FArzes.js";
2
+ import { a as OperationSchemas } from "./index-DNBGPN7Z.js";
3
3
  import { KubbFile } from "@kubb/fabric-core/types";
4
4
  import { FabricReactNode } from "@kubb/react-fabric/types";
5
5
 
@@ -8,6 +8,7 @@ type Props = {
8
8
  name: string;
9
9
  serverName: string;
10
10
  serverVersion: string;
11
+ paramsCasing?: 'camelcase';
11
12
  operations: Array<{
12
13
  tool: {
13
14
  name: string;
@@ -31,6 +32,7 @@ declare function Server({
31
32
  name,
32
33
  serverName,
33
34
  serverVersion,
35
+ paramsCasing,
34
36
  operations
35
37
  }: Props): FabricReactNode;
36
38
  //#endregion
@@ -1,3 +1,3 @@
1
- import { t as Server } from "./Server-BolLh_dK.js";
1
+ import { t as Server } from "./Server-BCjV50o7.js";
2
2
 
3
3
  export { Server };
@@ -1,5 +1,5 @@
1
1
  import { t as __name } from "./chunk-eQyhnF5A.js";
2
- import { t as Server } from "./Server-BolLh_dK.js";
2
+ import { t as Server } from "./Server-BCjV50o7.js";
3
3
  import path from "node:path";
4
4
  import { pluginTsName } from "@kubb/plugin-ts";
5
5
  import { pluginZodName } from "@kubb/plugin-zod";
@@ -112,7 +112,7 @@ const mcpGenerator = createReactGenerator({
112
112
  zodSchemas: void 0,
113
113
  dataReturnType: options.client.dataReturnType || "data",
114
114
  paramsType: "object",
115
- paramsCasing: "camelcase",
115
+ paramsCasing: options.client?.paramsCasing || options.paramsCasing,
116
116
  pathParamsType: "object",
117
117
  parser: "client",
118
118
  children: [options.client.dataReturnType === "data" && `return {
@@ -229,6 +229,7 @@ const serverGenerator = createReactGenerator({
229
229
  name,
230
230
  serverName: oas.api.info?.title,
231
231
  serverVersion: oas.getVersion(),
232
+ paramsCasing: options.paramsCasing,
232
233
  operations: operationsMapped
233
234
  })
234
235
  ]
@@ -256,4 +257,4 @@ const serverGenerator = createReactGenerator({
256
257
 
257
258
  //#endregion
258
259
  export { mcpGenerator as n, serverGenerator as t };
259
- //# sourceMappingURL=generators-4PG9gQkq.js.map
260
+ //# sourceMappingURL=generators-CrC1R2wh.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"generators-CrC1R2wh.js","names":[],"sources":["../src/generators/mcpGenerator.tsx","../src/generators/serverGenerator.tsx"],"sourcesContent":["import path from 'node:path'\nimport { Client } from '@kubb/plugin-client/components'\nimport { createReactGenerator } from '@kubb/plugin-oas/generators'\nimport { useOas, useOperationManager } from '@kubb/plugin-oas/hooks'\nimport { getBanner, getFooter } from '@kubb/plugin-oas/utils'\nimport { pluginTsName } from '@kubb/plugin-ts'\nimport { File } from '@kubb/react-fabric'\nimport type { PluginMcp } from '../types'\n\nexport const mcpGenerator = createReactGenerator<PluginMcp>({\n name: 'mcp',\n Operation({ config, operation, generator, plugin }) {\n const { options } = plugin\n const oas = useOas()\n\n const { getSchemas, getName, getFile } = useOperationManager(generator)\n\n const mcp = {\n name: getName(operation, { type: 'function', suffix: 'handler' }),\n file: getFile(operation),\n }\n\n const type = {\n file: getFile(operation, { pluginKey: [pluginTsName] }),\n schemas: getSchemas(operation, { pluginKey: [pluginTsName], type: 'type' }),\n }\n\n return (\n <File\n baseName={mcp.file.baseName}\n path={mcp.file.path}\n meta={mcp.file.meta}\n banner={getBanner({ oas, output: options.output })}\n footer={getFooter({ oas, output: options.output })}\n >\n {options.client.importPath ? (\n <>\n <File.Import name={'fetch'} path={options.client.importPath} />\n <File.Import name={['RequestConfig', 'ResponseErrorConfig']} path={options.client.importPath} isTypeOnly />\n {options.client.dataReturnType === 'full' && <File.Import name={['ResponseConfig']} path={options.client.importPath} isTypeOnly />}\n </>\n ) : (\n <>\n <File.Import name={['fetch']} root={mcp.file.path} path={path.resolve(config.root, config.output.path, '.kubb/fetch.ts')} />\n <File.Import\n name={['RequestConfig', 'ResponseErrorConfig']}\n root={mcp.file.path}\n path={path.resolve(config.root, config.output.path, '.kubb/fetch.ts')}\n isTypeOnly\n />\n {options.client.dataReturnType === 'full' && (\n <File.Import name={['ResponseConfig']} root={mcp.file.path} path={path.resolve(config.root, config.output.path, '.kubb/fetch.ts')} isTypeOnly />\n )}\n </>\n )}\n <File.Import name={['buildFormData']} root={mcp.file.path} path={path.resolve(config.root, config.output.path, '.kubb/config.ts')} />\n <File.Import name={['CallToolResult']} path={'@modelcontextprotocol/sdk/types'} isTypeOnly />\n <File.Import\n name={[\n type.schemas.request?.name,\n type.schemas.response.name,\n type.schemas.pathParams?.name,\n type.schemas.queryParams?.name,\n type.schemas.headerParams?.name,\n ...(type.schemas.statusCodes?.map((item) => item.name) || []),\n ].filter(Boolean)}\n root={mcp.file.path}\n path={type.file.path}\n isTypeOnly\n />\n\n <Client\n name={mcp.name}\n isConfigurable={false}\n returnType={'Promise<CallToolResult>'}\n baseURL={options.client.baseURL}\n operation={operation}\n typeSchemas={type.schemas}\n zodSchemas={undefined}\n dataReturnType={options.client.dataReturnType || 'data'}\n paramsType={'object'}\n paramsCasing={options.client?.paramsCasing || options.paramsCasing}\n pathParamsType={'object'}\n parser={'client'}\n >\n {options.client.dataReturnType === 'data' &&\n `return {\n content: [\n {\n type: 'text',\n text: JSON.stringify(res.data)\n }\n ]\n }`}\n {options.client.dataReturnType === 'full' &&\n `return {\n content: [\n {\n type: 'text',\n text: JSON.stringify(res)\n }\n ]\n }`}\n </Client>\n </File>\n )\n },\n})\n","import { usePluginManager } from '@kubb/core/hooks'\nimport { createReactGenerator } from '@kubb/plugin-oas/generators'\nimport { useOas, useOperationManager } from '@kubb/plugin-oas/hooks'\nimport { getBanner, getFooter } from '@kubb/plugin-oas/utils'\nimport { pluginTsName } from '@kubb/plugin-ts'\nimport { pluginZodName } from '@kubb/plugin-zod'\nimport { File } from '@kubb/react-fabric'\nimport { Server } from '../components/Server'\nimport type { PluginMcp } from '../types'\n\nexport const serverGenerator = createReactGenerator<PluginMcp>({\n name: 'operations',\n Operations({ operations, generator, plugin }) {\n const pluginManager = usePluginManager()\n const { options } = plugin\n\n const oas = useOas()\n const { getFile, getName, getSchemas } = useOperationManager(generator)\n\n const name = 'server'\n const file = pluginManager.getFile({ name, extname: '.ts', pluginKey: plugin.key })\n\n const jsonFile = pluginManager.getFile({ name: '.mcp', extname: '.json', pluginKey: plugin.key })\n\n const operationsMapped = operations.map((operation) => {\n return {\n tool: {\n name: operation.getOperationId() || operation.getSummary() || `${operation.method.toUpperCase()} ${operation.path}`,\n description: operation.getDescription() || `Make a ${operation.method.toUpperCase()} request to ${operation.path}`,\n },\n mcp: {\n name: getName(operation, {\n type: 'function',\n suffix: 'handler',\n }),\n file: getFile(operation),\n },\n zod: {\n name: getName(operation, {\n type: 'function',\n pluginKey: [pluginZodName],\n }),\n schemas: getSchemas(operation, { pluginKey: [pluginZodName], type: 'function' }),\n file: getFile(operation, { pluginKey: [pluginZodName] }),\n },\n type: {\n schemas: getSchemas(operation, { pluginKey: [pluginTsName], type: 'type' }),\n },\n }\n })\n\n const imports = operationsMapped.flatMap(({ mcp, zod }) => {\n return [\n <File.Import key={mcp.name} name={[mcp.name]} root={file.path} path={mcp.file.path} />,\n <File.Import\n key={zod.name}\n name={[zod.schemas.request?.name, zod.schemas.pathParams?.name, zod.schemas.queryParams?.name, zod.schemas.headerParams?.name].filter(Boolean)}\n root={file.path}\n path={zod.file.path}\n />,\n ]\n })\n\n return (\n <>\n <File\n baseName={file.baseName}\n path={file.path}\n meta={file.meta}\n banner={getBanner({ oas, output: options.output, config: pluginManager.config })}\n footer={getFooter({ oas, output: options.output })}\n >\n <File.Import name={['McpServer']} path={'@modelcontextprotocol/sdk/server/mcp'} />\n <File.Import name={['StdioServerTransport']} path={'@modelcontextprotocol/sdk/server/stdio'} />\n\n {imports}\n <Server\n name={name}\n serverName={oas.api.info?.title}\n serverVersion={oas.getVersion()}\n paramsCasing={options.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 \"${oas.api.info?.title || 'server'}\": {\n \"type\": \"stdio\",\n \"command\": \"npx\",\n \"args\": [\"tsx\", \"${file.path}\"]\n }\n }\n }\n `}\n </File.Source>\n </File>\n </>\n )\n },\n})\n"],"mappings":";;;;;;;;;;;;;;AASA,MAAa,eAAe,qBAAgC;CAC1D,MAAM;CACN,UAAU,EAAE,QAAQ,WAAW,WAAW,UAAU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,qBAAC;GACC,UAAU,KAAK;GACf,MAAM,KAAK;GACX,MAAM,KAAK;GACX,QAAQ,UAAU;IAAE;IAAK,QAAQ,QAAQ;IAAQ,QAAQ,cAAc;IAAQ,CAAC;GAChF,QAAQ,UAAU;IAAE;IAAK,QAAQ,QAAQ;IAAQ,CAAC;;IAElD,oBAAC,KAAK;KAAO,MAAM,CAAC,YAAY;KAAE,MAAM;MAA0C;IAClF,oBAAC,KAAK;KAAO,MAAM,CAAC,uBAAuB;KAAE,MAAM;MAA4C;IAE9F;IACD,oBAAC;KACO;KACN,YAAY,IAAI,IAAI,MAAM;KAC1B,eAAe,IAAI,YAAY;KAC/B,cAAc,QAAQ;KACtB,YAAY;MACZ;;IACG,EAEP,oBAAC;GAAK,UAAU,SAAS;GAAU,MAAM,SAAS;GAAM,MAAM,SAAS;aACrE,oBAAC,KAAK;IAAa;cAChB;;;iBAGI,IAAI,IAAI,MAAM,SAAS,SAAS;;;mCAGd,KAAK,KAAK;;;;;KAKrB;IACT,IACN;;CAGR,CAAC"}
@@ -1,4 +1,4 @@
1
- const require_Server = require('./Server-DblKyNZ0.cjs');
1
+ const require_Server = require('./Server-9nmuwHl0.cjs');
2
2
  let node_path = require("node:path");
3
3
  node_path = require_Server.__toESM(node_path);
4
4
  let _kubb_plugin_ts = require("@kubb/plugin-ts");
@@ -112,7 +112,7 @@ const mcpGenerator = (0, _kubb_plugin_oas_generators.createReactGenerator)({
112
112
  zodSchemas: void 0,
113
113
  dataReturnType: options.client.dataReturnType || "data",
114
114
  paramsType: "object",
115
- paramsCasing: "camelcase",
115
+ paramsCasing: options.client?.paramsCasing || options.paramsCasing,
116
116
  pathParamsType: "object",
117
117
  parser: "client",
118
118
  children: [options.client.dataReturnType === "data" && `return {
@@ -229,6 +229,7 @@ const serverGenerator = (0, _kubb_plugin_oas_generators.createReactGenerator)({
229
229
  name,
230
230
  serverName: oas.api.info?.title,
231
231
  serverVersion: oas.getVersion(),
232
+ paramsCasing: options.paramsCasing,
232
233
  operations: operationsMapped
233
234
  })
234
235
  ]
@@ -267,4 +268,4 @@ Object.defineProperty(exports, 'serverGenerator', {
267
268
  return serverGenerator;
268
269
  }
269
270
  });
270
- //# sourceMappingURL=generators-dnrz3jPX.cjs.map
271
+ //# sourceMappingURL=generators-DOGoAPGT.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"generators-DOGoAPGT.cjs","names":["pluginTsName","File","path","Client","pluginZodName","pluginTsName","File","Server"],"sources":["../src/generators/mcpGenerator.tsx","../src/generators/serverGenerator.tsx"],"sourcesContent":["import path from 'node:path'\nimport { Client } from '@kubb/plugin-client/components'\nimport { createReactGenerator } from '@kubb/plugin-oas/generators'\nimport { useOas, useOperationManager } from '@kubb/plugin-oas/hooks'\nimport { getBanner, getFooter } from '@kubb/plugin-oas/utils'\nimport { pluginTsName } from '@kubb/plugin-ts'\nimport { File } from '@kubb/react-fabric'\nimport type { PluginMcp } from '../types'\n\nexport const mcpGenerator = createReactGenerator<PluginMcp>({\n name: 'mcp',\n Operation({ config, operation, generator, plugin }) {\n const { options } = plugin\n const oas = useOas()\n\n const { getSchemas, getName, getFile } = useOperationManager(generator)\n\n const mcp = {\n name: getName(operation, { type: 'function', suffix: 'handler' }),\n file: getFile(operation),\n }\n\n const type = {\n file: getFile(operation, { pluginKey: [pluginTsName] }),\n schemas: getSchemas(operation, { pluginKey: [pluginTsName], type: 'type' }),\n }\n\n return (\n <File\n baseName={mcp.file.baseName}\n path={mcp.file.path}\n meta={mcp.file.meta}\n banner={getBanner({ oas, output: options.output })}\n footer={getFooter({ oas, output: options.output })}\n >\n {options.client.importPath ? (\n <>\n <File.Import name={'fetch'} path={options.client.importPath} />\n <File.Import name={['RequestConfig', 'ResponseErrorConfig']} path={options.client.importPath} isTypeOnly />\n {options.client.dataReturnType === 'full' && <File.Import name={['ResponseConfig']} path={options.client.importPath} isTypeOnly />}\n </>\n ) : (\n <>\n <File.Import name={['fetch']} root={mcp.file.path} path={path.resolve(config.root, config.output.path, '.kubb/fetch.ts')} />\n <File.Import\n name={['RequestConfig', 'ResponseErrorConfig']}\n root={mcp.file.path}\n path={path.resolve(config.root, config.output.path, '.kubb/fetch.ts')}\n isTypeOnly\n />\n {options.client.dataReturnType === 'full' && (\n <File.Import name={['ResponseConfig']} root={mcp.file.path} path={path.resolve(config.root, config.output.path, '.kubb/fetch.ts')} isTypeOnly />\n )}\n </>\n )}\n <File.Import name={['buildFormData']} root={mcp.file.path} path={path.resolve(config.root, config.output.path, '.kubb/config.ts')} />\n <File.Import name={['CallToolResult']} path={'@modelcontextprotocol/sdk/types'} isTypeOnly />\n <File.Import\n name={[\n type.schemas.request?.name,\n type.schemas.response.name,\n type.schemas.pathParams?.name,\n type.schemas.queryParams?.name,\n type.schemas.headerParams?.name,\n ...(type.schemas.statusCodes?.map((item) => item.name) || []),\n ].filter(Boolean)}\n root={mcp.file.path}\n path={type.file.path}\n isTypeOnly\n />\n\n <Client\n name={mcp.name}\n isConfigurable={false}\n returnType={'Promise<CallToolResult>'}\n baseURL={options.client.baseURL}\n operation={operation}\n typeSchemas={type.schemas}\n zodSchemas={undefined}\n dataReturnType={options.client.dataReturnType || 'data'}\n paramsType={'object'}\n paramsCasing={options.client?.paramsCasing || options.paramsCasing}\n pathParamsType={'object'}\n parser={'client'}\n >\n {options.client.dataReturnType === 'data' &&\n `return {\n content: [\n {\n type: 'text',\n text: JSON.stringify(res.data)\n }\n ]\n }`}\n {options.client.dataReturnType === 'full' &&\n `return {\n content: [\n {\n type: 'text',\n text: JSON.stringify(res)\n }\n ]\n }`}\n </Client>\n </File>\n )\n },\n})\n","import { usePluginManager } from '@kubb/core/hooks'\nimport { createReactGenerator } from '@kubb/plugin-oas/generators'\nimport { useOas, useOperationManager } from '@kubb/plugin-oas/hooks'\nimport { getBanner, getFooter } from '@kubb/plugin-oas/utils'\nimport { pluginTsName } from '@kubb/plugin-ts'\nimport { pluginZodName } from '@kubb/plugin-zod'\nimport { File } from '@kubb/react-fabric'\nimport { Server } from '../components/Server'\nimport type { PluginMcp } from '../types'\n\nexport const serverGenerator = createReactGenerator<PluginMcp>({\n name: 'operations',\n Operations({ operations, generator, plugin }) {\n const pluginManager = usePluginManager()\n const { options } = plugin\n\n const oas = useOas()\n const { getFile, getName, getSchemas } = useOperationManager(generator)\n\n const name = 'server'\n const file = pluginManager.getFile({ name, extname: '.ts', pluginKey: plugin.key })\n\n const jsonFile = pluginManager.getFile({ name: '.mcp', extname: '.json', pluginKey: plugin.key })\n\n const operationsMapped = operations.map((operation) => {\n return {\n tool: {\n name: operation.getOperationId() || operation.getSummary() || `${operation.method.toUpperCase()} ${operation.path}`,\n description: operation.getDescription() || `Make a ${operation.method.toUpperCase()} request to ${operation.path}`,\n },\n mcp: {\n name: getName(operation, {\n type: 'function',\n suffix: 'handler',\n }),\n file: getFile(operation),\n },\n zod: {\n name: getName(operation, {\n type: 'function',\n pluginKey: [pluginZodName],\n }),\n schemas: getSchemas(operation, { pluginKey: [pluginZodName], type: 'function' }),\n file: getFile(operation, { pluginKey: [pluginZodName] }),\n },\n type: {\n schemas: getSchemas(operation, { pluginKey: [pluginTsName], type: 'type' }),\n },\n }\n })\n\n const imports = operationsMapped.flatMap(({ mcp, zod }) => {\n return [\n <File.Import key={mcp.name} name={[mcp.name]} root={file.path} path={mcp.file.path} />,\n <File.Import\n key={zod.name}\n name={[zod.schemas.request?.name, zod.schemas.pathParams?.name, zod.schemas.queryParams?.name, zod.schemas.headerParams?.name].filter(Boolean)}\n root={file.path}\n path={zod.file.path}\n />,\n ]\n })\n\n return (\n <>\n <File\n baseName={file.baseName}\n path={file.path}\n meta={file.meta}\n banner={getBanner({ oas, output: options.output, config: pluginManager.config })}\n footer={getFooter({ oas, output: options.output })}\n >\n <File.Import name={['McpServer']} path={'@modelcontextprotocol/sdk/server/mcp'} />\n <File.Import name={['StdioServerTransport']} path={'@modelcontextprotocol/sdk/server/stdio'} />\n\n {imports}\n <Server\n name={name}\n serverName={oas.api.info?.title}\n serverVersion={oas.getVersion()}\n paramsCasing={options.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 \"${oas.api.info?.title || 'server'}\": {\n \"type\": \"stdio\",\n \"command\": \"npx\",\n \"args\": [\"tsx\", \"${file.path}\"]\n }\n }\n }\n `}\n </File.Source>\n </File>\n </>\n )\n },\n})\n"],"mappings":";;;;;;;;;;;;;;AASA,MAAa,qEAA+C;CAC1D,MAAM;CACN,UAAU,EAAE,QAAQ,WAAW,WAAW,UAAU;EAClD,MAAM,EAAE,YAAY;EACpB,MAAM,0CAAc;EAEpB,MAAM,EAAE,YAAY,SAAS,4DAAgC,UAAU;EAEvE,MAAM,MAAM;GACV,MAAM,QAAQ,WAAW;IAAE,MAAM;IAAY,QAAQ;IAAW,CAAC;GACjE,MAAM,QAAQ,UAAU;GACzB;EAED,MAAM,OAAO;GACX,MAAM,QAAQ,WAAW,EAAE,WAAW,CAACA,6BAAa,EAAE,CAAC;GACvD,SAAS,WAAW,WAAW;IAAE,WAAW,CAACA,6BAAa;IAAE,MAAM;IAAQ,CAAC;GAC5E;AAED,SACE,yDAACC;GACC,UAAU,IAAI,KAAK;GACnB,MAAM,IAAI,KAAK;GACf,MAAM,IAAI,KAAK;GACf,8CAAkB;IAAE;IAAK,QAAQ,QAAQ;IAAQ,CAAC;GAClD,8CAAkB;IAAE;IAAK,QAAQ,QAAQ;IAAQ,CAAC;;IAEjD,QAAQ,OAAO,aACd;KACE,wDAACA,wBAAK;MAAO,MAAM;MAAS,MAAM,QAAQ,OAAO;OAAc;KAC/D,wDAACA,wBAAK;MAAO,MAAM,CAAC,iBAAiB,sBAAsB;MAAE,MAAM,QAAQ,OAAO;MAAY;OAAa;KAC1G,QAAQ,OAAO,mBAAmB,UAAU,wDAACA,wBAAK;MAAO,MAAM,CAAC,iBAAiB;MAAE,MAAM,QAAQ,OAAO;MAAY;OAAa;Q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CACL,wDAACC,wBAAK;IAAsB,MAAM,CAAC,IAAI,KAAK;IAAE,MAAM,KAAK;IAAM,MAAM,IAAI,KAAK;MAA5D,IAAI,KAAgE,EACtF,wDAACA,wBAAK;IAEJ,MAAM;KAAC,IAAI,QAAQ,SAAS;KAAM,IAAI,QAAQ,YAAY;KAAM,IAAI,QAAQ,aAAa;KAAM,IAAI,QAAQ,cAAc;KAAK,CAAC,OAAO,QAAQ;IAC9I,MAAM,KAAK;IACX,MAAM,IAAI,KAAK;MAHV,IAAI,KAIT,CACH;IACD;AAEF,SACE,+GACE,yDAACA;GACC,UAAU,KAAK;GACf,MAAM,KAAK;GACX,MAAM,KAAK;GACX,8CAAkB;IAAE;IAAK,QAAQ,QAAQ;IAAQ,QAAQ,cAAc;IAAQ,CAAC;GAChF,8CAAkB;IAAE;IAAK,QAAQ,QAAQ;IAAQ,CAAC;;IAElD,wDAACA,wBAAK;KAAO,MAAM,CAAC,YAAY;KAAE,MAAM;MAA0C;IAClF,wDAACA,wBAAK;KAAO,MAAM,CAAC,uBAAuB;KAAE,MAAM;MAA4C;IAE9F;IACD,wDAACC;KACO;KACN,YAAY,IAAI,IAAI,MAAM;KAC1B,eAAe,IAAI,YAAY;KAC/B,cAAc,QAAQ;KACtB,YAAY;MACZ;;IACG,EAEP,wDAACD;GAAK,UAAU,SAAS;GAAU,MAAM,SAAS;GAAM,MAAM,SAAS;aACrE,wDAACA,wBAAK;IAAa;cAChB;;;iBAGI,IAAI,IAAI,MAAM,SAAS,SAAS;;;mCAGd,KAAK,KAAK;;;;;KAKrB;IACT,IACN;;CAGR,CAAC"}
@@ -1,4 +1,4 @@
1
- const require_generators = require('./generators-dnrz3jPX.cjs');
1
+ const require_generators = require('./generators-DOGoAPGT.cjs');
2
2
 
3
3
  exports.mcpGenerator = require_generators.mcpGenerator;
4
4
  exports.serverGenerator = require_generators.serverGenerator;
@@ -1,5 +1,5 @@
1
- import { h as __name, n as ReactGenerator } from "./index-CGe1JmIp.cjs";
2
- import { n as PluginMcp } from "./types-1i7hEdhc.cjs";
1
+ import { n as ReactGenerator, u as __name } from "./index-RsNfvceH.cjs";
2
+ import { n as PluginMcp } from "./types-Bw-588-z.cjs";
3
3
 
4
4
  //#region src/generators/mcpGenerator.d.ts
5
5
  declare const mcpGenerator: ReactGenerator<PluginMcp>;
@@ -1,6 +1,6 @@
1
1
  import { t as __name } from "./chunk-eQyhnF5A.js";
2
- import { n as ReactGenerator } from "./index-D9FArzes.js";
3
- import { n as PluginMcp } from "./types-BpFIHuV_.js";
2
+ import { n as ReactGenerator } from "./index-DNBGPN7Z.js";
3
+ import { n as PluginMcp } from "./types-BtFvu11q.js";
4
4
 
5
5
  //#region src/generators/mcpGenerator.d.ts
6
6
  declare const mcpGenerator: ReactGenerator<PluginMcp>;
@@ -1,3 +1,3 @@
1
- import { n as mcpGenerator, t as serverGenerator } from "./generators-4PG9gQkq.js";
1
+ import { n as mcpGenerator, t as serverGenerator } from "./generators-CrC1R2wh.js";
2
2
 
3
3
  export { mcpGenerator, serverGenerator };