@kubb/agent 5.0.0-alpha.35 → 5.0.0-alpha.36

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 (180) hide show
  1. package/.output/nitro.json +1 -1
  2. package/.output/server/chunks/nitro/nitro.mjs +1293 -20554
  3. package/.output/server/chunks/nitro/nitro.mjs.map +1 -1
  4. package/.output/server/chunks/routes/api/health.get.mjs +16 -14
  5. package/.output/server/chunks/routes/api/health.get.mjs.map +1 -1
  6. package/.output/server/index.mjs +16 -14
  7. package/.output/server/index.mjs.map +1 -1
  8. package/.output/server/node_modules/.nitro/ws@8.18.0/lib/constants.js +18 -0
  9. package/.output/server/node_modules/.nitro/ws@8.18.0/lib/permessage-deflate.js +514 -0
  10. package/.output/server/node_modules/.nitro/ws@8.18.0/lib/sender.js +602 -0
  11. package/.output/server/node_modules/.nitro/ws@8.18.0/lib/stream.js +159 -0
  12. package/.output/server/node_modules/.nitro/ws@8.18.0/lib/websocket-server.js +540 -0
  13. package/.output/server/node_modules/.nitro/ws@8.18.0/lib/websocket.js +1388 -0
  14. package/.output/server/node_modules/.nitro/ws@8.18.0/package.json +69 -0
  15. package/.output/server/node_modules/.nitro/ws@8.18.0/wrapper.mjs +8 -0
  16. package/.output/server/node_modules/.nitro/ws@8.20.0/lib/buffer-util.js +131 -0
  17. package/.output/server/node_modules/.nitro/ws@8.20.0/lib/event-target.js +292 -0
  18. package/.output/server/node_modules/.nitro/ws@8.20.0/lib/extension.js +203 -0
  19. package/.output/server/node_modules/.nitro/ws@8.20.0/lib/limiter.js +55 -0
  20. package/.output/server/node_modules/.nitro/ws@8.20.0/lib/receiver.js +706 -0
  21. package/.output/server/node_modules/.nitro/ws@8.20.0/lib/subprotocol.js +62 -0
  22. package/.output/server/node_modules/.nitro/ws@8.20.0/lib/validation.js +152 -0
  23. package/.output/server/node_modules/@clack/core/dist/index.mjs +11 -0
  24. package/.output/server/node_modules/@clack/core/package.json +60 -0
  25. package/.output/server/node_modules/@clack/prompts/dist/index.mjs +137 -0
  26. package/.output/server/node_modules/@clack/prompts/package.json +65 -0
  27. package/.output/server/node_modules/@kubb/ast/dist/chunk--u3MIqq1.js +8 -0
  28. package/.output/server/node_modules/@kubb/ast/dist/index.js +423 -0
  29. package/.output/server/node_modules/@kubb/ast/package.json +70 -0
  30. package/.output/server/node_modules/@kubb/core/dist/chunk--u3MIqq1.js +8 -0
  31. package/.output/server/node_modules/@kubb/core/dist/hooks.js +23 -0
  32. package/.output/server/node_modules/@kubb/core/dist/index.js +2311 -0
  33. package/.output/server/node_modules/@kubb/core/package.json +109 -0
  34. package/.output/server/node_modules/@kubb/fabric-core/dist/chunk-O_arW02_.js +17 -0
  35. package/.output/server/node_modules/@kubb/fabric-core/dist/defaultParser-iCpMSYCp.js +15 -0
  36. package/.output/server/node_modules/@kubb/fabric-core/dist/getRelativePath-NAm_Y-vp.js +55 -0
  37. package/.output/server/node_modules/@kubb/fabric-core/dist/index.js +653 -0
  38. package/.output/server/node_modules/@kubb/fabric-core/dist/onProcessExit-Cput7j2c.js +742 -0
  39. package/.output/server/node_modules/@kubb/fabric-core/dist/parsers/typescript.js +101 -0
  40. package/.output/server/node_modules/@kubb/fabric-core/dist/parsers.js +17 -0
  41. package/.output/server/node_modules/@kubb/fabric-core/dist/plugins.js +375 -0
  42. package/.output/server/node_modules/@kubb/fabric-core/package.json +111 -0
  43. package/.output/server/node_modules/@kubb/oas/dist/chunk--u3MIqq1.js +8 -0
  44. package/.output/server/node_modules/@kubb/oas/dist/index.js +918 -0
  45. package/.output/server/node_modules/@kubb/oas/package.json +94 -0
  46. package/.output/server/node_modules/@kubb/plugin-client/dist/StaticClassClient-bCe7RG_w.js +636 -0
  47. package/.output/server/node_modules/@kubb/plugin-client/dist/chunk--u3MIqq1.js +8 -0
  48. package/.output/server/node_modules/@kubb/plugin-client/dist/components.js +2 -0
  49. package/.output/server/node_modules/@kubb/plugin-client/dist/generators-BffddRNu.js +723 -0
  50. package/.output/server/node_modules/@kubb/plugin-client/dist/index.js +124 -0
  51. package/.output/server/node_modules/@kubb/plugin-client/dist/templates/clients/axios.source.js +6 -0
  52. package/.output/server/node_modules/@kubb/plugin-client/dist/templates/clients/fetch.source.js +6 -0
  53. package/.output/server/node_modules/@kubb/plugin-client/dist/templates/config.source.js +6 -0
  54. package/.output/server/node_modules/@kubb/plugin-client/package.json +153 -0
  55. package/.output/server/node_modules/@kubb/plugin-cypress/dist/chunk--u3MIqq1.js +8 -0
  56. package/.output/server/node_modules/@kubb/plugin-cypress/dist/components-BK_6GU4v.js +257 -0
  57. package/.output/server/node_modules/@kubb/plugin-cypress/dist/generators-D5YFtyyC.js +71 -0
  58. package/.output/server/node_modules/@kubb/plugin-cypress/dist/index.js +79 -0
  59. package/.output/server/node_modules/@kubb/plugin-cypress/package.json +108 -0
  60. package/.output/server/node_modules/@kubb/plugin-faker/dist/chunk--u3MIqq1.js +8 -0
  61. package/.output/server/node_modules/@kubb/plugin-faker/dist/components-BkBIov4R.js +419 -0
  62. package/.output/server/node_modules/@kubb/plugin-faker/dist/fakerGenerator-BztogaeO.js +200 -0
  63. package/.output/server/node_modules/@kubb/plugin-faker/dist/index.js +141 -0
  64. package/.output/server/node_modules/@kubb/plugin-faker/package.json +103 -0
  65. package/.output/server/node_modules/@kubb/plugin-mcp/dist/Server-H3SwqhwF.js +178 -0
  66. package/.output/server/node_modules/@kubb/plugin-mcp/dist/chunk--u3MIqq1.js +8 -0
  67. package/.output/server/node_modules/@kubb/plugin-mcp/dist/generators-BqkMrcs9.js +274 -0
  68. package/.output/server/node_modules/@kubb/plugin-mcp/dist/index.js +122 -0
  69. package/.output/server/node_modules/@kubb/plugin-mcp/package.json +107 -0
  70. package/.output/server/node_modules/@kubb/plugin-msw/dist/chunk--u3MIqq1.js +8 -0
  71. package/.output/server/node_modules/@kubb/plugin-msw/dist/components-DgtTZkWX.js +277 -0
  72. package/.output/server/node_modules/@kubb/plugin-msw/dist/generators-C34kqa1L.js +161 -0
  73. package/.output/server/node_modules/@kubb/plugin-msw/dist/index.js +84 -0
  74. package/.output/server/node_modules/@kubb/plugin-msw/package.json +109 -0
  75. package/.output/server/node_modules/@kubb/plugin-oas/dist/SchemaMapper-CqMkO2T1.js +58 -0
  76. package/.output/server/node_modules/@kubb/plugin-oas/dist/chunk--u3MIqq1.js +8 -0
  77. package/.output/server/node_modules/@kubb/plugin-oas/dist/generators-D7C3CXsN.js +79 -0
  78. package/.output/server/node_modules/@kubb/plugin-oas/dist/generators.js +2 -0
  79. package/.output/server/node_modules/@kubb/plugin-oas/dist/getFooter-Pw3tLCiV.js +112 -0
  80. package/.output/server/node_modules/@kubb/plugin-oas/dist/hooks.js +200 -0
  81. package/.output/server/node_modules/@kubb/plugin-oas/dist/index.js +408 -0
  82. package/.output/server/node_modules/@kubb/plugin-oas/dist/requestBody-pRavthCw.js +1336 -0
  83. package/.output/server/node_modules/@kubb/plugin-oas/dist/utils.js +268 -0
  84. package/.output/server/node_modules/@kubb/plugin-oas/package.json +122 -0
  85. package/.output/server/node_modules/@kubb/plugin-react-query/dist/chunk--u3MIqq1.js +8 -0
  86. package/.output/server/node_modules/@kubb/plugin-react-query/dist/components-CpyHYGOw.js +1520 -0
  87. package/.output/server/node_modules/@kubb/plugin-react-query/dist/generators-CpiBv5eE.js +1427 -0
  88. package/.output/server/node_modules/@kubb/plugin-react-query/dist/index.js +166 -0
  89. package/.output/server/node_modules/@kubb/plugin-react-query/package.json +112 -0
  90. package/.output/server/node_modules/@kubb/plugin-redoc/dist/chunk--u3MIqq1.js +8 -0
  91. package/.output/server/node_modules/@kubb/plugin-redoc/dist/index.js +65 -0
  92. package/.output/server/node_modules/@kubb/plugin-redoc/package.json +85 -0
  93. package/.output/server/node_modules/@kubb/plugin-redoc/static/redoc.hbs +22 -0
  94. package/.output/server/node_modules/@kubb/plugin-solid-query/dist/chunk--u3MIqq1.js +8 -0
  95. package/.output/server/node_modules/@kubb/plugin-solid-query/dist/components-BhStIi1M.js +665 -0
  96. package/.output/server/node_modules/@kubb/plugin-solid-query/dist/generators-CQClzsST.js +415 -0
  97. package/.output/server/node_modules/@kubb/plugin-solid-query/dist/index.js +145 -0
  98. package/.output/server/node_modules/@kubb/plugin-solid-query/package.json +113 -0
  99. package/.output/server/node_modules/@kubb/plugin-svelte-query/dist/chunk--u3MIqq1.js +8 -0
  100. package/.output/server/node_modules/@kubb/plugin-svelte-query/dist/components-DntKBsnB.js +666 -0
  101. package/.output/server/node_modules/@kubb/plugin-svelte-query/dist/generators-BtTsGGrM.js +414 -0
  102. package/.output/server/node_modules/@kubb/plugin-svelte-query/dist/index.js +145 -0
  103. package/.output/server/node_modules/@kubb/plugin-svelte-query/package.json +113 -0
  104. package/.output/server/node_modules/@kubb/plugin-swr/dist/chunk--u3MIqq1.js +8 -0
  105. package/.output/server/node_modules/@kubb/plugin-swr/dist/components-DRDGvgXG.js +702 -0
  106. package/.output/server/node_modules/@kubb/plugin-swr/dist/generators-ClWZJ-YG.js +399 -0
  107. package/.output/server/node_modules/@kubb/plugin-swr/dist/index.js +144 -0
  108. package/.output/server/node_modules/@kubb/plugin-swr/package.json +115 -0
  109. package/.output/server/node_modules/@kubb/plugin-ts/dist/chunk--u3MIqq1.js +8 -0
  110. package/.output/server/node_modules/@kubb/plugin-ts/dist/components-C7fu-sK1.js +723 -0
  111. package/.output/server/node_modules/@kubb/plugin-ts/dist/index.js +2 -0
  112. package/.output/server/node_modules/@kubb/plugin-ts/dist/plugin-CYC-FGXe.js +479 -0
  113. package/.output/server/node_modules/@kubb/plugin-ts/package.json +105 -0
  114. package/.output/server/node_modules/@kubb/plugin-vue-query/dist/chunk--u3MIqq1.js +8 -0
  115. package/.output/server/node_modules/@kubb/plugin-vue-query/dist/components-_AMBl0g-.js +1029 -0
  116. package/.output/server/node_modules/@kubb/plugin-vue-query/dist/generators-Zb1s5Wmb.js +661 -0
  117. package/.output/server/node_modules/@kubb/plugin-vue-query/dist/index.js +157 -0
  118. package/.output/server/node_modules/@kubb/plugin-vue-query/package.json +114 -0
  119. package/.output/server/node_modules/@kubb/plugin-zod/dist/chunk--u3MIqq1.js +8 -0
  120. package/.output/server/node_modules/@kubb/plugin-zod/dist/components-eECfXVou.js +842 -0
  121. package/.output/server/node_modules/@kubb/plugin-zod/dist/generators-D1R6NNf2.js +290 -0
  122. package/.output/server/node_modules/@kubb/plugin-zod/dist/index.js +175 -0
  123. package/.output/server/node_modules/@kubb/plugin-zod/dist/templates/ToZod.source.js +6 -0
  124. package/.output/server/node_modules/@kubb/plugin-zod/package.json +112 -0
  125. package/.output/server/node_modules/@kubb/react-fabric/dist/chunk-BGCRLu6H.js +38 -0
  126. package/.output/server/node_modules/@kubb/react-fabric/dist/index.js +525 -0
  127. package/.output/server/node_modules/@kubb/react-fabric/dist/jsx-runtime-Bl0DfUmV.js +1448 -0
  128. package/.output/server/node_modules/@kubb/react-fabric/dist/jsx-runtime.js +12 -0
  129. package/.output/server/node_modules/@kubb/react-fabric/dist/parsers.js +2 -0
  130. package/.output/server/node_modules/@kubb/react-fabric/dist/plugins.js +4 -0
  131. package/.output/server/node_modules/@kubb/react-fabric/dist/reactPlugin-QQPrjNuQ.js +17813 -0
  132. package/.output/server/node_modules/@kubb/react-fabric/package.json +143 -0
  133. package/.output/server/node_modules/buffer-from/index.js +72 -0
  134. package/.output/server/node_modules/buffer-from/package.json +19 -0
  135. package/.output/server/node_modules/empathic/access.js +39 -0
  136. package/.output/server/node_modules/empathic/access.mjs +34 -0
  137. package/.output/server/node_modules/empathic/find.js +81 -0
  138. package/.output/server/node_modules/empathic/find.mjs +76 -0
  139. package/.output/server/node_modules/empathic/package.json +49 -0
  140. package/.output/server/node_modules/empathic/package.mjs +52 -0
  141. package/.output/server/node_modules/empathic/resolve.js +31 -0
  142. package/.output/server/node_modules/empathic/resolve.mjs +27 -0
  143. package/.output/server/node_modules/empathic/walk.js +22 -0
  144. package/.output/server/node_modules/empathic/walk.mjs +20 -0
  145. package/.output/server/node_modules/fast-string-truncated-width/dist/index.js +171 -0
  146. package/.output/server/node_modules/fast-string-truncated-width/dist/utils.js +15 -0
  147. package/.output/server/node_modules/fast-string-truncated-width/package.json +35 -0
  148. package/.output/server/node_modules/fast-string-width/dist/index.js +14 -0
  149. package/.output/server/node_modules/fast-string-width/package.json +34 -0
  150. package/.output/server/node_modules/fast-wrap-ansi/lib/main.js +216 -0
  151. package/.output/server/node_modules/fast-wrap-ansi/package.json +51 -0
  152. package/.output/server/node_modules/p-limit/index.js +127 -0
  153. package/.output/server/node_modules/p-limit/package.json +58 -0
  154. package/.output/server/node_modules/react-devtools-core/dist/backend.js +18302 -0
  155. package/.output/server/node_modules/react-devtools-core/package.json +38 -0
  156. package/.output/server/node_modules/sisteransi/package.json +34 -0
  157. package/.output/server/node_modules/sisteransi/src/index.js +58 -0
  158. package/.output/server/node_modules/source-map-support/package.json +31 -0
  159. package/.output/server/node_modules/source-map-support/source-map-support.js +625 -0
  160. package/.output/server/node_modules/typescript/lib/typescript.js +200276 -0
  161. package/.output/server/node_modules/typescript/package.json +120 -0
  162. package/.output/server/node_modules/yocto-queue/index.js +90 -0
  163. package/.output/server/node_modules/yocto-queue/package.json +48 -0
  164. package/.output/server/package.json +34 -2
  165. package/package.json +20 -20
  166. /package/.output/server/node_modules/{ws → .nitro/ws@8.18.0}/lib/buffer-util.js +0 -0
  167. /package/.output/server/node_modules/{ws → .nitro/ws@8.18.0}/lib/event-target.js +0 -0
  168. /package/.output/server/node_modules/{ws → .nitro/ws@8.18.0}/lib/extension.js +0 -0
  169. /package/.output/server/node_modules/{ws → .nitro/ws@8.18.0}/lib/limiter.js +0 -0
  170. /package/.output/server/node_modules/{ws → .nitro/ws@8.18.0}/lib/receiver.js +0 -0
  171. /package/.output/server/node_modules/{ws → .nitro/ws@8.18.0}/lib/subprotocol.js +0 -0
  172. /package/.output/server/node_modules/{ws → .nitro/ws@8.18.0}/lib/validation.js +0 -0
  173. /package/.output/server/node_modules/{ws → .nitro/ws@8.20.0}/lib/constants.js +0 -0
  174. /package/.output/server/node_modules/{ws → .nitro/ws@8.20.0}/lib/permessage-deflate.js +0 -0
  175. /package/.output/server/node_modules/{ws → .nitro/ws@8.20.0}/lib/sender.js +0 -0
  176. /package/.output/server/node_modules/{ws → .nitro/ws@8.20.0}/lib/stream.js +0 -0
  177. /package/.output/server/node_modules/{ws → .nitro/ws@8.20.0}/lib/websocket-server.js +0 -0
  178. /package/.output/server/node_modules/{ws → .nitro/ws@8.20.0}/lib/websocket.js +0 -0
  179. /package/.output/server/node_modules/{ws → .nitro/ws@8.20.0}/package.json +0 -0
  180. /package/.output/server/node_modules/{ws → .nitro/ws@8.20.0}/wrapper.mjs +0 -0
@@ -0,0 +1,274 @@
1
+ import "./chunk--u3MIqq1.js";
2
+ import { t as Server } from "./Server-H3SwqhwF.js";
3
+ import path from "node:path";
4
+ import { pluginTsName } from "@kubb/plugin-ts";
5
+ import { pluginZodName } from "@kubb/plugin-zod";
6
+ import { Client } from "@kubb/plugin-client/components";
7
+ import { createReactGenerator } from "@kubb/plugin-oas/generators";
8
+ import { useOas, useOperationManager } from "@kubb/plugin-oas/hooks";
9
+ import { getBanner, getFooter } from "@kubb/plugin-oas/utils";
10
+ import { File } from "@kubb/react-fabric";
11
+ import { Fragment, jsx, jsxs } from "@kubb/react-fabric/jsx-runtime";
12
+ import { usePluginManager } from "@kubb/core/hooks";
13
+ //#region src/generators/mcpGenerator.tsx
14
+ const mcpGenerator = createReactGenerator({
15
+ name: "mcp",
16
+ Operation({ config, operation, generator, plugin }) {
17
+ const { options } = plugin;
18
+ const oas = useOas();
19
+ const { getSchemas, getName, getFile } = useOperationManager(generator);
20
+ const mcp = {
21
+ name: getName(operation, {
22
+ type: "function",
23
+ suffix: "handler"
24
+ }),
25
+ file: getFile(operation)
26
+ };
27
+ const type = {
28
+ file: getFile(operation, { pluginKey: [pluginTsName] }),
29
+ schemas: getSchemas(operation, {
30
+ pluginKey: [pluginTsName],
31
+ type: "type"
32
+ })
33
+ };
34
+ return /* @__PURE__ */ jsxs(File, {
35
+ baseName: mcp.file.baseName,
36
+ path: mcp.file.path,
37
+ meta: mcp.file.meta,
38
+ banner: getBanner({
39
+ oas,
40
+ output: options.output
41
+ }),
42
+ footer: getFooter({
43
+ oas,
44
+ output: options.output
45
+ }),
46
+ children: [
47
+ options.client.importPath ? /* @__PURE__ */ jsxs(Fragment, { children: [
48
+ /* @__PURE__ */ jsx(File.Import, {
49
+ name: "fetch",
50
+ path: options.client.importPath
51
+ }),
52
+ /* @__PURE__ */ jsx(File.Import, {
53
+ name: [
54
+ "Client",
55
+ "RequestConfig",
56
+ "ResponseErrorConfig"
57
+ ],
58
+ path: options.client.importPath,
59
+ isTypeOnly: true
60
+ }),
61
+ options.client.dataReturnType === "full" && /* @__PURE__ */ jsx(File.Import, {
62
+ name: ["ResponseConfig"],
63
+ path: options.client.importPath,
64
+ isTypeOnly: true
65
+ })
66
+ ] }) : /* @__PURE__ */ jsxs(Fragment, { children: [
67
+ /* @__PURE__ */ jsx(File.Import, {
68
+ name: ["fetch"],
69
+ root: mcp.file.path,
70
+ path: path.resolve(config.root, config.output.path, ".kubb/fetch.ts")
71
+ }),
72
+ /* @__PURE__ */ jsx(File.Import, {
73
+ name: [
74
+ "Client",
75
+ "RequestConfig",
76
+ "ResponseErrorConfig"
77
+ ],
78
+ root: mcp.file.path,
79
+ path: path.resolve(config.root, config.output.path, ".kubb/fetch.ts"),
80
+ isTypeOnly: true
81
+ }),
82
+ options.client.dataReturnType === "full" && /* @__PURE__ */ jsx(File.Import, {
83
+ name: ["ResponseConfig"],
84
+ root: mcp.file.path,
85
+ path: path.resolve(config.root, config.output.path, ".kubb/fetch.ts"),
86
+ isTypeOnly: true
87
+ })
88
+ ] }),
89
+ /* @__PURE__ */ jsx(File.Import, {
90
+ name: ["buildFormData"],
91
+ root: mcp.file.path,
92
+ path: path.resolve(config.root, config.output.path, ".kubb/config.ts")
93
+ }),
94
+ /* @__PURE__ */ jsx(File.Import, {
95
+ name: ["CallToolResult"],
96
+ path: "@modelcontextprotocol/sdk/types",
97
+ isTypeOnly: true
98
+ }),
99
+ /* @__PURE__ */ jsx(File.Import, {
100
+ name: [
101
+ type.schemas.request?.name,
102
+ type.schemas.response.name,
103
+ type.schemas.pathParams?.name,
104
+ type.schemas.queryParams?.name,
105
+ type.schemas.headerParams?.name,
106
+ ...type.schemas.statusCodes?.map((item) => item.name) || []
107
+ ].filter(Boolean),
108
+ root: mcp.file.path,
109
+ path: type.file.path,
110
+ isTypeOnly: true
111
+ }),
112
+ /* @__PURE__ */ jsxs(Client, {
113
+ name: mcp.name,
114
+ isConfigurable: false,
115
+ returnType: "Promise<CallToolResult>",
116
+ baseURL: options.client.baseURL,
117
+ operation,
118
+ typeSchemas: type.schemas,
119
+ zodSchemas: void 0,
120
+ dataReturnType: options.client.dataReturnType || "data",
121
+ paramsType: "object",
122
+ paramsCasing: options.client?.paramsCasing || options.paramsCasing,
123
+ pathParamsType: "object",
124
+ parser: "client",
125
+ children: [options.client.dataReturnType === "data" && `return {
126
+ content: [
127
+ {
128
+ type: 'text',
129
+ text: JSON.stringify(res.data)
130
+ }
131
+ ],
132
+ structuredContent: { data: res.data }
133
+ }`, options.client.dataReturnType === "full" && `return {
134
+ content: [
135
+ {
136
+ type: 'text',
137
+ text: JSON.stringify(res)
138
+ }
139
+ ],
140
+ structuredContent: { data: res.data }
141
+ }`]
142
+ })
143
+ ]
144
+ });
145
+ }
146
+ });
147
+ //#endregion
148
+ //#region src/generators/serverGenerator.tsx
149
+ const serverGenerator = createReactGenerator({
150
+ name: "operations",
151
+ Operations({ operations, generator, plugin }) {
152
+ const pluginManager = usePluginManager();
153
+ const { options } = plugin;
154
+ const oas = useOas();
155
+ const { getFile, getName, getSchemas } = useOperationManager(generator);
156
+ const name = "server";
157
+ const file = pluginManager.getFile({
158
+ name,
159
+ extname: ".ts",
160
+ pluginKey: plugin.key
161
+ });
162
+ const jsonFile = pluginManager.getFile({
163
+ name: ".mcp",
164
+ extname: ".json",
165
+ pluginKey: plugin.key
166
+ });
167
+ const operationsMapped = operations.map((operation) => {
168
+ return {
169
+ tool: {
170
+ name: operation.getOperationId() || operation.getSummary() || `${operation.method.toUpperCase()} ${operation.path}`,
171
+ title: operation.getSummary() || void 0,
172
+ description: operation.getDescription() || `Make a ${operation.method.toUpperCase()} request to ${operation.path}`
173
+ },
174
+ mcp: {
175
+ name: getName(operation, {
176
+ type: "function",
177
+ suffix: "handler"
178
+ }),
179
+ file: getFile(operation)
180
+ },
181
+ zod: {
182
+ name: getName(operation, {
183
+ type: "function",
184
+ pluginKey: [pluginZodName]
185
+ }),
186
+ schemas: getSchemas(operation, {
187
+ pluginKey: [pluginZodName],
188
+ type: "function"
189
+ }),
190
+ file: getFile(operation, { pluginKey: [pluginZodName] })
191
+ },
192
+ type: { schemas: getSchemas(operation, {
193
+ pluginKey: [pluginTsName],
194
+ type: "type"
195
+ }) }
196
+ };
197
+ });
198
+ const imports = operationsMapped.flatMap(({ mcp, zod }) => {
199
+ return [/* @__PURE__ */ jsx(File.Import, {
200
+ name: [mcp.name],
201
+ root: file.path,
202
+ path: mcp.file.path
203
+ }, mcp.name), /* @__PURE__ */ jsx(File.Import, {
204
+ name: [
205
+ zod.schemas.request?.name,
206
+ zod.schemas.pathParams?.name,
207
+ zod.schemas.queryParams?.name,
208
+ zod.schemas.headerParams?.name,
209
+ zod.schemas.response?.name
210
+ ].filter(Boolean),
211
+ root: file.path,
212
+ path: zod.file.path
213
+ }, zod.name)];
214
+ });
215
+ return /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsxs(File, {
216
+ baseName: file.baseName,
217
+ path: file.path,
218
+ meta: file.meta,
219
+ banner: getBanner({
220
+ oas,
221
+ output: options.output,
222
+ config: pluginManager.config
223
+ }),
224
+ footer: getFooter({
225
+ oas,
226
+ output: options.output
227
+ }),
228
+ children: [
229
+ /* @__PURE__ */ jsx(File.Import, {
230
+ name: ["McpServer"],
231
+ path: "@modelcontextprotocol/sdk/server/mcp"
232
+ }),
233
+ /* @__PURE__ */ jsx(File.Import, {
234
+ name: ["z"],
235
+ path: "zod"
236
+ }),
237
+ /* @__PURE__ */ jsx(File.Import, {
238
+ name: ["StdioServerTransport"],
239
+ path: "@modelcontextprotocol/sdk/server/stdio"
240
+ }),
241
+ imports,
242
+ /* @__PURE__ */ jsx(Server, {
243
+ name,
244
+ serverName: oas.api.info?.title,
245
+ serverVersion: oas.getVersion(),
246
+ paramsCasing: options.paramsCasing,
247
+ operations: operationsMapped
248
+ })
249
+ ]
250
+ }), /* @__PURE__ */ jsx(File, {
251
+ baseName: jsonFile.baseName,
252
+ path: jsonFile.path,
253
+ meta: jsonFile.meta,
254
+ children: /* @__PURE__ */ jsx(File.Source, {
255
+ name,
256
+ children: `
257
+ {
258
+ "mcpServers": {
259
+ "${oas.api.info?.title || "server"}": {
260
+ "type": "stdio",
261
+ "command": "npx",
262
+ "args": ["tsx", "${file.path}"]
263
+ }
264
+ }
265
+ }
266
+ `
267
+ })
268
+ })] });
269
+ }
270
+ });
271
+ //#endregion
272
+ export { mcpGenerator as n, serverGenerator as t };
273
+
274
+ //# sourceMappingURL=generators-BqkMrcs9.js.map
@@ -0,0 +1,122 @@
1
+ import "./chunk--u3MIqq1.js";
2
+ import { n as camelCase } from "./Server-H3SwqhwF.js";
3
+ import { n as mcpGenerator, t as serverGenerator } from "./generators-BqkMrcs9.js";
4
+ import path from "node:path";
5
+ import { definePlugin, getBarrelFiles, getMode } from "@kubb/core";
6
+ import { pluginClientName } from "@kubb/plugin-client";
7
+ import { source } from "@kubb/plugin-client/templates/clients/axios.source";
8
+ import { source as source$1 } from "@kubb/plugin-client/templates/clients/fetch.source";
9
+ import { source as source$2 } from "@kubb/plugin-client/templates/config.source";
10
+ import { OperationGenerator, pluginOasName } from "@kubb/plugin-oas";
11
+ import { pluginTsName } from "@kubb/plugin-ts";
12
+ import { pluginZodName } from "@kubb/plugin-zod";
13
+ //#region src/plugin.ts
14
+ const pluginMcpName = "plugin-mcp";
15
+ const pluginMcp = definePlugin((options) => {
16
+ const { output = {
17
+ path: "mcp",
18
+ barrelType: "named"
19
+ }, group, exclude = [], include, override = [], transformers = {}, generators = [mcpGenerator, serverGenerator].filter(Boolean), contentType, paramsCasing, client } = options;
20
+ const clientName = client?.client ?? "axios";
21
+ const clientImportPath = client?.importPath ?? (!client?.bundle ? `@kubb/plugin-client/clients/${clientName}` : void 0);
22
+ return {
23
+ name: pluginMcpName,
24
+ options: {
25
+ output,
26
+ group,
27
+ paramsCasing,
28
+ client: {
29
+ client: clientName,
30
+ clientType: client?.clientType ?? "function",
31
+ importPath: clientImportPath,
32
+ dataReturnType: client?.dataReturnType ?? "data",
33
+ bundle: client?.bundle,
34
+ baseURL: client?.baseURL,
35
+ paramsCasing: client?.paramsCasing
36
+ }
37
+ },
38
+ pre: [
39
+ pluginOasName,
40
+ pluginTsName,
41
+ pluginZodName
42
+ ].filter(Boolean),
43
+ resolvePath(baseName, pathMode, options) {
44
+ const root = path.resolve(this.config.root, this.config.output.path);
45
+ if ((pathMode ?? getMode(path.resolve(root, output.path))) === "single")
46
+ /**
47
+ * when output is a file then we will always append to the same file(output file), see fileManager.addOrAppend
48
+ * Other plugins then need to call addOrAppend instead of just add from the fileManager class
49
+ */
50
+ return path.resolve(root, output.path);
51
+ if (group && (options?.group?.path || options?.group?.tag)) {
52
+ const groupName = group?.name ? group.name : (ctx) => {
53
+ if (group?.type === "path") return `${ctx.group.split("/")[1]}`;
54
+ return `${camelCase(ctx.group)}Requests`;
55
+ };
56
+ return path.resolve(root, output.path, groupName({ group: group.type === "path" ? options.group.path : options.group.tag }), baseName);
57
+ }
58
+ return path.resolve(root, output.path, baseName);
59
+ },
60
+ resolveName(name, type) {
61
+ const resolvedName = camelCase(name, { isFile: type === "file" });
62
+ if (type) return transformers?.name?.(resolvedName, type) || resolvedName;
63
+ return resolvedName;
64
+ },
65
+ async install() {
66
+ const root = path.resolve(this.config.root, this.config.output.path);
67
+ const mode = getMode(path.resolve(root, output.path));
68
+ const oas = await this.getOas();
69
+ const baseURL = await this.getBaseURL();
70
+ if (baseURL) this.plugin.options.client.baseURL = baseURL;
71
+ const hasClientPlugin = !!this.pluginManager.getPluginByKey([pluginClientName]);
72
+ if (this.plugin.options.client.bundle && !hasClientPlugin && !this.plugin.options.client.importPath) await this.addFile({
73
+ baseName: "fetch.ts",
74
+ path: path.resolve(root, ".kubb/fetch.ts"),
75
+ sources: [{
76
+ name: "fetch",
77
+ value: this.plugin.options.client.client === "fetch" ? source$1 : source,
78
+ isExportable: true,
79
+ isIndexable: true
80
+ }],
81
+ imports: [],
82
+ exports: []
83
+ });
84
+ if (!hasClientPlugin) await this.addFile({
85
+ baseName: "config.ts",
86
+ path: path.resolve(root, ".kubb/config.ts"),
87
+ sources: [{
88
+ name: "config",
89
+ value: source$2,
90
+ isExportable: false,
91
+ isIndexable: false
92
+ }],
93
+ imports: [],
94
+ exports: []
95
+ });
96
+ const files = await new OperationGenerator(this.plugin.options, {
97
+ fabric: this.fabric,
98
+ oas,
99
+ pluginManager: this.pluginManager,
100
+ events: this.events,
101
+ plugin: this.plugin,
102
+ contentType,
103
+ exclude,
104
+ include,
105
+ override,
106
+ mode
107
+ }).build(...generators);
108
+ await this.upsertFile(...files);
109
+ const barrelFiles = await getBarrelFiles(this.fabric.files, {
110
+ type: output.barrelType ?? "named",
111
+ root,
112
+ output,
113
+ meta: { pluginKey: this.plugin.key }
114
+ });
115
+ await this.upsertFile(...barrelFiles);
116
+ }
117
+ };
118
+ });
119
+ //#endregion
120
+ export { pluginMcp, pluginMcpName };
121
+
122
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1,107 @@
1
+ {
2
+ "name": "@kubb/plugin-mcp",
3
+ "version": "4.37.2",
4
+ "description": "Model Context Protocol (MCP) plugin for Kubb, generating MCP-compatible tools and schemas from OpenAPI specifications for AI assistants.",
5
+ "keywords": [
6
+ "mcp",
7
+ "model-context-protocol",
8
+ "ai",
9
+ "llm",
10
+ "claude",
11
+ "ai-tools",
12
+ "openapi",
13
+ "swagger",
14
+ "typescript",
15
+ "code-generator",
16
+ "codegen",
17
+ "plugins",
18
+ "kubb"
19
+ ],
20
+ "repository": {
21
+ "type": "git",
22
+ "url": "git+https://github.com/kubb-labs/kubb.git",
23
+ "directory": "packages/plugin-mcp"
24
+ },
25
+ "license": "MIT",
26
+ "author": "stijnvanhulle",
27
+ "sideEffects": false,
28
+ "type": "module",
29
+ "exports": {
30
+ ".": {
31
+ "import": "./dist/index.js",
32
+ "require": "./dist/index.cjs"
33
+ },
34
+ "./components": {
35
+ "import": "./dist/components.js",
36
+ "require": "./dist/components.cjs"
37
+ },
38
+ "./generators": {
39
+ "import": "./dist/generators.js",
40
+ "require": "./dist/generators.cjs"
41
+ },
42
+ "./package.json": "./package.json"
43
+ },
44
+ "types": "./dist/index.d.ts",
45
+ "typesVersions": {
46
+ "*": {
47
+ "utils": [
48
+ "./dist/utils.d.ts"
49
+ ],
50
+ "hooks": [
51
+ "./dist/hooks.d.ts"
52
+ ],
53
+ "components": [
54
+ "./dist/components.d.ts"
55
+ ],
56
+ "generators": [
57
+ "./dist/generators.d.ts"
58
+ ]
59
+ }
60
+ },
61
+ "files": [
62
+ "src",
63
+ "dist",
64
+ "!/**/**.test.**",
65
+ "!/**/__tests__/**",
66
+ "!/**/__snapshots__/**"
67
+ ],
68
+ "size-limit": [
69
+ {
70
+ "path": "./dist/*.js",
71
+ "limit": "510 KiB",
72
+ "gzip": true
73
+ }
74
+ ],
75
+ "dependencies": {
76
+ "@kubb/react-fabric": "0.14.0",
77
+ "@kubb/core": "4.37.2",
78
+ "@kubb/oas": "4.37.2",
79
+ "@kubb/plugin-client": "4.37.2",
80
+ "@kubb/plugin-oas": "4.37.2",
81
+ "@kubb/plugin-ts": "4.37.2",
82
+ "@kubb/plugin-zod": "4.37.2"
83
+ },
84
+ "devDependencies": {
85
+ "@internals/utils": "0.0.0"
86
+ },
87
+ "engines": {
88
+ "node": ">=20"
89
+ },
90
+ "publishConfig": {
91
+ "access": "public",
92
+ "registry": "https://registry.npmjs.org/"
93
+ },
94
+ "main": "./dist/index.cjs",
95
+ "module": "./dist/index.js",
96
+ "scripts": {
97
+ "build": "tsdown && size-limit",
98
+ "clean": "npx rimraf ./dist",
99
+ "lint": "bun biome lint .",
100
+ "lint:fix": "bun biome lint --fix --unsafe .",
101
+ "release": "pnpm publish --no-git-check",
102
+ "release:canary": "bash ../../.github/canary.sh && node ../../scripts/build.js canary && pnpm publish --no-git-check",
103
+ "start": "tsdown --watch",
104
+ "test": "vitest --passWithNoTests",
105
+ "typecheck": "tsc -p ./tsconfig.json --noEmit --emitDeclarationOnly false"
106
+ }
107
+ }
@@ -0,0 +1,8 @@
1
+ //#region \0rolldown/runtime.js
2
+ var __defProp = Object.defineProperty;
3
+ var __name = (target, value) => __defProp(target, "name", {
4
+ value,
5
+ configurable: true
6
+ });
7
+ //#endregion
8
+ export { __name as t };