@kubb/mcp 3.13.2 → 3.14.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 +1 -1
- package/dist/{chunk-ZAL72JFO.js → chunk-5YMRSMFG.js} +10 -10
- package/dist/chunk-5YMRSMFG.js.map +1 -0
- package/dist/{chunk-AW4ZCTAU.cjs → chunk-EXDSAICR.cjs} +9 -10
- package/dist/chunk-EXDSAICR.cjs.map +1 -0
- package/dist/index.cjs +2 -6
- package/dist/index.d.cts +1 -4
- package/dist/index.d.ts +1 -4
- package/dist/index.js +1 -1
- package/dist/server.cjs +2 -2
- package/dist/server.js +1 -1
- package/package.json +19 -19
- package/src/index.ts +8 -10
- package/dist/chunk-AW4ZCTAU.cjs.map +0 -1
- package/dist/chunk-ZAL72JFO.js.map +0 -1
package/LICENSE
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
+
import process2 from 'process';
|
|
1
2
|
import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js';
|
|
2
3
|
import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js';
|
|
3
|
-
import process2 from 'process';
|
|
4
4
|
import { z } from 'zod';
|
|
5
5
|
import { pluginTs } from '@kubb/plugin-ts';
|
|
6
6
|
import { pluginOas } from '@kubb/plugin-oas';
|
|
@@ -10,7 +10,7 @@ import { safeBuild, getSource } from '@kubb/core';
|
|
|
10
10
|
// src/index.ts
|
|
11
11
|
|
|
12
12
|
// package.json
|
|
13
|
-
var version = "3.
|
|
13
|
+
var version = "3.14.0";
|
|
14
14
|
var generateSchema = z.object({
|
|
15
15
|
openApi: z.string().default("https://petstore.swagger.io/v2/swagger.json").describe("OpenAPI/Swagger spec"),
|
|
16
16
|
plugin: z.enum(["typescript", "react-query"]).describe("Plugin to use"),
|
|
@@ -103,14 +103,14 @@ async function generate({ plugin, openApi, operationId }) {
|
|
|
103
103
|
}
|
|
104
104
|
|
|
105
105
|
// src/index.ts
|
|
106
|
-
var server = new McpServer({
|
|
107
|
-
name: "Kubb",
|
|
108
|
-
version
|
|
109
|
-
});
|
|
110
|
-
server.tool("generate", "generate an openAPI spec to a code snippet", generateSchema.shape, generate);
|
|
111
106
|
async function startServer() {
|
|
112
107
|
try {
|
|
113
108
|
const transport = new StdioServerTransport();
|
|
109
|
+
const server = new McpServer({
|
|
110
|
+
name: "Kubb",
|
|
111
|
+
version
|
|
112
|
+
});
|
|
113
|
+
server.tool("generate", "generate an openAPI spec to a code snippet", generateSchema.shape, generate);
|
|
114
114
|
await server.connect(transport);
|
|
115
115
|
} catch (error) {
|
|
116
116
|
console.error("Failed to start server:", error);
|
|
@@ -118,6 +118,6 @@ async function startServer() {
|
|
|
118
118
|
}
|
|
119
119
|
}
|
|
120
120
|
|
|
121
|
-
export {
|
|
122
|
-
//# sourceMappingURL=chunk-
|
|
123
|
-
//# sourceMappingURL=chunk-
|
|
121
|
+
export { startServer };
|
|
122
|
+
//# sourceMappingURL=chunk-5YMRSMFG.js.map
|
|
123
|
+
//# sourceMappingURL=chunk-5YMRSMFG.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../package.json","../src/schemas/generateSchema.ts","../src/tools/generate.ts","../src/index.ts"],"names":["process"],"mappings":";;;;;;;;;;;;AAEE,IAAW,OAAA,GAAA,QAAA;ACAN,IAAM,cAAA,GAAiB,EAAE,MAAO,CAAA;AAAA,EACrC,OAAA,EAAS,EAAE,MAAO,EAAA,CAAE,QAAQ,6CAA6C,CAAA,CAAE,SAAS,sBAAsB,CAAA;AAAA,EAC1G,MAAA,EAAQ,EAAE,IAAK,CAAA,CAAC,cAAc,aAAa,CAAC,CAAE,CAAA,QAAA,CAAS,eAAe,CAAA;AAAA,EACtE,WAAA,EAAa,EAAE,MAAO,EAAA,CAAE,UAAW,CAAA,QAAA,EAAW,CAAA,QAAA,CAAS,kCAAkC;AAAA;AAE3F,CAAC,CAAA;ACED,eAAsB,QAAS,CAAA,EAAE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AQ,SAAS,CAAA;AAAA,WACvB,KAAO,EAAA;AACd,IAAQ,OAAA,CAAA,KAAA,CAAM,2BAA2B,KAAK,CAAA;AAC9C,IAAAA,QAAAA,CAAQ,KAAK,CAAC,CAAA;AAAA;AAElB","file":"chunk-5YMRSMFG.js","sourcesContent":["{\n \"name\": \"@kubb/mcp\",\n \"version\": \"3.14.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--fix --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.15.0\",\n \"zod\": \"^3.25.73\"\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 { z } from 'zod'\n\nexport const generateSchema = z.object({\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","import { pluginTs } from '@kubb/plugin-ts'\nimport { type Include, pluginOas } from '@kubb/plugin-oas'\nimport { pluginReactQuery } from '@kubb/plugin-react-query'\n\nimport { type Config, safeBuild, type Plugin, getSource } from '@kubb/core'\nimport type { generateSchema } from '../schemas/generateSchema.ts'\nimport type { z } from 'zod'\nimport type { CallToolResult } from '@modelcontextprotocol/sdk/types.d.ts'\n\nexport async function generate({ plugin, openApi, operationId }: z.infer<typeof generateSchema>): Promise<CallToolResult> {\n try {\n const include = [\n operationId\n ? {\n type: 'operationId',\n pattern: operationId,\n }\n : undefined,\n ].filter(Boolean) as Include[]\n\n const plugins = [\n pluginOas({ validate: false, generators: [] }),\n pluginTs({\n output: {\n path: 'typescript.ts',\n },\n generators: plugin === 'typescript' ? undefined : [],\n include,\n }),\n pluginReactQuery({\n output: {\n path: 'react-query.ts',\n },\n generators: plugin === 'react-query' ? undefined : [],\n include,\n }),\n ].filter(Boolean) as Plugin[]\n\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 }\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 const promises = files.map(async (file) => {\n return await getSource(file, { extname: '.ts' })\n })\n\n const sources = await Promise.all(promises)\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(sources, null, 2)}`,\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","import process from 'node:process'\nimport { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js'\nimport { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js'\nimport { version } from '../package.json'\nimport { generateSchema } from './schemas/generateSchema.ts'\nimport { generate } from './tools/generate.ts'\n\nexport async function startServer() {\n try {\n const transport = new StdioServerTransport()\n const server = new McpServer({\n name: 'Kubb',\n version,\n })\n\n server.tool('generate', 'generate an openAPI spec to a code snippet', generateSchema.shape, generate)\n\n await server.connect(transport)\n } catch (error) {\n console.error('Failed to start server:', error)\n process.exit(1)\n }\n}\n"]}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
+
var process2 = require('process');
|
|
3
4
|
var mcp_js = require('@modelcontextprotocol/sdk/server/mcp.js');
|
|
4
5
|
var stdio_js = require('@modelcontextprotocol/sdk/server/stdio.js');
|
|
5
|
-
var process2 = require('process');
|
|
6
6
|
var zod = require('zod');
|
|
7
7
|
var pluginTs = require('@kubb/plugin-ts');
|
|
8
8
|
var pluginOas = require('@kubb/plugin-oas');
|
|
@@ -16,7 +16,7 @@ var process2__default = /*#__PURE__*/_interopDefault(process2);
|
|
|
16
16
|
// src/index.ts
|
|
17
17
|
|
|
18
18
|
// package.json
|
|
19
|
-
var version = "3.
|
|
19
|
+
var version = "3.14.0";
|
|
20
20
|
var generateSchema = zod.z.object({
|
|
21
21
|
openApi: zod.z.string().default("https://petstore.swagger.io/v2/swagger.json").describe("OpenAPI/Swagger spec"),
|
|
22
22
|
plugin: zod.z.enum(["typescript", "react-query"]).describe("Plugin to use"),
|
|
@@ -109,14 +109,14 @@ async function generate({ plugin, openApi, operationId }) {
|
|
|
109
109
|
}
|
|
110
110
|
|
|
111
111
|
// src/index.ts
|
|
112
|
-
var server = new mcp_js.McpServer({
|
|
113
|
-
name: "Kubb",
|
|
114
|
-
version
|
|
115
|
-
});
|
|
116
|
-
server.tool("generate", "generate an openAPI spec to a code snippet", generateSchema.shape, generate);
|
|
117
112
|
async function startServer() {
|
|
118
113
|
try {
|
|
119
114
|
const transport = new stdio_js.StdioServerTransport();
|
|
115
|
+
const server = new mcp_js.McpServer({
|
|
116
|
+
name: "Kubb",
|
|
117
|
+
version
|
|
118
|
+
});
|
|
119
|
+
server.tool("generate", "generate an openAPI spec to a code snippet", generateSchema.shape, generate);
|
|
120
120
|
await server.connect(transport);
|
|
121
121
|
} catch (error) {
|
|
122
122
|
console.error("Failed to start server:", error);
|
|
@@ -124,7 +124,6 @@ async function startServer() {
|
|
|
124
124
|
}
|
|
125
125
|
}
|
|
126
126
|
|
|
127
|
-
exports.server = server;
|
|
128
127
|
exports.startServer = startServer;
|
|
129
|
-
//# sourceMappingURL=chunk-
|
|
130
|
-
//# sourceMappingURL=chunk-
|
|
128
|
+
//# sourceMappingURL=chunk-EXDSAICR.cjs.map
|
|
129
|
+
//# sourceMappingURL=chunk-EXDSAICR.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../package.json","../src/schemas/generateSchema.ts","../src/tools/generate.ts","../src/index.ts"],"names":["z","pluginOas","pluginTs","pluginReactQuery","safeBuild","getSource","StdioServerTransport","McpServer","process"],"mappings":";;;;;;;;;;;;;;;;;;AAEE,IAAW,OAAA,GAAA,QAAA;ACAN,IAAM,cAAA,GAAiBA,MAAE,MAAO,CAAA;AAAA,EACrC,OAAA,EAASA,MAAE,MAAO,EAAA,CAAE,QAAQ,6CAA6C,CAAA,CAAE,SAAS,sBAAsB,CAAA;AAAA,EAC1G,MAAA,EAAQA,MAAE,IAAK,CAAA,CAAC,cAAc,aAAa,CAAC,CAAE,CAAA,QAAA,CAAS,eAAe,CAAA;AAAA,EACtE,WAAA,EAAaA,MAAE,MAAO,EAAA,CAAE,UAAW,CAAA,QAAA,EAAW,CAAA,QAAA,CAAS,kCAAkC;AAAA;AAE3F,CAAC,CAAA;ACED,eAAsB,QAAS,CAAA,EAAE,MAAQ,EAAA,OAAA,EAAS,aAAwE,EAAA;AACxH,EAAI,IAAA;AACF,IAAA,MAAM,OAAU,GAAA;AAAA,MACd,WACI,GAAA;AAAA,QACE,IAAM,EAAA,aAAA;AAAA,QACN,OAAS,EAAA;AAAA,OAEX,GAAA,KAAA;AAAA,KACN,CAAE,OAAO,OAAO,CAAA;AAEhB,IAAA,MAAM,OAAU,GAAA;AAAA,MACdC,oBAAU,EAAE,QAAA,EAAU,OAAO,UAAY,EAAA,IAAI,CAAA;AAAA,MAC7CC,iBAAS,CAAA;AAAA,QACP,MAAQ,EAAA;AAAA,UACN,I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AKP;AAAA,UACE,IAAM,EAAA,MAAA;AAAA,UACN,MAAM,CAAW,QAAA,EAAA,IAAA,CAAK,UAAU,aAAe,EAAA,IAAA,EAAM,CAAC,CAAC,CAAA;AAAA,SACzD;AAAA,QACA;AAAA,UACE,IAAM,EAAA,MAAA;AAAA,UACN,MAAM,CAAU,OAAA,EAAA,IAAA,CAAK,UAAU,OAAS,EAAA,IAAA,EAAM,CAAC,CAAC,CAAA;AAAA;AAClD;AACF,KACF;AAAA,WACO,CAAG,EAAA;AACV,IAAA,MAAM,KAAQ,GAAA,CAAA;AAEd,IAAO,OAAA;AAAA,MACL,OAAS,EAAA;AAAA,QACP;AAAA,UACE,IAAM,EAAA,MAAA;AAAA,UACN,MAAM,KAAM,CAAA;AAAA;AACd,OACF;AAAA,MACA,OAAS,EAAA;AAAA,KACX;AAAA;AAEJ;;;AC/FA,eAAsB,WAAc,GAAA;AAClC,EAAI,IAAA;AACF,IAAM,MAAA,SAAA,GAAY,IAAIC,6BAAqB,EAAA;AAC3C,IAAM,MAAA,MAAA,GAAS,IAAIC,gBAAU,CAAA;AAAA,MAC3B,IAAM,EAAA,MAAA;AAAA,MACN;AAAA,KACD,CAAA;AAED,IAAA,MAAA,CAAO,IAAK,CAAA,UAAA,EAAY,4CAA8C,EAAA,cAAA,CAAe,OAAO,QAAQ,CAAA;AAEpG,IAAM,MAAA,MAAA,CAAO,QAAQ,SAAS,CAAA;AAAA,WACvB,KAAO,EAAA;AACd,IAAQ,OAAA,CAAA,KAAA,CAAM,2BAA2B,KAAK,CAAA;AAC9C,IAAAC,yBAAAA,CAAQ,KAAK,CAAC,CAAA;AAAA;AAElB","file":"chunk-EXDSAICR.cjs","sourcesContent":["{\n \"name\": \"@kubb/mcp\",\n \"version\": \"3.14.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--fix --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.15.0\",\n \"zod\": \"^3.25.73\"\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 { z } from 'zod'\n\nexport const generateSchema = z.object({\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","import { pluginTs } from '@kubb/plugin-ts'\nimport { type Include, pluginOas } from '@kubb/plugin-oas'\nimport { pluginReactQuery } from '@kubb/plugin-react-query'\n\nimport { type Config, safeBuild, type Plugin, getSource } from '@kubb/core'\nimport type { generateSchema } from '../schemas/generateSchema.ts'\nimport type { z } from 'zod'\nimport type { CallToolResult } from '@modelcontextprotocol/sdk/types.d.ts'\n\nexport async function generate({ plugin, openApi, operationId }: z.infer<typeof generateSchema>): Promise<CallToolResult> {\n try {\n const include = [\n operationId\n ? {\n type: 'operationId',\n pattern: operationId,\n }\n : undefined,\n ].filter(Boolean) as Include[]\n\n const plugins = [\n pluginOas({ validate: false, generators: [] }),\n pluginTs({\n output: {\n path: 'typescript.ts',\n },\n generators: plugin === 'typescript' ? undefined : [],\n include,\n }),\n pluginReactQuery({\n output: {\n path: 'react-query.ts',\n },\n generators: plugin === 'react-query' ? undefined : [],\n include,\n }),\n ].filter(Boolean) as Plugin[]\n\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 }\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 const promises = files.map(async (file) => {\n return await getSource(file, { extname: '.ts' })\n })\n\n const sources = await Promise.all(promises)\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(sources, null, 2)}`,\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","import process from 'node:process'\nimport { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js'\nimport { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js'\nimport { version } from '../package.json'\nimport { generateSchema } from './schemas/generateSchema.ts'\nimport { generate } from './tools/generate.ts'\n\nexport async function startServer() {\n try {\n const transport = new StdioServerTransport()\n const server = new McpServer({\n name: 'Kubb',\n version,\n })\n\n server.tool('generate', 'generate an openAPI spec to a code snippet', generateSchema.shape, generate)\n\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
CHANGED
|
@@ -1,16 +1,12 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var chunkEXDSAICR_cjs = require('./chunk-EXDSAICR.cjs');
|
|
4
4
|
|
|
5
5
|
|
|
6
6
|
|
|
7
|
-
Object.defineProperty(exports, "server", {
|
|
8
|
-
enumerable: true,
|
|
9
|
-
get: function () { return chunkAW4ZCTAU_cjs.server; }
|
|
10
|
-
});
|
|
11
7
|
Object.defineProperty(exports, "startServer", {
|
|
12
8
|
enumerable: true,
|
|
13
|
-
get: function () { return
|
|
9
|
+
get: function () { return chunkEXDSAICR_cjs.startServer; }
|
|
14
10
|
});
|
|
15
11
|
//# sourceMappingURL=index.cjs.map
|
|
16
12
|
//# sourceMappingURL=index.cjs.map
|
package/dist/index.d.cts
CHANGED
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
package/dist/server.cjs
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var chunkEXDSAICR_cjs = require('./chunk-EXDSAICR.cjs');
|
|
4
4
|
|
|
5
5
|
// src/server.ts
|
|
6
|
-
|
|
6
|
+
chunkEXDSAICR_cjs.startServer();
|
|
7
7
|
//# sourceMappingURL=server.cjs.map
|
|
8
8
|
//# sourceMappingURL=server.cjs.map
|
package/dist/server.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kubb/mcp",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.14.0",
|
|
4
4
|
"description": "Generator MCP",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"typescript",
|
|
@@ -47,30 +47,30 @@
|
|
|
47
47
|
"!/**/__tests__/**"
|
|
48
48
|
],
|
|
49
49
|
"dependencies": {
|
|
50
|
-
"@modelcontextprotocol/sdk": "^1.
|
|
51
|
-
"zod": "^3.25.
|
|
52
|
-
"@kubb/core": "3.
|
|
53
|
-
"@kubb/plugin-client": "3.
|
|
54
|
-
"@kubb/plugin-cypress": "3.
|
|
55
|
-
"@kubb/plugin-faker": "3.
|
|
56
|
-
"@kubb/plugin-mcp": "3.
|
|
57
|
-
"@kubb/plugin-msw": "3.
|
|
58
|
-
"@kubb/plugin-oas": "3.
|
|
59
|
-
"@kubb/plugin-react-query": "3.
|
|
60
|
-
"@kubb/plugin-redoc": "3.
|
|
61
|
-
"@kubb/plugin-swr": "3.
|
|
62
|
-
"@kubb/plugin-ts": "3.
|
|
63
|
-
"@kubb/plugin-zod": "3.
|
|
64
|
-
"@kubb/react": "3.
|
|
50
|
+
"@modelcontextprotocol/sdk": "^1.15.0",
|
|
51
|
+
"zod": "^3.25.73",
|
|
52
|
+
"@kubb/core": "3.14.0",
|
|
53
|
+
"@kubb/plugin-client": "3.14.0",
|
|
54
|
+
"@kubb/plugin-cypress": "3.14.0",
|
|
55
|
+
"@kubb/plugin-faker": "3.14.0",
|
|
56
|
+
"@kubb/plugin-mcp": "3.14.0",
|
|
57
|
+
"@kubb/plugin-msw": "3.14.0",
|
|
58
|
+
"@kubb/plugin-oas": "3.14.0",
|
|
59
|
+
"@kubb/plugin-react-query": "3.14.0",
|
|
60
|
+
"@kubb/plugin-redoc": "3.14.0",
|
|
61
|
+
"@kubb/plugin-swr": "3.14.0",
|
|
62
|
+
"@kubb/plugin-ts": "3.14.0",
|
|
63
|
+
"@kubb/plugin-zod": "3.14.0",
|
|
64
|
+
"@kubb/react": "3.14.0"
|
|
65
65
|
},
|
|
66
66
|
"devDependencies": {
|
|
67
67
|
"@types/node": "^20.19.4",
|
|
68
68
|
"@types/react": "^18.3.23",
|
|
69
69
|
"tsup": "^8.5.0",
|
|
70
70
|
"typescript": "^5.8.3",
|
|
71
|
-
"@kubb/config-ts": "3.
|
|
72
|
-
"@kubb/config-tsup": "3.
|
|
73
|
-
"@kubb/plugin-oas": "3.
|
|
71
|
+
"@kubb/config-ts": "3.14.0",
|
|
72
|
+
"@kubb/config-tsup": "3.14.0",
|
|
73
|
+
"@kubb/plugin-oas": "3.14.0"
|
|
74
74
|
},
|
|
75
75
|
"engines": {
|
|
76
76
|
"node": ">=20"
|
package/src/index.ts
CHANGED
|
@@ -1,22 +1,20 @@
|
|
|
1
|
+
import process from 'node:process'
|
|
1
2
|
import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js'
|
|
2
3
|
import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js'
|
|
3
|
-
|
|
4
4
|
import { version } from '../package.json'
|
|
5
|
-
|
|
6
|
-
import process from 'node:process'
|
|
7
5
|
import { generateSchema } from './schemas/generateSchema.ts'
|
|
8
6
|
import { generate } from './tools/generate.ts'
|
|
9
7
|
|
|
10
|
-
export const server = new McpServer({
|
|
11
|
-
name: 'Kubb',
|
|
12
|
-
version,
|
|
13
|
-
})
|
|
14
|
-
|
|
15
|
-
server.tool('generate', 'generate an openAPI spec to a code snippet', generateSchema.shape, generate)
|
|
16
|
-
|
|
17
8
|
export async function startServer() {
|
|
18
9
|
try {
|
|
19
10
|
const transport = new StdioServerTransport()
|
|
11
|
+
const server = new McpServer({
|
|
12
|
+
name: 'Kubb',
|
|
13
|
+
version,
|
|
14
|
+
})
|
|
15
|
+
|
|
16
|
+
server.tool('generate', 'generate an openAPI spec to a code snippet', generateSchema.shape, generate)
|
|
17
|
+
|
|
20
18
|
await server.connect(transport)
|
|
21
19
|
} catch (error) {
|
|
22
20
|
console.error('Failed to start server:', error)
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../package.json","../src/schemas/generateSchema.ts","../src/tools/generate.ts","../src/index.ts"],"names":["z","pluginOas","pluginTs","pluginReactQuery","safeBuild","getSource","McpServer","StdioServerTransport","process"],"mappings":";;;;;;;;;;;;;;;;;;AAEE,IAAW,OAAA,GAAA,QAAA;ACAN,IAAM,cAAA,GAAiBA,MAAE,MAAO,CAAA;AAAA,EACrC,OAAA,EAASA,MAAE,MAAO,EAAA,CAAE,QAAQ,6CAA6C,CAAA,CAAE,SAAS,sBAAsB,CAAA;AAAA,EAC1G,MAAA,EAAQA,MAAE,IAAK,CAAA,CAAC,cAAc,aAAa,CAAC,CAAE,CAAA,QAAA,CAAS,eAAe,CAAA;AAAA,EACtE,WAAA,EAAaA,MAAE,MAAO,EAAA,CAAE,UAAW,CAAA,QAAA,EAAW,CAAA,QAAA,CAAS,kCAAkC;AAAA;AAE3F,CAAC,CAAA;ACED,eAAsB,QAAS,CAAA,EAAE,MAAQ,EAA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AAA,WACvB,KAAO,EAAA;AACd,IAAQ,OAAA,CAAA,KAAA,CAAM,2BAA2B,KAAK,CAAA;AAC9C,IAAAC,yBAAAA,CAAQ,KAAK,CAAC,CAAA;AAAA;AAElB","file":"chunk-AW4ZCTAU.cjs","sourcesContent":["{\n \"name\": \"@kubb/mcp\",\n \"version\": \"3.13.2\",\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--fix --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.13.3\",\n \"zod\": \"^3.25.67\"\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 { z } from 'zod'\n\nexport const generateSchema = z.object({\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","import { pluginTs } from '@kubb/plugin-ts'\nimport { type Include, pluginOas } from '@kubb/plugin-oas'\nimport { pluginReactQuery } from '@kubb/plugin-react-query'\n\nimport { type Config, safeBuild, type Plugin, getSource } from '@kubb/core'\nimport type { generateSchema } from '../schemas/generateSchema.ts'\nimport type { z } from 'zod'\nimport type { CallToolResult } from '@modelcontextprotocol/sdk/types.d.ts'\n\nexport async function generate({ plugin, openApi, operationId }: z.infer<typeof generateSchema>): Promise<CallToolResult> {\n try {\n const include = [\n operationId\n ? {\n type: 'operationId',\n pattern: operationId,\n }\n : undefined,\n ].filter(Boolean) as Include[]\n\n const plugins = [\n pluginOas({ validate: false, generators: [] }),\n pluginTs({\n output: {\n path: 'typescript.ts',\n },\n generators: plugin === 'typescript' ? undefined : [],\n include,\n }),\n pluginReactQuery({\n output: {\n path: 'react-query.ts',\n },\n generators: plugin === 'react-query' ? undefined : [],\n include,\n }),\n ].filter(Boolean) as Plugin[]\n\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 }\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 const promises = files.map(async (file) => {\n return await getSource(file, { extname: '.ts' })\n })\n\n const sources = await Promise.all(promises)\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(sources, null, 2)}`,\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","import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js'\nimport { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js'\n\nimport { version } from '../package.json'\n\nimport process from 'node:process'\nimport { generateSchema } from './schemas/generateSchema.ts'\nimport { generate } from './tools/generate.ts'\n\nexport const server = new McpServer({\n name: 'Kubb',\n version,\n})\n\nserver.tool('generate', 'generate an openAPI spec to a code snippet', generateSchema.shape, generate)\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"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../package.json","../src/schemas/generateSchema.ts","../src/tools/generate.ts","../src/index.ts"],"names":["process"],"mappings":";;;;;;;;;;;;AAEE,IAAW,OAAA,GAAA,QAAA;ACAN,IAAM,cAAA,GAAiB,EAAE,MAAO,CAAA;AAAA,EACrC,OAAA,EAAS,EAAE,MAAO,EAAA,CAAE,QAAQ,6CAA6C,CAAA,CAAE,SAAS,sBAAsB,CAAA;AAAA,EAC1G,MAAA,EAAQ,EAAE,IAAK,CAAA,CAAC,cAAc,aAAa,CAAC,CAAE,CAAA,QAAA,CAAS,eAAe,CAAA;AAAA,EACtE,WAAA,EAAa,EAAE,MAAO,EAAA,CAAE,UAAW,CAAA,QAAA,EAAW,CAAA,QAAA,CAAS,kCAAkC;AAAA;AAE3F,CAAC,CAAA;ACED,eAAsB,QAAS,CAAA,EAAE,MAAQ,EAAA,OAAA,EAAS,aAAwE,EAAA;AACxH,EAAI,IAAA;AACF,IAAA,MAAM,OAAU,GAAA;AAAA,MACd,WACI,GAAA;AAAA,QACE,IAAM,EAAA,aAAA;AAAA,QACN,OAAS,EAAA;AAAA,OAEX,GAAA,KAAA;AAAA,KACN,CAAE,OAAO,OAAO,CAAA;AAEhB,IAAA,MAAM,OAAU,GAAA;AAAA,MACd,UAAU,EAAE,QAAA,EAAU,OAAO,UAAY,EAAA,IAAI,CAAA;AAAA,MAC7C,QAAS,CAAA;AAAA,QACP,MAAQ,EAAA;AAAA,UACN,IAAM,EAAA;AAAA,SACR;AAAA,QACA,UAAY,EAAA,MAAA,KAAW,YAAe,GAAA,KAAA,CAAA,GAAY,EAAC;AAAA,QACnD;AAAA,OACD,CAAA;AAAA,MACD,gBAAiB,CAAA;AAAA,QACf,MAAQ,EAAA;AAAA,UACN,IAAM,EAAA;AAAA,SACR;AAAA,QACA,UAAY,EAAA,MAAA,KAAW,aAAgB,GAAA,KAAA,CAAA,GAAY,EAAC;AAAA,QAC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ACF,KACF;AAAA,WACO,CAAG,EAAA;AACV,IAAA,MAAM,KAAQ,GAAA,CAAA;AAEd,IAAO,OAAA;AAAA,MACL,OAAS,EAAA;AAAA,QACP;AAAA,UACE,IAAM,EAAA,MAAA;AAAA,UACN,MAAM,KAAM,CAAA;AAAA;AACd,OACF;AAAA,MACA,OAAS,EAAA;AAAA,KACX;AAAA;AAEJ;;;AC7Fa,IAAA,MAAA,GAAS,IAAI,SAAU,CAAA;AAAA,EAClC,IAAM,EAAA,MAAA;AAAA,EACN;AACF,CAAC;AAED,MAAA,CAAO,IAAK,CAAA,UAAA,EAAY,4CAA8C,EAAA,cAAA,CAAe,OAAO,QAAQ,CAAA;AAEpG,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,IAAAA,QAAAA,CAAQ,KAAK,CAAC,CAAA;AAAA;AAElB","file":"chunk-ZAL72JFO.js","sourcesContent":["{\n \"name\": \"@kubb/mcp\",\n \"version\": \"3.13.2\",\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--fix --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.13.3\",\n \"zod\": \"^3.25.67\"\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 { z } from 'zod'\n\nexport const generateSchema = z.object({\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","import { pluginTs } from '@kubb/plugin-ts'\nimport { type Include, pluginOas } from '@kubb/plugin-oas'\nimport { pluginReactQuery } from '@kubb/plugin-react-query'\n\nimport { type Config, safeBuild, type Plugin, getSource } from '@kubb/core'\nimport type { generateSchema } from '../schemas/generateSchema.ts'\nimport type { z } from 'zod'\nimport type { CallToolResult } from '@modelcontextprotocol/sdk/types.d.ts'\n\nexport async function generate({ plugin, openApi, operationId }: z.infer<typeof generateSchema>): Promise<CallToolResult> {\n try {\n const include = [\n operationId\n ? {\n type: 'operationId',\n pattern: operationId,\n }\n : undefined,\n ].filter(Boolean) as Include[]\n\n const plugins = [\n pluginOas({ validate: false, generators: [] }),\n pluginTs({\n output: {\n path: 'typescript.ts',\n },\n generators: plugin === 'typescript' ? undefined : [],\n include,\n }),\n pluginReactQuery({\n output: {\n path: 'react-query.ts',\n },\n generators: plugin === 'react-query' ? undefined : [],\n include,\n }),\n ].filter(Boolean) as Plugin[]\n\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 }\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 const promises = files.map(async (file) => {\n return await getSource(file, { extname: '.ts' })\n })\n\n const sources = await Promise.all(promises)\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(sources, null, 2)}`,\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","import { McpServer } from '@modelcontextprotocol/sdk/server/mcp.js'\nimport { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio.js'\n\nimport { version } from '../package.json'\n\nimport process from 'node:process'\nimport { generateSchema } from './schemas/generateSchema.ts'\nimport { generate } from './tools/generate.ts'\n\nexport const server = new McpServer({\n name: 'Kubb',\n version,\n})\n\nserver.tool('generate', 'generate an openAPI spec to a code snippet', generateSchema.shape, generate)\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"]}
|