@kubb/mcp 3.10.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2024 Stijn Van Hulle
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,134 @@
1
+ 'use strict';
2
+
3
+ var mcp_js = require('@modelcontextprotocol/sdk/server/mcp.js');
4
+ var stdio_js = require('@modelcontextprotocol/sdk/server/stdio.js');
5
+ var zod = require('zod');
6
+ var core = require('@kubb/core');
7
+ var process = require('process');
8
+ var pluginTs = require('@kubb/plugin-ts');
9
+ var pluginOas = require('@kubb/plugin-oas');
10
+ var pluginReactQuery = require('@kubb/plugin-react-query');
11
+
12
+ function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
13
+
14
+ var process__default = /*#__PURE__*/_interopDefault(process);
15
+
16
+ // src/index.ts
17
+
18
+ // package.json
19
+ var version = "3.10.0";
20
+ var server = new mcp_js.McpServer({
21
+ name: "Kubb",
22
+ version
23
+ });
24
+ server.tool(
25
+ "kubbify",
26
+ "kubbify an openAPI spec to a code snippet",
27
+ {
28
+ openApi: zod.z.string().default("https://petstore.swagger.io/v2/swagger.json").describe("OpenAPI/Swagger spec"),
29
+ plugin: zod.z.enum(["typescript", "react-query"]).describe("Plugin to use"),
30
+ operationId: zod.z.string().nullable().optional().describe("Which operationId should be used")
31
+ // schemaName: z.string().nullable().optional().describe('Which schema should be used'),
32
+ },
33
+ async ({ plugin, openApi, operationId }) => {
34
+ try {
35
+ const definedConfig = {
36
+ root: process__default.default.cwd(),
37
+ input: {
38
+ data: openApi
39
+ },
40
+ output: {
41
+ path: "./",
42
+ write: false,
43
+ barrelType: "named"
44
+ },
45
+ plugins: [
46
+ pluginOas.pluginOas({ validate: false, generators: [] }),
47
+ pluginTs.pluginTs({
48
+ output: {
49
+ path: "typescript.ts"
50
+ },
51
+ generators: plugin === "typescript" ? void 0 : [],
52
+ include: [
53
+ operationId ? {
54
+ type: "operationId",
55
+ pattern: operationId
56
+ } : void 0
57
+ ].filter(Boolean)
58
+ }),
59
+ pluginReactQuery.pluginReactQuery({
60
+ output: {
61
+ path: "react-query.ts"
62
+ },
63
+ generators: plugin === "react-query" ? void 0 : [],
64
+ include: [
65
+ operationId ? {
66
+ type: "operationId",
67
+ pattern: operationId
68
+ } : void 0
69
+ ].filter(Boolean)
70
+ })
71
+ ].filter(Boolean)
72
+ };
73
+ const { files, error } = await core.safeBuild({
74
+ config: definedConfig
75
+ });
76
+ if (error) {
77
+ return {
78
+ content: [
79
+ {
80
+ type: "text",
81
+ text: error.message
82
+ }
83
+ ],
84
+ isError: true
85
+ };
86
+ }
87
+ return {
88
+ content: [
89
+ // {
90
+ // type: 'resource',
91
+ // resource: {}
92
+ // },
93
+ {
94
+ type: "text",
95
+ text: `Config: ${JSON.stringify(definedConfig, null, 2)}`
96
+ },
97
+ {
98
+ type: "text",
99
+ text: `Files: ${JSON.stringify(
100
+ files.flatMap((file) => file.sources).map((source) => source.value).join("\n\n"),
101
+ null,
102
+ 2
103
+ )}`
104
+ }
105
+ ]
106
+ };
107
+ } catch (e) {
108
+ const error = e;
109
+ return {
110
+ content: [
111
+ {
112
+ type: "text",
113
+ text: error.message
114
+ }
115
+ ],
116
+ isError: true
117
+ };
118
+ }
119
+ }
120
+ );
121
+ async function startServer() {
122
+ try {
123
+ const transport = new stdio_js.StdioServerTransport();
124
+ await server.connect(transport);
125
+ } catch (error) {
126
+ console.error("Failed to start server:", error);
127
+ process__default.default.exit(1);
128
+ }
129
+ }
130
+
131
+ exports.server = server;
132
+ exports.startServer = startServer;
133
+ //# sourceMappingURL=chunk-45YOYPRS.cjs.map
134
+ //# sourceMappingURL=chunk-45YOYPRS.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../package.json","../src/index.ts"],"names":["McpServer","z","process","pluginOas","pluginTs","pluginReactQuery","safeBuild","StdioServerTransport"],"mappings":";;;;;;;;;;;;;;;;;;AAEE,IAAW,OAAA,GAAA,QAAA;ACQA,IAAA,MAAA,GAAS,IAAIA,gBAAU,CAAA;AAAA,EAClC,IAAM,EAAA,MAAA;AAAA,EACN;AACF,CAAC;AAED,MAAO,CAAA,IAAA;AAAA,EACL,SAAA;AAAA,EACA,2CAAA;AAAA,EACA;AAAA,IACE,OAAA,EAASC,MAAE,MAAO,EAAA,CAAE,QAAQ,6CAA6C,CAAA,CAAE,SAAS,sBAAsB,CAAA;AAAA,IAC1G,MAAA,EAAQA,MAAE,IAAK,CAAA,CAAC,cAAc,aAAa,CAAC,CAAE,CAAA,QAAA,CAAS,eAAe,CAAA;AAAA,IACtE,WAAA,EAAaA,MAAE,MAAO,EAAA,CAAE,UAAW,CAAA,QAAA,EAAW,CAAA,QAAA,CAAS,kCAAkC;AAAA;AAAA,GAE3F;AAAA,EACA,OAAO,EAAE,MAAQ,EAAA,OAAA,EAAS,aAA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b/mcp\",\n \"version\": \"3.10.0\",\n \"description\": \"Generator MCP\",\n \"keywords\": [\n \"typescript\",\n \"plugins\",\n \"kubb\",\n \"codegen\",\n \"MCP\"\n ],\n \"repository\": {\n \"type\": \"git\",\n \"url\": \"https://github.com/kubb-labs/kubb.git\",\n \"directory\": \"packages/mcp\"\n },\n \"license\": \"MIT\",\n \"author\": \"stijnvanhulle\",\n \"sideEffects\": false,\n \"type\": \"module\",\n \"exports\": {\n \".\": {\n \"import\": \"./dist/index.js\",\n \"require\": \"./dist/index.cjs\",\n \"default\": \"./dist/index.cjs\"\n },\n \"./server\": {\n \"import\": \"./dist/server.js\",\n \"require\": \"./dist/server.cjs\",\n \"default\": \"./dist/server.cjs\"\n }\n },\n \"main\": \"dist/index.cjs\",\n \"module\": \"dist/index.js\",\n \"types\": \"./dist/index.d.ts\",\n \"typesVersions\": {\n \"*\": {\n \"server\": [\n \"./dist/server.d.ts\"\n ]\n }\n },\n \"files\": [\n \"src\",\n \"dist\",\n \"!/**/**.test.**\",\n \"!/**/__tests__/**\"\n ],\n \"scripts\": {\n \"build\": \"tsup\",\n \"start:mcp\": \"bun --watch ./src/server.ts\",\n \"debug:mcp\": \"npx -y @modelcontextprotocol/inspector node ./dist/server.js\",\n \"clean\": \"npx rimraf ./dist\",\n \"lint\": \"bun biome lint .\",\n \"lint:fix\": \"bun biome lint --apply-unsafe .\",\n \"release\": \"pnpm publish --no-git-check\",\n \"release:canary\": \"bash ../../.github/canary.sh && node ../../scripts/build.js canary && pnpm publish --no-git-check\",\n \"start\": \"tsup --watch\",\n \"test\": \"vitest --passWithNoTests\",\n \"typecheck\": \"tsc -p ./tsconfig.json --noEmit --emitDeclarationOnly false\"\n },\n \"dependencies\": {\n \"@kubb/core\": \"workspace:*\",\n \"@kubb/plugin-client\": \"workspace:*\",\n \"@kubb/plugin-cypress\": \"workspace:*\",\n \"@kubb/plugin-faker\": \"workspace:*\",\n \"@kubb/plugin-mcp\": \"workspace:*\",\n \"@kubb/plugin-msw\": \"workspace:*\",\n \"@kubb/plugin-oas\": \"workspace:*\",\n \"@kubb/plugin-react-query\": \"workspace:*\",\n \"@kubb/plugin-redoc\": \"workspace:*\",\n \"@kubb/plugin-swr\": \"workspace:*\",\n \"@kubb/plugin-ts\": \"workspace:*\",\n \"@kubb/plugin-zod\": \"workspace:*\",\n \"@kubb/react\": \"workspace:*\",\n \"@modelcontextprotocol/sdk\": \"^1.10.2\",\n \"zod\": \"^3.24.3\"\n },\n \"devDependencies\": {\n \"@kubb/config-ts\": \"workspace:*\",\n \"@kubb/config-tsup\": \"workspace:*\",\n \"@kubb/plugin-oas\": \"workspace:*\",\n \"@types/node\": \"catalog:\",\n \"@types/react\": \"catalog:\",\n \"tsup\": \"catalog:\",\n \"typescript\": \"catalog:\"\n },\n \"engines\": {\n \"node\": \">=20\"\n },\n \"publishConfig\": {\n \"access\": \"public\",\n \"registry\": \"https://registry.npmjs.org/\"\n }\n}\n","import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js'\nimport { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js'\nimport { z } from 'zod'\nimport { version } from '../package.json'\nimport { type Config, type Plugin, safeBuild } from '@kubb/core'\nimport process from 'node:process'\nimport { pluginTs } from '@kubb/plugin-ts'\nimport { pluginOas } from '@kubb/plugin-oas'\nimport { pluginReactQuery } from '@kubb/plugin-react-query'\n\nexport const server = new McpServer({\n name: 'Kubb',\n version,\n})\n\nserver.tool(\n 'kubbify',\n 'kubbify an openAPI spec to a code snippet',\n {\n openApi: z.string().default('https://petstore.swagger.io/v2/swagger.json').describe('OpenAPI/Swagger spec'),\n plugin: z.enum(['typescript', 'react-query']).describe('Plugin to use'),\n operationId: z.string().nullable().optional().describe('Which operationId should be used'),\n // schemaName: z.string().nullable().optional().describe('Which schema should be used'),\n },\n async ({ plugin, openApi, operationId }) => {\n try {\n const definedConfig: Config = {\n root: process.cwd(),\n input: {\n data: openApi,\n },\n output: {\n path: './',\n write: false,\n barrelType: 'named',\n },\n plugins: [\n pluginOas({ validate: false, generators: [] }),\n pluginTs({\n output: {\n path: 'typescript.ts',\n },\n generators: plugin === 'typescript' ? undefined : [],\n include: [\n operationId\n ? {\n type: 'operationId',\n pattern: operationId,\n }\n : undefined,\n ].filter(Boolean) as any[],\n }),\n pluginReactQuery({\n output: {\n path: 'react-query.ts',\n },\n generators: plugin === 'react-query' ? undefined : [],\n include: [\n operationId\n ? {\n type: 'operationId',\n pattern: operationId,\n }\n : undefined,\n ].filter(Boolean) as any[],\n }),\n ].filter(Boolean) as Plugin[],\n }\n\n const { files, error } = await safeBuild({\n config: definedConfig,\n })\n\n if (error) {\n return {\n content: [\n {\n type: 'text',\n text: error.message,\n },\n ],\n isError: true,\n }\n }\n\n return {\n content: [\n // {\n // type: 'resource',\n // resource: {}\n // },\n {\n type: 'text',\n text: `Config: ${JSON.stringify(definedConfig, null, 2)}`,\n },\n {\n type: 'text',\n text: `Files: ${JSON.stringify(\n files\n .flatMap((file) => file.sources)\n .map((source) => source.value)\n .join('\\n\\n'),\n null,\n 2,\n )}`,\n },\n ],\n }\n } catch (e) {\n const error = e as Error\n\n return {\n content: [\n {\n type: 'text',\n text: error.message,\n },\n ],\n isError: true,\n }\n }\n },\n)\n\nexport async function startServer() {\n try {\n const transport = new StdioServerTransport()\n await server.connect(transport)\n } catch (error) {\n console.error('Failed to start server:', error)\n process.exit(1)\n }\n}\n"]}
@@ -0,0 +1,127 @@
1
+ import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
2
+ import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js';
3
+ import { z } from 'zod';
4
+ import { safeBuild } from '@kubb/core';
5
+ import process from 'node:process';
6
+ import { pluginTs } from '@kubb/plugin-ts';
7
+ import { pluginOas } from '@kubb/plugin-oas';
8
+ import { pluginReactQuery } from '@kubb/plugin-react-query';
9
+
10
+ // src/index.ts
11
+
12
+ // package.json
13
+ var version = "3.10.0";
14
+ var server = new McpServer({
15
+ name: "Kubb",
16
+ version
17
+ });
18
+ server.tool(
19
+ "kubbify",
20
+ "kubbify an openAPI spec to a code snippet",
21
+ {
22
+ openApi: z.string().default("https://petstore.swagger.io/v2/swagger.json").describe("OpenAPI/Swagger spec"),
23
+ plugin: z.enum(["typescript", "react-query"]).describe("Plugin to use"),
24
+ operationId: z.string().nullable().optional().describe("Which operationId should be used")
25
+ // schemaName: z.string().nullable().optional().describe('Which schema should be used'),
26
+ },
27
+ async ({ plugin, openApi, operationId }) => {
28
+ try {
29
+ const definedConfig = {
30
+ root: process.cwd(),
31
+ input: {
32
+ data: openApi
33
+ },
34
+ output: {
35
+ path: "./",
36
+ write: false,
37
+ barrelType: "named"
38
+ },
39
+ plugins: [
40
+ pluginOas({ validate: false, generators: [] }),
41
+ pluginTs({
42
+ output: {
43
+ path: "typescript.ts"
44
+ },
45
+ generators: plugin === "typescript" ? void 0 : [],
46
+ include: [
47
+ operationId ? {
48
+ type: "operationId",
49
+ pattern: operationId
50
+ } : void 0
51
+ ].filter(Boolean)
52
+ }),
53
+ pluginReactQuery({
54
+ output: {
55
+ path: "react-query.ts"
56
+ },
57
+ generators: plugin === "react-query" ? void 0 : [],
58
+ include: [
59
+ operationId ? {
60
+ type: "operationId",
61
+ pattern: operationId
62
+ } : void 0
63
+ ].filter(Boolean)
64
+ })
65
+ ].filter(Boolean)
66
+ };
67
+ const { files, error } = await safeBuild({
68
+ config: definedConfig
69
+ });
70
+ if (error) {
71
+ return {
72
+ content: [
73
+ {
74
+ type: "text",
75
+ text: error.message
76
+ }
77
+ ],
78
+ isError: true
79
+ };
80
+ }
81
+ return {
82
+ content: [
83
+ // {
84
+ // type: 'resource',
85
+ // resource: {}
86
+ // },
87
+ {
88
+ type: "text",
89
+ text: `Config: ${JSON.stringify(definedConfig, null, 2)}`
90
+ },
91
+ {
92
+ type: "text",
93
+ text: `Files: ${JSON.stringify(
94
+ files.flatMap((file) => file.sources).map((source) => source.value).join("\n\n"),
95
+ null,
96
+ 2
97
+ )}`
98
+ }
99
+ ]
100
+ };
101
+ } catch (e) {
102
+ const error = e;
103
+ return {
104
+ content: [
105
+ {
106
+ type: "text",
107
+ text: error.message
108
+ }
109
+ ],
110
+ isError: true
111
+ };
112
+ }
113
+ }
114
+ );
115
+ async function startServer() {
116
+ try {
117
+ const transport = new StdioServerTransport();
118
+ await server.connect(transport);
119
+ } catch (error) {
120
+ console.error("Failed to start server:", error);
121
+ process.exit(1);
122
+ }
123
+ }
124
+
125
+ export { server, startServer };
126
+ //# sourceMappingURL=chunk-SAQBYPC4.js.map
127
+ //# sourceMappingURL=chunk-SAQBYPC4.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../package.json","../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;AAEE,IAAW,OAAA,GAAA,QAAA;ACQA,IAAA,MAAA,GAAS,IAAI,SAAU,CAAA;AAAA,EAClC,IAAM,EAAA,MAAA;AAAA,EACN;AACF,CAAC;AAED,MAAO,CAAA,IAAA;AAAA,EACL,SAAA;AAAA,EACA,2CAAA;AAAA,EACA;AAAA,IACE,OAAA,EAAS,EAAE,MAAO,EAAA,CAAE,QAAQ,6CAA6C,CAAA,CAAE,SAAS,sBAAsB,CAAA;AAAA,IAC1G,MAAA,EAAQ,EAAE,IAAK,CAAA,CAAC,cAAc,aAAa,CAAC,CAAE,CAAA,QAAA,CAAS,eAAe,CAAA;AAAA,IACtE,WAAA,EAAa,EAAE,MAAO,EAAA,CAAE,UAAW,CAAA,QAAA,EAAW,CAAA,QAAA,CAAS,kCAAkC;AAAA;AAAA,GAE3F;AAAA,EACA,OAAO,EAAE,MAAQ,EAAA,OAAA,EAAS,aAAkB,KAAA;AAC1C,IAAI,IAAA;AACF,MAAA,MAAM,aAAwB,GAAA;AAAA,QAC5B,IAAA,EAAM,QAAQ,GAAI,EAAA;AAAA,QAClB,KAAO,EAAA;AAAA,UACL,IAAM,EAAA;AAAA,SACR;AAAA,QACA,MAAQ,EAAA;AAAA,UACN,IAAM,EAAA,IAAA;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AAM,EAAA,MAAA;AAAA,YACN,MAAM,CAAW,QAAA,EAAA,IAAA,CAAK,UAAU,aAAe,EAAA,IAAA,EAAM,CAAC,CAAC,CAAA;AAAA,WACzD;AAAA,UACA;AAAA,YACE,IAAM,EAAA,MAAA;AAAA,YACN,IAAA,EAAM,UAAU,IAAK,CAAA,SAAA;AAAA,cACnB,KACG,CAAA,OAAA,CAAQ,CAAC,IAAA,KAAS,KAAK,OAAO,CAAA,CAC9B,GAAI,CAAA,CAAC,MAAW,KAAA,MAAA,CAAO,KAAK,CAAA,CAC5B,KAAK,MAAM,CAAA;AAAA,cACd,IAAA;AAAA,cACA;AAAA,aACD,CAAA;AAAA;AACH;AACF,OACF;AAAA,aACO,CAAG,EAAA;AACV,MAAA,MAAM,KAAQ,GAAA,CAAA;AAEd,MAAO,OAAA;AAAA,QACL,OAAS,EAAA;AAAA,UACP;AAAA,YACE,IAAM,EAAA,MAAA;AAAA,YACN,MAAM,KAAM,CAAA;AAAA;AACd,SACF;AAAA,QACA,OAAS,EAAA;AAAA,OACX;AAAA;AACF;AAEJ,CAAA;AAEA,eAAsB,WAAc,GAAA;AAClC,EAAI,IAAA;AACF,IAAM,MAAA,SAAA,GAAY,IAAI,oBAAqB,EAAA;AAC3C,IAAM,MAAA,MAAA,CAAO,QAAQ,SAAS,CAAA;AAAA,WACvB,KAAO,EAAA;AACd,IAAQ,OAAA,CAAA,KAAA,CAAM,2BAA2B,KAAK,CAAA;AAC9C,IAAA,OAAA,CAAQ,KAAK,CAAC,CAAA;AAAA;AAElB","file":"chunk-SAQBYPC4.js","sourcesContent":["{\n \"name\": \"@kubb/mcp\",\n \"version\": \"3.10.0\",\n \"description\": \"Generator MCP\",\n \"keywords\": [\n \"typescript\",\n \"plugins\",\n \"kubb\",\n \"codegen\",\n \"MCP\"\n ],\n \"repository\": {\n \"type\": \"git\",\n \"url\": \"https://github.com/kubb-labs/kubb.git\",\n \"directory\": \"packages/mcp\"\n },\n \"license\": \"MIT\",\n \"author\": \"stijnvanhulle\",\n \"sideEffects\": false,\n \"type\": \"module\",\n \"exports\": {\n \".\": {\n \"import\": \"./dist/index.js\",\n \"require\": \"./dist/index.cjs\",\n \"default\": \"./dist/index.cjs\"\n },\n \"./server\": {\n \"import\": \"./dist/server.js\",\n \"require\": \"./dist/server.cjs\",\n \"default\": \"./dist/server.cjs\"\n }\n },\n \"main\": \"dist/index.cjs\",\n \"module\": \"dist/index.js\",\n \"types\": \"./dist/index.d.ts\",\n \"typesVersions\": {\n \"*\": {\n \"server\": [\n \"./dist/server.d.ts\"\n ]\n }\n },\n \"files\": [\n \"src\",\n \"dist\",\n \"!/**/**.test.**\",\n \"!/**/__tests__/**\"\n ],\n \"scripts\": {\n \"build\": \"tsup\",\n \"start:mcp\": \"bun --watch ./src/server.ts\",\n \"debug:mcp\": \"npx -y @modelcontextprotocol/inspector node ./dist/server.js\",\n \"clean\": \"npx rimraf ./dist\",\n \"lint\": \"bun biome lint .\",\n \"lint:fix\": \"bun biome lint --apply-unsafe .\",\n \"release\": \"pnpm publish --no-git-check\",\n \"release:canary\": \"bash ../../.github/canary.sh && node ../../scripts/build.js canary && pnpm publish --no-git-check\",\n \"start\": \"tsup --watch\",\n \"test\": \"vitest --passWithNoTests\",\n \"typecheck\": \"tsc -p ./tsconfig.json --noEmit --emitDeclarationOnly false\"\n },\n \"dependencies\": {\n \"@kubb/core\": \"workspace:*\",\n \"@kubb/plugin-client\": \"workspace:*\",\n \"@kubb/plugin-cypress\": \"workspace:*\",\n \"@kubb/plugin-faker\": \"workspace:*\",\n \"@kubb/plugin-mcp\": \"workspace:*\",\n \"@kubb/plugin-msw\": \"workspace:*\",\n \"@kubb/plugin-oas\": \"workspace:*\",\n \"@kubb/plugin-react-query\": \"workspace:*\",\n \"@kubb/plugin-redoc\": \"workspace:*\",\n \"@kubb/plugin-swr\": \"workspace:*\",\n \"@kubb/plugin-ts\": \"workspace:*\",\n \"@kubb/plugin-zod\": \"workspace:*\",\n \"@kubb/react\": \"workspace:*\",\n \"@modelcontextprotocol/sdk\": \"^1.10.2\",\n \"zod\": \"^3.24.3\"\n },\n \"devDependencies\": {\n \"@kubb/config-ts\": \"workspace:*\",\n \"@kubb/config-tsup\": \"workspace:*\",\n \"@kubb/plugin-oas\": \"workspace:*\",\n \"@types/node\": \"catalog:\",\n \"@types/react\": \"catalog:\",\n \"tsup\": \"catalog:\",\n \"typescript\": \"catalog:\"\n },\n \"engines\": {\n \"node\": \">=20\"\n },\n \"publishConfig\": {\n \"access\": \"public\",\n \"registry\": \"https://registry.npmjs.org/\"\n }\n}\n","import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js'\nimport { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js'\nimport { z } from 'zod'\nimport { version } from '../package.json'\nimport { type Config, type Plugin, safeBuild } from '@kubb/core'\nimport process from 'node:process'\nimport { pluginTs } from '@kubb/plugin-ts'\nimport { pluginOas } from '@kubb/plugin-oas'\nimport { pluginReactQuery } from '@kubb/plugin-react-query'\n\nexport const server = new McpServer({\n name: 'Kubb',\n version,\n})\n\nserver.tool(\n 'kubbify',\n 'kubbify an openAPI spec to a code snippet',\n {\n openApi: z.string().default('https://petstore.swagger.io/v2/swagger.json').describe('OpenAPI/Swagger spec'),\n plugin: z.enum(['typescript', 'react-query']).describe('Plugin to use'),\n operationId: z.string().nullable().optional().describe('Which operationId should be used'),\n // schemaName: z.string().nullable().optional().describe('Which schema should be used'),\n },\n async ({ plugin, openApi, operationId }) => {\n try {\n const definedConfig: Config = {\n root: process.cwd(),\n input: {\n data: openApi,\n },\n output: {\n path: './',\n write: false,\n barrelType: 'named',\n },\n plugins: [\n pluginOas({ validate: false, generators: [] }),\n pluginTs({\n output: {\n path: 'typescript.ts',\n },\n generators: plugin === 'typescript' ? undefined : [],\n include: [\n operationId\n ? {\n type: 'operationId',\n pattern: operationId,\n }\n : undefined,\n ].filter(Boolean) as any[],\n }),\n pluginReactQuery({\n output: {\n path: 'react-query.ts',\n },\n generators: plugin === 'react-query' ? undefined : [],\n include: [\n operationId\n ? {\n type: 'operationId',\n pattern: operationId,\n }\n : undefined,\n ].filter(Boolean) as any[],\n }),\n ].filter(Boolean) as Plugin[],\n }\n\n const { files, error } = await safeBuild({\n config: definedConfig,\n })\n\n if (error) {\n return {\n content: [\n {\n type: 'text',\n text: error.message,\n },\n ],\n isError: true,\n }\n }\n\n return {\n content: [\n // {\n // type: 'resource',\n // resource: {}\n // },\n {\n type: 'text',\n text: `Config: ${JSON.stringify(definedConfig, null, 2)}`,\n },\n {\n type: 'text',\n text: `Files: ${JSON.stringify(\n files\n .flatMap((file) => file.sources)\n .map((source) => source.value)\n .join('\\n\\n'),\n null,\n 2,\n )}`,\n },\n ],\n }\n } catch (e) {\n const error = e as Error\n\n return {\n content: [\n {\n type: 'text',\n text: error.message,\n },\n ],\n isError: true,\n }\n }\n },\n)\n\nexport async function startServer() {\n try {\n const transport = new StdioServerTransport()\n await server.connect(transport)\n } catch (error) {\n console.error('Failed to start server:', error)\n process.exit(1)\n }\n}\n"]}
package/dist/index.cjs ADDED
@@ -0,0 +1,16 @@
1
+ 'use strict';
2
+
3
+ var chunk45YOYPRS_cjs = require('./chunk-45YOYPRS.cjs');
4
+
5
+
6
+
7
+ Object.defineProperty(exports, "server", {
8
+ enumerable: true,
9
+ get: function () { return chunk45YOYPRS_cjs.server; }
10
+ });
11
+ Object.defineProperty(exports, "startServer", {
12
+ enumerable: true,
13
+ get: function () { return chunk45YOYPRS_cjs.startServer; }
14
+ });
15
+ //# sourceMappingURL=index.cjs.map
16
+ //# sourceMappingURL=index.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"names":[],"mappings":"","file":"index.cjs"}
@@ -0,0 +1,6 @@
1
+ import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
2
+
3
+ declare const server: McpServer;
4
+ declare function startServer(): Promise<void>;
5
+
6
+ export { server, startServer };
@@ -0,0 +1,6 @@
1
+ import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
2
+
3
+ declare const server: McpServer;
4
+ declare function startServer(): Promise<void>;
5
+
6
+ export { server, startServer };
package/dist/index.js ADDED
@@ -0,0 +1,3 @@
1
+ export { server, startServer } from './chunk-SAQBYPC4.js';
2
+ //# sourceMappingURL=index.js.map
3
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"names":[],"mappings":"","file":"index.js"}
@@ -0,0 +1,8 @@
1
+ 'use strict';
2
+
3
+ var chunk45YOYPRS_cjs = require('./chunk-45YOYPRS.cjs');
4
+
5
+ // src/server.ts
6
+ chunk45YOYPRS_cjs.startServer();
7
+ //# sourceMappingURL=server.cjs.map
8
+ //# sourceMappingURL=server.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/server.ts"],"names":["startServer"],"mappings":";;;;;AAEAA,6BAAY,EAAA","file":"server.cjs","sourcesContent":["import { startServer } from './index.ts'\n\nstartServer()\n"]}
@@ -0,0 +1,2 @@
1
+
2
+ export { }
@@ -0,0 +1,2 @@
1
+
2
+ export { }
package/dist/server.js ADDED
@@ -0,0 +1,6 @@
1
+ import { startServer } from './chunk-SAQBYPC4.js';
2
+
3
+ // src/server.ts
4
+ startServer();
5
+ //# sourceMappingURL=server.js.map
6
+ //# sourceMappingURL=server.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/server.ts"],"names":[],"mappings":";;;AAEA,WAAY,EAAA","file":"server.js","sourcesContent":["import { startServer } from './index.ts'\n\nstartServer()\n"]}
package/package.json ADDED
@@ -0,0 +1,95 @@
1
+ {
2
+ "name": "@kubb/mcp",
3
+ "version": "3.10.0",
4
+ "description": "Generator MCP",
5
+ "keywords": [
6
+ "typescript",
7
+ "plugins",
8
+ "kubb",
9
+ "codegen",
10
+ "MCP"
11
+ ],
12
+ "repository": {
13
+ "type": "git",
14
+ "url": "https://github.com/kubb-labs/kubb.git",
15
+ "directory": "packages/mcp"
16
+ },
17
+ "license": "MIT",
18
+ "author": "stijnvanhulle",
19
+ "sideEffects": false,
20
+ "type": "module",
21
+ "exports": {
22
+ ".": {
23
+ "import": "./dist/index.js",
24
+ "require": "./dist/index.cjs",
25
+ "default": "./dist/index.cjs"
26
+ },
27
+ "./server": {
28
+ "import": "./dist/server.js",
29
+ "require": "./dist/server.cjs",
30
+ "default": "./dist/server.cjs"
31
+ }
32
+ },
33
+ "main": "dist/index.cjs",
34
+ "module": "dist/index.js",
35
+ "types": "./dist/index.d.ts",
36
+ "typesVersions": {
37
+ "*": {
38
+ "server": [
39
+ "./dist/server.d.ts"
40
+ ]
41
+ }
42
+ },
43
+ "files": [
44
+ "src",
45
+ "dist",
46
+ "!/**/**.test.**",
47
+ "!/**/__tests__/**"
48
+ ],
49
+ "dependencies": {
50
+ "@modelcontextprotocol/sdk": "^1.10.2",
51
+ "zod": "^3.24.3",
52
+ "@kubb/plugin-client": "3.10.0",
53
+ "@kubb/plugin-cypress": "3.10.0",
54
+ "@kubb/core": "3.10.0",
55
+ "@kubb/plugin-faker": "3.10.0",
56
+ "@kubb/plugin-msw": "3.10.0",
57
+ "@kubb/plugin-mcp": "3.10.0",
58
+ "@kubb/plugin-oas": "3.10.0",
59
+ "@kubb/plugin-react-query": "3.10.0",
60
+ "@kubb/plugin-redoc": "3.10.0",
61
+ "@kubb/plugin-swr": "3.10.0",
62
+ "@kubb/plugin-ts": "3.10.0",
63
+ "@kubb/plugin-zod": "3.10.0",
64
+ "@kubb/react": "3.10.0"
65
+ },
66
+ "devDependencies": {
67
+ "@types/node": "^20.17.30",
68
+ "@types/react": "^18.3.20",
69
+ "tsup": "^8.4.0",
70
+ "typescript": "^5.8.3",
71
+ "@kubb/config-ts": "3.10.0",
72
+ "@kubb/config-tsup": "3.10.0",
73
+ "@kubb/plugin-oas": "3.10.0"
74
+ },
75
+ "engines": {
76
+ "node": ">=20"
77
+ },
78
+ "publishConfig": {
79
+ "access": "public",
80
+ "registry": "https://registry.npmjs.org/"
81
+ },
82
+ "scripts": {
83
+ "build": "tsup",
84
+ "start:mcp": "bun --watch ./src/server.ts",
85
+ "debug:mcp": "npx -y @modelcontextprotocol/inspector node ./dist/server.js",
86
+ "clean": "npx rimraf ./dist",
87
+ "lint": "bun biome lint .",
88
+ "lint:fix": "bun biome lint --apply-unsafe .",
89
+ "release": "pnpm publish --no-git-check",
90
+ "release:canary": "bash ../../.github/canary.sh && node ../../scripts/build.js canary && pnpm publish --no-git-check",
91
+ "start": "tsup --watch",
92
+ "test": "vitest --passWithNoTests",
93
+ "typecheck": "tsc -p ./tsconfig.json --noEmit --emitDeclarationOnly false"
94
+ }
95
+ }
package/src/index.ts ADDED
@@ -0,0 +1,133 @@
1
+ import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js'
2
+ import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js'
3
+ import { z } from 'zod'
4
+ import { version } from '../package.json'
5
+ import { type Config, type Plugin, safeBuild } from '@kubb/core'
6
+ import process from 'node:process'
7
+ import { pluginTs } from '@kubb/plugin-ts'
8
+ import { pluginOas } from '@kubb/plugin-oas'
9
+ import { pluginReactQuery } from '@kubb/plugin-react-query'
10
+
11
+ export const server = new McpServer({
12
+ name: 'Kubb',
13
+ version,
14
+ })
15
+
16
+ server.tool(
17
+ 'kubbify',
18
+ 'kubbify an openAPI spec to a code snippet',
19
+ {
20
+ openApi: z.string().default('https://petstore.swagger.io/v2/swagger.json').describe('OpenAPI/Swagger spec'),
21
+ plugin: z.enum(['typescript', 'react-query']).describe('Plugin to use'),
22
+ operationId: z.string().nullable().optional().describe('Which operationId should be used'),
23
+ // schemaName: z.string().nullable().optional().describe('Which schema should be used'),
24
+ },
25
+ async ({ plugin, openApi, operationId }) => {
26
+ try {
27
+ const definedConfig: Config = {
28
+ root: process.cwd(),
29
+ input: {
30
+ data: openApi,
31
+ },
32
+ output: {
33
+ path: './',
34
+ write: false,
35
+ barrelType: 'named',
36
+ },
37
+ plugins: [
38
+ pluginOas({ validate: false, generators: [] }),
39
+ pluginTs({
40
+ output: {
41
+ path: 'typescript.ts',
42
+ },
43
+ generators: plugin === 'typescript' ? undefined : [],
44
+ include: [
45
+ operationId
46
+ ? {
47
+ type: 'operationId',
48
+ pattern: operationId,
49
+ }
50
+ : undefined,
51
+ ].filter(Boolean) as any[],
52
+ }),
53
+ pluginReactQuery({
54
+ output: {
55
+ path: 'react-query.ts',
56
+ },
57
+ generators: plugin === 'react-query' ? undefined : [],
58
+ include: [
59
+ operationId
60
+ ? {
61
+ type: 'operationId',
62
+ pattern: operationId,
63
+ }
64
+ : undefined,
65
+ ].filter(Boolean) as any[],
66
+ }),
67
+ ].filter(Boolean) as Plugin[],
68
+ }
69
+
70
+ const { files, error } = await safeBuild({
71
+ config: definedConfig,
72
+ })
73
+
74
+ if (error) {
75
+ return {
76
+ content: [
77
+ {
78
+ type: 'text',
79
+ text: error.message,
80
+ },
81
+ ],
82
+ isError: true,
83
+ }
84
+ }
85
+
86
+ return {
87
+ content: [
88
+ // {
89
+ // type: 'resource',
90
+ // resource: {}
91
+ // },
92
+ {
93
+ type: 'text',
94
+ text: `Config: ${JSON.stringify(definedConfig, null, 2)}`,
95
+ },
96
+ {
97
+ type: 'text',
98
+ text: `Files: ${JSON.stringify(
99
+ files
100
+ .flatMap((file) => file.sources)
101
+ .map((source) => source.value)
102
+ .join('\n\n'),
103
+ null,
104
+ 2,
105
+ )}`,
106
+ },
107
+ ],
108
+ }
109
+ } catch (e) {
110
+ const error = e as Error
111
+
112
+ return {
113
+ content: [
114
+ {
115
+ type: 'text',
116
+ text: error.message,
117
+ },
118
+ ],
119
+ isError: true,
120
+ }
121
+ }
122
+ },
123
+ )
124
+
125
+ export async function startServer() {
126
+ try {
127
+ const transport = new StdioServerTransport()
128
+ await server.connect(transport)
129
+ } catch (error) {
130
+ console.error('Failed to start server:', error)
131
+ process.exit(1)
132
+ }
133
+ }
package/src/server.ts ADDED
@@ -0,0 +1,3 @@
1
+ import { startServer } from './index.ts'
2
+
3
+ startServer()