@kubb/plugin-mcp 4.28.1 → 4.29.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{Server-CI0jUJHC.js → Server-D3kNei96.js} +2 -2
- package/dist/{Server-CI0jUJHC.js.map → Server-D3kNei96.js.map} +1 -1
- package/dist/{Server-BiR53cpa.cjs → Server-N9lWEnVE.cjs} +2 -2
- package/dist/{Server-BiR53cpa.cjs.map → Server-N9lWEnVE.cjs.map} +1 -1
- package/dist/{chunk-eQyhnF5A.js → chunk-DKWOrOAv.js} +1 -1
- package/dist/components.cjs +2 -1
- package/dist/components.d.ts +2 -2
- package/dist/components.js +1 -1
- package/dist/generators.cjs +4 -3
- package/dist/generators.d.ts +5 -5
- package/dist/generators.js +1 -1
- package/dist/index.cjs +7 -6
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.js +5 -5
- package/dist/index.js.map +1 -1
- package/dist/{generators-CG-bxVZZ.cjs → serverGenerator-A8IBI-18.cjs} +2 -2
- package/dist/serverGenerator-A8IBI-18.cjs.map +1 -0
- package/dist/{generators-stveWfzc.js → serverGenerator-DfxZTxke.js} +3 -3
- package/dist/serverGenerator-DfxZTxke.js.map +1 -0
- package/dist/{types-Bjk9ZaZ5.d.ts → types-BTZNpUo1.d.ts} +2 -2
- package/dist/{types-CRIAfDoH.d.cts → types-DigTVU-V.d.ts} +2 -2
- package/package.json +18 -18
- package/src/generators/__snapshots__/server.ts +1 -1
- package/dist/components.d.cts +0 -40
- package/dist/generators-CG-bxVZZ.cjs.map +0 -1
- package/dist/generators-stveWfzc.js.map +0 -1
- package/dist/generators.d.cts +0 -471
- package/dist/index.d.cts +0 -10
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { t as __name } from "./chunk-
|
|
1
|
+
import { t as __name } from "./chunk-DKWOrOAv.js";
|
|
2
2
|
import { getPathParams, isOptional } from "@kubb/plugin-oas/utils";
|
|
3
3
|
import { Const, File, FunctionParams } from "@kubb/react-fabric";
|
|
4
4
|
import { jsx, jsxs } from "@kubb/react-fabric/jsx-runtime";
|
|
@@ -91,4 +91,4 @@ export async function startServer() {
|
|
|
91
91
|
|
|
92
92
|
//#endregion
|
|
93
93
|
export { Server as t };
|
|
94
|
-
//# sourceMappingURL=Server-
|
|
94
|
+
//# sourceMappingURL=Server-D3kNei96.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Server-
|
|
1
|
+
{"version":3,"file":"Server-D3kNei96.js","names":[],"sources":["../src/components/Server.tsx"],"sourcesContent":["import type { KubbFile } from '@kubb/fabric-core/types'\nimport { isNullable, isReference } from '@kubb/oas'\nimport type { OperationSchemas } from '@kubb/plugin-oas'\nimport { getPathParams, isOptional } from '@kubb/plugin-oas/utils'\nimport { Const, File, FunctionParams } from '@kubb/react-fabric'\nimport type { FabricReactNode } from '@kubb/react-fabric/types'\n\ntype Props = {\n name: string\n serverName: string\n serverVersion: string\n paramsCasing?: 'camelcase'\n operations: Array<{\n tool: {\n name: string\n description: string\n }\n mcp: {\n name: string\n file: KubbFile.File\n }\n zod: {\n name: string\n file: KubbFile.File\n schemas: OperationSchemas\n }\n type: {\n schemas: OperationSchemas\n }\n }>\n}\n\ntype GetParamsProps = {\n schemas: OperationSchemas\n paramsCasing?: 'camelcase'\n}\n\nfunction getParams({ schemas, paramsCasing }: GetParamsProps) {\n const pathParams = getPathParams(schemas.pathParams, {\n typed: false,\n casing: paramsCasing,\n })\n\n return FunctionParams.factory({\n data: {\n mode: 'object',\n children: {\n ...Object.entries(pathParams).reduce((acc, [key, param]) => {\n if (param && schemas.pathParams?.name) {\n let suffix = '.shape'\n\n if (isNullable(schemas.pathParams.schema)) {\n if (isReference(schemas.pathParams)) {\n suffix = '.unwrap().schema.unwrap().shape'\n } else {\n suffix = '.unwrap().shape'\n }\n } else {\n if (isReference(schemas.pathParams)) {\n suffix = '.schema.shape'\n }\n }\n\n param.value = `${schemas.pathParams?.name}${suffix}['${key}']`\n }\n\n return {\n ...acc,\n [key]: param,\n }\n }, {}),\n data: schemas.request?.name\n ? {\n value: schemas.request?.name,\n optional: isOptional(schemas.request?.schema),\n }\n : undefined,\n params: schemas.queryParams?.name\n ? {\n value: schemas.queryParams?.name,\n optional: isOptional(schemas.queryParams?.schema),\n }\n : undefined,\n headers: schemas.headerParams?.name\n ? {\n value: schemas.headerParams?.name,\n optional: isOptional(schemas.headerParams?.schema),\n }\n : undefined,\n },\n },\n })\n}\n\nexport function Server({ name, serverName, serverVersion, paramsCasing, operations }: Props): FabricReactNode {\n return (\n <File.Source name={name} isExportable isIndexable>\n <Const name={'server'} export>\n {`\n new McpServer({\n name: '${serverName}',\n version: '${serverVersion}',\n})\n `}\n </Const>\n\n {operations\n .map(({ tool, mcp, zod }) => {\n const paramsClient = getParams({ schemas: zod.schemas, paramsCasing })\n\n if (zod.schemas.request?.name || zod.schemas.headerParams?.name || zod.schemas.queryParams?.name || zod.schemas.pathParams?.name) {\n return `\nserver.tool(${JSON.stringify(tool.name)}, ${JSON.stringify(tool.description)}, ${paramsClient.toObjectValue()}, async (${paramsClient.toObject()}) => {\n return ${mcp.name}(${paramsClient.toObject()})\n})\n `\n }\n\n return `\nserver.tool(${JSON.stringify(tool.name)}, ${JSON.stringify(tool.description)}, async () => {\n return ${mcp.name}(${paramsClient.toObject()})\n})\n `\n })\n .filter(Boolean)}\n\n {`\nexport async function startServer() {\n try {\n const transport = new StdioServerTransport()\n await server.connect(transport)\n\n } catch (error) {\n console.error('Failed to start server:', error)\n process.exit(1)\n }\n}\n`}\n </File.Source>\n )\n}\n"],"mappings":";;;;;;;AAqCA,SAAS,UAAU,EAAE,SAAS,gBAAgC;CAC5D,MAAM,aAAa,cAAc,QAAQ,YAAY;EACnD,OAAO;EACP,QAAQ;EACT,CAAC;AAEF,QAAO,eAAe,QAAQ,EAC5B,MAAM;EACJ,MAAM;EACN,UAAU;GACR,GAAG,OAAO,QAAQ,WAAW,CAAC,Q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;;;AAKrC,WAAO;cACH,KAAK,UAAU,KAAK,KAAK,CAAC,IAAI,KAAK,UAAU,KAAK,YAAY,CAAC;WAClE,IAAI,KAAK,GAAG,aAAa,UAAU,CAAC;;;KAGrC,CACD,OAAO,QAAQ;GAEjB;;;;;;;;;;;;;GAYW"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
//#region
|
|
1
|
+
//#region \0rolldown/runtime.js
|
|
2
2
|
var __create = Object.create;
|
|
3
3
|
var __defProp = Object.defineProperty;
|
|
4
4
|
var __name = (target, value) => __defProp(target, "name", {
|
|
@@ -138,4 +138,4 @@ Object.defineProperty(exports, '__toESM', {
|
|
|
138
138
|
return __toESM;
|
|
139
139
|
}
|
|
140
140
|
});
|
|
141
|
-
//# sourceMappingURL=Server-
|
|
141
|
+
//# sourceMappingURL=Server-N9lWEnVE.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Server-
|
|
1
|
+
{"version":3,"file":"Server-N9lWEnVE.cjs","names":["FunctionParams","File","Const"],"sources":["../src/components/Server.tsx"],"sourcesContent":["import type { KubbFile } from '@kubb/fabric-core/types'\nimport { isNullable, isReference } from '@kubb/oas'\nimport type { OperationSchemas } from '@kubb/plugin-oas'\nimport { getPathParams, isOptional } from '@kubb/plugin-oas/utils'\nimport { Const, File, FunctionParams } from '@kubb/react-fabric'\nimport type { FabricReactNode } from '@kubb/react-fabric/types'\n\ntype Props = {\n name: string\n serverName: string\n serverVersion: string\n paramsCasing?: 'camelcase'\n operations: Array<{\n tool: {\n name: string\n description: string\n }\n mcp: {\n name: string\n file: KubbFile.File\n }\n zod: {\n name: string\n file: KubbFile.File\n schemas: OperationSchemas\n }\n type: {\n schemas: OperationSchemas\n }\n }>\n}\n\ntype GetParamsProps = {\n schemas: OperationSchemas\n paramsCasing?: 'camelcase'\n}\n\nfunction getParams({ schemas, paramsCasing }: GetParamsProps) {\n const pathParams = getPathParams(schemas.pathParams, {\n typed: false,\n casing: paramsCasing,\n })\n\n return FunctionParams.factory({\n data: {\n mode: 'object',\n children: {\n ...Object.entries(pathParams).reduce((acc, [key, param]) => {\n if (param && schemas.pathParams?.name) {\n let suffix = '.shape'\n\n if (isNullable(schemas.pathParams.schema)) {\n if (isReference(schemas.pathParams)) {\n suffix = '.unwrap().schema.unwrap().shape'\n } else {\n suffix = '.unwrap().shape'\n }\n } else {\n if (isReference(schemas.pathParams)) {\n suffix = '.schema.shape'\n }\n }\n\n param.value = `${schemas.pathParams?.name}${suffix}['${key}']`\n }\n\n return {\n ...acc,\n [key]: param,\n }\n }, {}),\n data: schemas.request?.name\n ? {\n value: schemas.request?.name,\n optional: isOptional(schemas.request?.schema),\n }\n : undefined,\n params: schemas.queryParams?.name\n ? {\n value: schemas.queryParams?.name,\n optional: isOptional(schemas.queryParams?.schema),\n }\n : undefined,\n headers: schemas.headerParams?.name\n ? {\n value: schemas.headerParams?.name,\n optional: isOptional(schemas.headerParams?.schema),\n }\n : undefined,\n },\n },\n })\n}\n\nexport function Server({ name, serverName, serverVersion, paramsCasing, operations }: Props): FabricReactNode {\n return (\n <File.Source name={name} isExportable isIndexable>\n <Const name={'server'} export>\n {`\n new McpServer({\n name: '${serverName}',\n version: '${serverVersion}',\n})\n `}\n </Const>\n\n {operations\n .map(({ tool, mcp, zod }) => {\n const paramsClient = getParams({ schemas: zod.schemas, paramsCasing })\n\n if (zod.schemas.request?.name || zod.schemas.headerParams?.name || zod.schemas.queryParams?.name || zod.schemas.pathParams?.name) {\n return `\nserver.tool(${JSON.stringify(tool.name)}, ${JSON.stringify(tool.description)}, ${paramsClient.toObjectValue()}, async (${paramsClient.toObject()}) => {\n return ${mcp.name}(${paramsClient.toObject()})\n})\n `\n }\n\n return `\nserver.tool(${JSON.stringify(tool.name)}, ${JSON.stringify(tool.description)}, async () => {\n return ${mcp.name}(${paramsClient.toObject()})\n})\n `\n })\n .filter(Boolean)}\n\n {`\nexport async function startServer() {\n try {\n const transport = new StdioServerTransport()\n await server.connect(transport)\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AAS,IAAI;KAAS;KAAc,CAAC;AAEtE,QAAI,IAAI,QAAQ,SAAS,QAAQ,IAAI,QAAQ,cAAc,QAAQ,IAAI,QAAQ,aAAa,QAAQ,IAAI,QAAQ,YAAY,KAC1H,QAAO;cACL,KAAK,UAAU,KAAK,KAAK,CAAC,IAAI,KAAK,UAAU,KAAK,YAAY,CAAC,IAAI,aAAa,eAAe,CAAC,WAAW,aAAa,UAAU,CAAC;WACtI,IAAI,KAAK,GAAG,aAAa,UAAU,CAAC;;;AAKrC,WAAO;cACH,KAAK,UAAU,KAAK,KAAK,CAAC,IAAI,KAAK,UAAU,KAAK,YAAY,CAAC;WAClE,IAAI,KAAK,GAAG,aAAa,UAAU,CAAC;;;KAGrC,CACD,OAAO,QAAQ;GAEjB;;;;;;;;;;;;;GAYW"}
|
package/dist/components.cjs
CHANGED
package/dist/components.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { t as __name } from "./chunk-
|
|
2
|
-
import { OperationSchemas } from "@kubb/plugin-oas";
|
|
1
|
+
import { t as __name } from "./chunk-cy2TeOE5.cjs";
|
|
3
2
|
import { KubbFile } from "@kubb/fabric-core/types";
|
|
3
|
+
import { OperationSchemas } from "@kubb/plugin-oas";
|
|
4
4
|
import { FabricReactNode } from "@kubb/react-fabric/types";
|
|
5
5
|
|
|
6
6
|
//#region src/components/Server.d.ts
|
package/dist/components.js
CHANGED
package/dist/generators.cjs
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
2
|
+
const require_serverGenerator = require('./serverGenerator-A8IBI-18.cjs');
|
|
2
3
|
|
|
3
|
-
exports.mcpGenerator =
|
|
4
|
-
exports.serverGenerator =
|
|
4
|
+
exports.mcpGenerator = require_serverGenerator.mcpGenerator;
|
|
5
|
+
exports.serverGenerator = require_serverGenerator.serverGenerator;
|
package/dist/generators.d.ts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { t as __name } from "./chunk-
|
|
2
|
-
import { n as PluginMcp } from "./types-
|
|
3
|
-
import { BaseGenerator, Config, FileMetaBase, Group, KubbEvents, Output, Plugin, PluginFactoryOptions, PluginManager, ResolveNameParams } from "@kubb/core";
|
|
4
|
-
import { Fabric } from "@kubb/react-fabric";
|
|
5
|
-
import { HttpMethod, Oas, Operation, SchemaObject, contentType } from "@kubb/oas";
|
|
1
|
+
import { t as __name } from "./chunk-cy2TeOE5.cjs";
|
|
2
|
+
import { n as PluginMcp } from "./types-DigTVU-V.js";
|
|
6
3
|
import { KubbFile } from "@kubb/fabric-core/types";
|
|
7
4
|
import { FabricReactNode } from "@kubb/react-fabric/types";
|
|
5
|
+
import { BaseGenerator, Config, FileMetaBase, Group, KubbEvents, Output, Plugin, PluginFactoryOptions, PluginManager, ResolveNameParams } from "@kubb/core";
|
|
6
|
+
import { HttpMethod, Oas, Operation, SchemaObject, contentType } from "@kubb/oas";
|
|
8
7
|
import { AsyncEventEmitter } from "@kubb/core/utils";
|
|
8
|
+
import { Fabric } from "@kubb/react-fabric";
|
|
9
9
|
|
|
10
10
|
//#region ../plugin-oas/src/types.d.ts
|
|
11
11
|
type GetOasOptions = {
|
package/dist/generators.js
CHANGED
package/dist/index.cjs
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
const
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
2
|
+
const require_Server = require('./Server-N9lWEnVE.cjs');
|
|
3
|
+
const require_serverGenerator = require('./serverGenerator-A8IBI-18.cjs');
|
|
3
4
|
let node_path = require("node:path");
|
|
4
5
|
node_path = require_Server.__toESM(node_path);
|
|
5
6
|
let _kubb_core = require("@kubb/core");
|
|
@@ -18,7 +19,7 @@ const pluginMcp = (0, _kubb_core.definePlugin)((options) => {
|
|
|
18
19
|
const { output = {
|
|
19
20
|
path: "mcp",
|
|
20
21
|
barrelType: "named"
|
|
21
|
-
}, group, exclude = [], include, override = [], transformers = {}, generators = [
|
|
22
|
+
}, group, exclude = [], include, override = [], transformers = {}, generators = [require_serverGenerator.mcpGenerator, require_serverGenerator.serverGenerator].filter(Boolean), contentType, paramsCasing, client } = options;
|
|
22
23
|
const clientName = client?.client ?? "axios";
|
|
23
24
|
const clientImportPath = client?.importPath ?? (!client?.bundle ? `@kubb/plugin-client/clients/${clientName}` : void 0);
|
|
24
25
|
return {
|
|
@@ -42,7 +43,7 @@ const pluginMcp = (0, _kubb_core.definePlugin)((options) => {
|
|
|
42
43
|
_kubb_plugin_ts.pluginTsName,
|
|
43
44
|
_kubb_plugin_zod.pluginZodName
|
|
44
45
|
].filter(Boolean),
|
|
45
|
-
resolvePath(baseName, pathMode, options
|
|
46
|
+
resolvePath(baseName, pathMode, options) {
|
|
46
47
|
const root = node_path.default.resolve(this.config.root, this.config.output.path);
|
|
47
48
|
if ((pathMode ?? (0, _kubb_core.getMode)(node_path.default.resolve(root, output.path))) === "single")
|
|
48
49
|
/**
|
|
@@ -50,12 +51,12 @@ const pluginMcp = (0, _kubb_core.definePlugin)((options) => {
|
|
|
50
51
|
* Other plugins then need to call addOrAppend instead of just add from the fileManager class
|
|
51
52
|
*/
|
|
52
53
|
return node_path.default.resolve(root, output.path);
|
|
53
|
-
if (group && (options
|
|
54
|
+
if (group && (options?.group?.path || options?.group?.tag)) {
|
|
54
55
|
const groupName = group?.name ? group.name : (ctx) => {
|
|
55
56
|
if (group?.type === "path") return `${ctx.group.split("/")[1]}`;
|
|
56
57
|
return `${(0, _kubb_core_transformers.camelCase)(ctx.group)}Requests`;
|
|
57
58
|
};
|
|
58
|
-
return node_path.default.resolve(root, output.path, groupName({ group: group.type === "path" ? options
|
|
59
|
+
return node_path.default.resolve(root, output.path, groupName({ group: group.type === "path" ? options.group.path : options.group.tag }), baseName);
|
|
59
60
|
}
|
|
60
61
|
return node_path.default.resolve(root, output.path, baseName);
|
|
61
62
|
},
|
package/dist/index.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","names":["mcpGenerator","serverGenerator","pluginOasName","pluginTsName","pluginZodName","path","
|
|
1
|
+
{"version":3,"file":"index.cjs","names":["mcpGenerator","serverGenerator","pluginOasName","pluginTsName","pluginZodName","path","pluginClientName","fetchClientSource","axiosClientSource","configSource","OperationGenerator"],"sources":["../src/plugin.ts"],"sourcesContent":["import path from 'node:path'\nimport { definePlugin, type Group, getBarrelFiles, getMode } from '@kubb/core'\nimport { camelCase } from '@kubb/core/transformers'\nimport { pluginClientName } from '@kubb/plugin-client'\nimport { source as axiosClientSource } from '@kubb/plugin-client/templates/clients/axios.source'\nimport { source as fetchClientSource } from '@kubb/plugin-client/templates/clients/fetch.source'\nimport { source as configSource } from '@kubb/plugin-client/templates/config.source'\nimport { OperationGenerator, pluginOasName } from '@kubb/plugin-oas'\nimport { pluginTsName } from '@kubb/plugin-ts'\nimport { pluginZodName } from '@kubb/plugin-zod'\nimport { mcpGenerator, serverGenerator } from './generators'\nimport type { PluginMcp } from './types.ts'\n\nexport const pluginMcpName = 'plugin-mcp' satisfies PluginMcp['name']\n\nexport const pluginMcp = definePlugin<PluginMcp>((options) => {\n const {\n output = { path: 'mcp', barrelType: 'named' },\n group,\n exclude = [],\n include,\n override = [],\n transformers = {},\n generators = [mcpGenerator, serverGenerator].filter(Boolean),\n contentType,\n paramsCasing,\n client,\n } = options\n\n const clientName = client?.client ?? 'axios'\n const clientImportPath = client?.importPath ?? (!client?.bundle ? `@kubb/plugin-client/clients/${clientName}` : undefined)\n\n return {\n name: pluginMcpName,\n options: {\n output,\n group,\n paramsCasing,\n client: {\n client: clientName,\n clientType: client?.clientType ?? 'function',\n importPath: clientImportPath,\n dataReturnType: client?.dataReturnType ?? 'data',\n bundle: client?.bundle,\n baseURL: client?.baseURL,\n paramsCasing: client?.paramsCasing,\n },\n },\n pre: [pluginOasName, pluginTsName, pluginZodName].filter(Boolean),\n resolvePath(baseName, pathMode, options) {\n const root = path.resolve(this.config.root, this.config.output.path)\n const mode = pathMode ?? getMode(path.resolve(root, output.path))\n\n if (mode === 'single') {\n /**\n * when output is a file then we will always append to the same file(output file), see fileManager.addOrAppend\n * Other plugins then need to call addOrAppend instead of just add from the fileManager class\n */\n return path.resolve(root, output.path)\n }\n\n if (group && (options?.group?.path || options?.group?.tag)) {\n const groupName: Group['name'] = group?.name\n ? group.name\n : (ctx) => {\n if (group?.type === 'path') {\n return `${ctx.group.split('/')[1]}`\n }\n return `${camelCase(ctx.group)}Requests`\n }\n\n return path.resolve(\n root,\n output.path,\n groupName({\n group: group.type === 'path' ? options.group.path! : options.group.tag!,\n }),\n baseName,\n )\n }\n\n return path.resolve(root, output.path, baseName)\n },\n resolveName(name, type) {\n const resolvedName = camelCase(name, {\n isFile: type === 'file',\n })\n\n if (type) {\n return transformers?.name?.(resolvedName, type) || resolvedName\n }\n\n return resolvedName\n },\n async install() {\n const root = path.resolve(this.config.root, this.config.output.path)\n const mode = getMode(path.resolve(root, output.path))\n const oas = await this.getOas()\n const baseURL = await this.getBaseURL()\n\n if (baseURL) {\n this.plugin.options.client.baseURL = baseURL\n }\n\n const hasClientPlugin = !!this.pluginManager.getPluginByKey([pluginClientName])\n\n if (this.plugin.options.client.bundle && !hasClientPlugin && !this.plugin.options.client.importPath) {\n // pre add bundled fetch\n await this.addFile({\n baseName: 'fetch.ts',\n path: path.resolve(root, '.kubb/fetch.ts'),\n sources: [\n {\n name: 'fetch',\n value: this.plugin.options.client.client === 'fetch' ? fetchClientSource : axiosClientSource,\n isExportable: true,\n isIndexable: true,\n },\n ],\n imports: [],\n exports: [],\n })\n }\n\n if (!hasClientPlugin) {\n await this.addFile({\n baseName: 'config.ts',\n path: path.resolve(root, '.kubb/config.ts'),\n sources: [\n {\n name: 'config',\n value: configSource,\n isExportable: false,\n isIndexable: false,\n },\n ],\n imports: [],\n exports: [],\n })\n }\n\n const operationGenerator = new OperationGenerator(this.plugin.options, {\n fabric: this.fabric,\n oas,\n pluginManager: this.pluginManager,\n events: this.events,\n plugin: this.plugin,\n contentType,\n exclude,\n include,\n override,\n mode,\n })\n\n const files = await operationGenerator.build(...generators)\n await this.upsertFile(...files)\n\n const barrelFiles = await getBarrelFiles(this.fabric.files, {\n type: output.barrelType ?? 'named',\n root,\n output,\n meta: {\n pluginKey: this.plugin.key,\n },\n })\n\n await this.upsertFile(...barrelFiles)\n },\n }\n})\n"],"mappings":";;;;;;;;;;;;;;;;AAaA,MAAa,gBAAgB;AAE7B,MAAa,0CAAqC,YAAY;CAC5D,MAAM,EACJ,SAAS;EAAE,MAAM;EAAO,YAAY;EAAS,EAC7C,OACA,UAAU,EAAE,EACZ,SACA,WAAW,EAAE,EACb,eAAe,EAAE,EACjB,aAAa,CAACA,sCAAcC,wCAAgB,CAAC,OAAO,QAAQ,EAC5D,aACA,cACA,WACE;CAEJ,MAAM,aAAa,QAAQ,UAAU;CACrC,MAAM,mBAAmB,QAAQ,eAAe,CAAC,QAAQ,SAAS,+BAA+B,eAAe;AAEhH,QAAO;EACL,MAAM;EACN,SAAS;GACP;GACA;GACA;GACA,QAAQ;IACN,QAAQ;IACR,YAAY,QAAQ,cAAc;IAClC,YAAY;IACZ,gBAAgB,QAAQ,kBAAkB;IAC1C,QAAQ,QAAQ;IAChB,SAAS,QAAQ;IACjB,cAAc,QAAQ;IACvB;GACF;EACD,KAAK;GAACC;GAAeC;GAAcC;GAAc,CAAC,OAAO,QAAQ;EACjE,YAAY,UAAU,UAAU,SAAS;GACvC,MAAM,OAAOC,kBAAK,QAAQ,KAAK,OAAO,MAAM,KAAK,OAAO,OAAO,KAAK;AAGpE,QAFa,oCAAoBA,kBAAK,QAAQ,MAAM,OAAO,KAAK,CAAC,MAEpD;;;;;AAKX,UAAOA,kBAAK,QAAQ,MAAM,OAAO,KAAK;AAGxC,OAAI,UAAU,SAAS,OAAO,QAAQ,SAAS,OAAO,MAAM;IAC1D,MAAM,YAA2B,OAAO,OACpC,MAAM,QACL,QAAQ;AACP,SA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,CACP;KACE,MAAM;KACN,OAAOI;KACP,cAAc;KACd,aAAa;KACd,CACF;IACD,SAAS,EAAE;IACX,SAAS,EAAE;IACZ,CAAC;GAgBJ,MAAM,QAAQ,MAba,IAAIC,oCAAmB,KAAK,OAAO,SAAS;IACrE,QAAQ,KAAK;IACb;IACA,eAAe,KAAK;IACpB,QAAQ,KAAK;IACb,QAAQ,KAAK;IACb;IACA;IACA;IACA;IACA;IACD,CAAC,CAEqC,MAAM,GAAG,WAAW;AAC3D,SAAM,KAAK,WAAW,GAAG,MAAM;GAE/B,MAAM,cAAc,qCAAqB,KAAK,OAAO,OAAO;IAC1D,MAAM,OAAO,cAAc;IAC3B;IACA;IACA,MAAM,EACJ,WAAW,KAAK,OAAO,KACxB;IACF,CAAC;AAEF,SAAM,KAAK,WAAW,GAAG,YAAY;;EAExC;EACD"}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { t as __name } from "./chunk-
|
|
2
|
-
import { n as PluginMcp, t as Options } from "./types-
|
|
1
|
+
import { t as __name } from "./chunk-cy2TeOE5.cjs";
|
|
2
|
+
import { n as PluginMcp, t as Options } from "./types-DigTVU-V.js";
|
|
3
3
|
import * as _kubb_core0 from "@kubb/core";
|
|
4
4
|
|
|
5
5
|
//#region src/plugin.d.ts
|
package/dist/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { t as __name } from "./chunk-
|
|
2
|
-
import { n as mcpGenerator, t as serverGenerator } from "./
|
|
1
|
+
import { t as __name } from "./chunk-DKWOrOAv.js";
|
|
2
|
+
import { n as mcpGenerator, t as serverGenerator } from "./serverGenerator-DfxZTxke.js";
|
|
3
3
|
import path from "node:path";
|
|
4
4
|
import { definePlugin, getBarrelFiles, getMode } from "@kubb/core";
|
|
5
5
|
import { camelCase } from "@kubb/core/transformers";
|
|
@@ -41,7 +41,7 @@ const pluginMcp = definePlugin((options) => {
|
|
|
41
41
|
pluginTsName,
|
|
42
42
|
pluginZodName
|
|
43
43
|
].filter(Boolean),
|
|
44
|
-
resolvePath(baseName, pathMode, options
|
|
44
|
+
resolvePath(baseName, pathMode, options) {
|
|
45
45
|
const root = path.resolve(this.config.root, this.config.output.path);
|
|
46
46
|
if ((pathMode ?? getMode(path.resolve(root, output.path))) === "single")
|
|
47
47
|
/**
|
|
@@ -49,12 +49,12 @@ const pluginMcp = definePlugin((options) => {
|
|
|
49
49
|
* Other plugins then need to call addOrAppend instead of just add from the fileManager class
|
|
50
50
|
*/
|
|
51
51
|
return path.resolve(root, output.path);
|
|
52
|
-
if (group && (options
|
|
52
|
+
if (group && (options?.group?.path || options?.group?.tag)) {
|
|
53
53
|
const groupName = group?.name ? group.name : (ctx) => {
|
|
54
54
|
if (group?.type === "path") return `${ctx.group.split("/")[1]}`;
|
|
55
55
|
return `${camelCase(ctx.group)}Requests`;
|
|
56
56
|
};
|
|
57
|
-
return path.resolve(root, output.path, groupName({ group: group.type === "path" ? options
|
|
57
|
+
return path.resolve(root, output.path, groupName({ group: group.type === "path" ? options.group.path : options.group.tag }), baseName);
|
|
58
58
|
}
|
|
59
59
|
return path.resolve(root, output.path, baseName);
|
|
60
60
|
},
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["
|
|
1
|
+
{"version":3,"file":"index.js","names":["fetchClientSource","axiosClientSource","configSource"],"sources":["../src/plugin.ts"],"sourcesContent":["import path from 'node:path'\nimport { definePlugin, type Group, getBarrelFiles, getMode } from '@kubb/core'\nimport { camelCase } from '@kubb/core/transformers'\nimport { pluginClientName } from '@kubb/plugin-client'\nimport { source as axiosClientSource } from '@kubb/plugin-client/templates/clients/axios.source'\nimport { source as fetchClientSource } from '@kubb/plugin-client/templates/clients/fetch.source'\nimport { source as configSource } from '@kubb/plugin-client/templates/config.source'\nimport { OperationGenerator, pluginOasName } from '@kubb/plugin-oas'\nimport { pluginTsName } from '@kubb/plugin-ts'\nimport { pluginZodName } from '@kubb/plugin-zod'\nimport { mcpGenerator, serverGenerator } from './generators'\nimport type { PluginMcp } from './types.ts'\n\nexport const pluginMcpName = 'plugin-mcp' satisfies PluginMcp['name']\n\nexport const pluginMcp = definePlugin<PluginMcp>((options) => {\n const {\n output = { path: 'mcp', barrelType: 'named' },\n group,\n exclude = [],\n include,\n override = [],\n transformers = {},\n generators = [mcpGenerator, serverGenerator].filter(Boolean),\n contentType,\n paramsCasing,\n client,\n } = options\n\n const clientName = client?.client ?? 'axios'\n const clientImportPath = client?.importPath ?? (!client?.bundle ? `@kubb/plugin-client/clients/${clientName}` : undefined)\n\n return {\n name: pluginMcpName,\n options: {\n output,\n group,\n paramsCasing,\n client: {\n client: clientName,\n clientType: client?.clientType ?? 'function',\n importPath: clientImportPath,\n dataReturnType: client?.dataReturnType ?? 'data',\n bundle: client?.bundle,\n baseURL: client?.baseURL,\n paramsCasing: client?.paramsCasing,\n },\n },\n pre: [pluginOasName, pluginTsName, pluginZodName].filter(Boolean),\n resolvePath(baseName, pathMode, options) {\n const root = path.resolve(this.config.root, this.config.output.path)\n const mode = pathMode ?? getMode(path.resolve(root, output.path))\n\n if (mode === 'single') {\n /**\n * when output is a file then we will always append to the same file(output file), see fileManager.addOrAppend\n * Other plugins then need to call addOrAppend instead of just add from the fileManager class\n */\n return path.resolve(root, output.path)\n }\n\n if (group && (options?.group?.path || options?.group?.tag)) {\n const groupName: Group['name'] = group?.name\n ? group.name\n : (ctx) => {\n if (group?.type === 'path') {\n return `${ctx.group.split('/')[1]}`\n }\n return `${camelCase(ctx.group)}Requests`\n }\n\n return path.resolve(\n root,\n output.path,\n groupName({\n group: group.type === 'path' ? options.group.path! : options.group.tag!,\n }),\n baseName,\n )\n }\n\n return path.resolve(root, output.path, baseName)\n },\n resolveName(name, type) {\n const resolvedName = camelCase(name, {\n isFile: type === 'file',\n })\n\n if (type) {\n return transformers?.name?.(resolvedName, type) || resolvedName\n }\n\n return resolvedName\n },\n async install() {\n const root = path.resolve(this.config.root, this.config.output.path)\n const mode = getMode(path.resolve(root, output.path))\n const oas = await this.getOas()\n const baseURL = await this.getBaseURL()\n\n if (baseURL) {\n this.plugin.options.client.baseURL = baseURL\n }\n\n const hasClientPlugin = !!this.pluginManager.getPluginByKey([pluginClientName])\n\n if (this.plugin.options.client.bundle && !hasClientPlugin && !this.plugin.options.client.importPath) {\n // pre add bundled fetch\n await this.addFile({\n baseName: 'fetch.ts',\n path: path.resolve(root, '.kubb/fetch.ts'),\n sources: [\n {\n name: 'fetch',\n value: this.plugin.options.client.client === 'fetch' ? fetchClientSource : axiosClientSource,\n isExportable: true,\n isIndexable: true,\n },\n ],\n imports: [],\n exports: [],\n })\n }\n\n if (!hasClientPlugin) {\n await this.addFile({\n baseName: 'config.ts',\n path: path.resolve(root, '.kubb/config.ts'),\n sources: [\n {\n name: 'config',\n value: configSource,\n isExportable: false,\n isIndexable: false,\n },\n ],\n imports: [],\n exports: [],\n })\n }\n\n const operationGenerator = new OperationGenerator(this.plugin.options, {\n fabric: this.fabric,\n oas,\n pluginManager: this.pluginManager,\n events: this.events,\n plugin: this.plugin,\n contentType,\n exclude,\n include,\n override,\n mode,\n })\n\n const files = await operationGenerator.build(...generators)\n await this.upsertFile(...files)\n\n const barrelFiles = await getBarrelFiles(this.fabric.files, {\n type: output.barrelType ?? 'named',\n root,\n output,\n meta: {\n pluginKey: this.plugin.key,\n },\n })\n\n await this.upsertFile(...barrelFiles)\n },\n }\n})\n"],"mappings":";;;;;;;;;;;;;;AAaA,MAAa,gBAAgB;AAE7B,MAAa,YAAY,cAAyB,YAAY;CAC5D,MAAM,EACJ,SAAS;EAAE,MAAM;EAAO,YAAY;EAAS,EAC7C,OACA,UAAU,EAAE,EACZ,SACA,WAAW,EAAE,EACb,eAAe,EAAE,EACjB,aAAa,CAAC,cAAc,gBAAgB,CAAC,OAAO,QAAQ,EAC5D,aACA,cACA,WACE;CAEJ,MAAM,aAAa,QAAQ,UAAU;CACrC,MAAM,mBAAmB,QAAQ,eAAe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require_Server = require('./Server-N9lWEnVE.cjs');
|
|
2
2
|
let node_path = require("node:path");
|
|
3
3
|
node_path = require_Server.__toESM(node_path);
|
|
4
4
|
let _kubb_plugin_ts = require("@kubb/plugin-ts");
|
|
@@ -276,4 +276,4 @@ Object.defineProperty(exports, 'serverGenerator', {
|
|
|
276
276
|
return serverGenerator;
|
|
277
277
|
}
|
|
278
278
|
});
|
|
279
|
-
//# sourceMappingURL=
|
|
279
|
+
//# sourceMappingURL=serverGenerator-A8IBI-18.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"serverGenerator-A8IBI-18.cjs","names":["pluginTsName","File","path","Client","pluginZodName","pluginTsName","File","Server"],"sources":["../src/generators/mcpGenerator.tsx","../src/generators/serverGenerator.tsx"],"sourcesContent":["import path from 'node:path'\nimport { Client } from '@kubb/plugin-client/components'\nimport { createReactGenerator } from '@kubb/plugin-oas/generators'\nimport { useOas, useOperationManager } from '@kubb/plugin-oas/hooks'\nimport { getBanner, getFooter } from '@kubb/plugin-oas/utils'\nimport { pluginTsName } from '@kubb/plugin-ts'\nimport { File } from '@kubb/react-fabric'\nimport type { PluginMcp } from '../types'\n\nexport const mcpGenerator = createReactGenerator<PluginMcp>({\n name: 'mcp',\n Operation({ config, operation, generator, plugin }) {\n const { options } = plugin\n const oas = useOas()\n\n const { getSchemas, getName, getFile } = useOperationManager(generator)\n\n const mcp = {\n name: getName(operation, { type: 'function', suffix: 'handler' }),\n file: getFile(operation),\n }\n\n const type = {\n file: getFile(operation, { pluginKey: [pluginTsName] }),\n schemas: getSchemas(operation, { pluginKey: [pluginTsName], type: 'type' }),\n }\n\n return (\n <File\n baseName={mcp.file.baseName}\n path={mcp.file.path}\n meta={mcp.file.meta}\n banner={getBanner({ oas, output: options.output })}\n footer={getFooter({ oas, output: options.output })}\n >\n {options.client.importPath ? (\n <>\n <File.Import name={'fetch'} path={options.client.importPath} />\n <File.Import name={['Client', 'RequestConfig', 'ResponseErrorConfig']} path={options.client.importPath} isTypeOnly />\n {options.client.dataReturnType === 'full' && <File.Import name={['ResponseConfig']} path={options.client.importPath} isTypeOnly />}\n </>\n ) : (\n <>\n <File.Import name={['fetch']} root={mcp.file.path} path={path.resolve(config.root, config.output.path, '.kubb/fetch.ts')} />\n <File.Import\n name={['Client', 'RequestConfig', 'ResponseErrorConfig']}\n root={mcp.file.path}\n path={path.resolve(config.root, config.output.path, '.kubb/fetch.ts')}\n isTypeOnly\n />\n {options.client.dataReturnType === 'full' && (\n <File.Import name={['ResponseConfig']} root={mcp.file.path} path={path.resolve(config.root, config.output.path, '.kubb/fetch.ts')} isTypeOnly />\n )}\n </>\n )}\n <File.Import name={['buildFormData']} root={mcp.file.path} path={path.resolve(config.root, config.output.path, '.kubb/config.ts')} />\n <File.Import name={['CallToolResult']} path={'@modelcontextprotocol/sdk/types'} isTypeOnly />\n <File.Import\n name={[\n type.schemas.request?.name,\n type.schemas.response.name,\n type.schemas.pathParams?.name,\n type.schemas.queryParams?.name,\n type.schemas.headerParams?.name,\n ...(type.schemas.statusCodes?.map((item) => item.name) || []),\n ].filter(Boolean)}\n root={mcp.file.path}\n path={type.file.path}\n isTypeOnly\n />\n\n <Client\n name={mcp.name}\n isConfigurable={false}\n returnType={'Promise<CallToolResult>'}\n baseURL={options.client.baseURL}\n operation={operation}\n typeSchemas={type.schemas}\n zodSchemas={undefined}\n dataReturnType={options.client.dataReturnType || 'data'}\n paramsType={'object'}\n paramsCasing={options.client?.paramsCasing || options.paramsCasing}\n pathParamsType={'object'}\n parser={'client'}\n >\n {options.client.dataReturnType === 'data' &&\n `return {\n content: [\n {\n type: 'text',\n text: JSON.stringify(res.data)\n }\n ]\n }`}\n {options.client.dataReturnType === 'full' &&\n `return {\n content: [\n {\n type: 'text',\n text: JSON.stringify(res)\n }\n ]\n }`}\n </Client>\n </File>\n )\n },\n})\n","import { usePluginManager } from '@kubb/core/hooks'\nimport { createReactGenerator } from '@kubb/plugin-oas/generators'\nimport { useOas, useOperationManager } from '@kubb/plugin-oas/hooks'\nimport { getBanner, getFooter } from '@kubb/plugin-oas/utils'\nimport { pluginTsName } from '@kubb/plugin-ts'\nimport { pluginZodName } from '@kubb/plugin-zod'\nimport { File } from '@kubb/react-fabric'\nimport { Server } from '../components/Server'\nimport type { PluginMcp } from '../types'\n\nexport const serverGenerator = createReactGenerator<PluginMcp>({\n name: 'operations',\n Operations({ operations, generator, plugin }) {\n const pluginManager = usePluginManager()\n const { options } = plugin\n\n const oas = useOas()\n const { getFile, getName, getSchemas } = useOperationManager(generator)\n\n const name = 'server'\n const file = pluginManager.getFile({ name, extname: '.ts', pluginKey: plugin.key })\n\n const jsonFile = pluginManager.getFile({ name: '.mcp', extname: '.json', pluginKey: plugin.key })\n\n const operationsMapped = operations.map((operation) => {\n return {\n tool: {\n name: operation.getOperationId() || operation.getSummary() || `${operation.method.toUpperCase()} ${operation.path}`,\n description: operation.getDescription() || `Make a ${operation.method.toUpperCase()} request to ${operation.path}`,\n },\n mcp: {\n name: getName(operation, {\n type: 'function',\n suffix: 'handler',\n }),\n file: getFile(operation),\n },\n zod: {\n name: getName(operation, {\n type: 'function',\n pluginKey: [pluginZodName],\n }),\n schemas: getSchemas(operation, { pluginKey: [pluginZodName], type: 'function' }),\n file: getFile(operation, { pluginKey: [pluginZodName] }),\n },\n type: {\n schemas: getSchemas(operation, { pluginKey: [pluginTsName], type: 'type' }),\n },\n }\n })\n\n const imports = operationsMapped.flatMap(({ mcp, zod }) => {\n return [\n <File.Import key={mcp.name} name={[mcp.name]} root={file.path} path={mcp.file.path} />,\n <File.Import\n key={zod.name}\n name={[zod.schemas.request?.name, zod.schemas.pathParams?.name, zod.schemas.queryParams?.name, zod.schemas.headerParams?.name].filter(Boolean)}\n root={file.path}\n path={zod.file.path}\n />,\n ]\n })\n\n return (\n <>\n <File\n baseName={file.baseName}\n path={file.path}\n meta={file.meta}\n banner={getBanner({ oas, output: options.output, config: pluginManager.config })}\n footer={getFooter({ oas, output: options.output })}\n >\n <File.Import name={['McpServer']} path={'@modelcontextprotocol/sdk/server/mcp'} />\n <File.Import name={['StdioServerTransport']} path={'@modelcontextprotocol/sdk/server/stdio'} />\n\n {imports}\n <Server\n name={name}\n serverName={oas.api.info?.title}\n serverVersion={oas.getVersion()}\n paramsCasing={options.paramsCasing}\n operations={operationsMapped}\n />\n </File>\n\n <File baseName={jsonFile.baseName} path={jsonFile.path} meta={jsonFile.meta}>\n <File.Source name={name}>\n {`\n {\n \"mcpServers\": {\n \"${oas.api.info?.title || 'server'}\": {\n \"type\": \"stdio\",\n \"command\": \"npx\",\n \"args\": [\"tsx\", \"${file.path}\"]\n }\n }\n }\n `}\n </File.Source>\n </File>\n </>\n )\n },\n})\n"],"mappings":";;;;;;;;;;;;;;AASA,MAAa,qEAA+C;CAC1D,MAAM;CACN,UAAU,EAAE,QAAQ,WAAW,WAAW,UAAU;EAClD,MAAM,EAAE,YAAY;EACpB,MAAM,0CAAc;EAEpB,MAAM,EAAE,YAAY,SAAS,4DAAgC,UAAU;EAEvE,MAAM,MAAM;GACV,MAAM,QAAQ,WAAW;IAAE,MAAM;IAAY,QAAQ;IAAW,CAAC;GACjE,MAAM,QAAQ,UAAU;GACzB;EAED,MAAM,OAAO;GACX,MAAM,QAAQ,WAAW,EAAE,WAAW,CAACA,6BAAa,EAAE,CAAC;GACvD,SAAS,WAAW,WAAW;IAAE,WAAW,CAACA,6BAAa;IAAE,MAAM;IAAQ,CAAC;GAC5E;AAED,SACE,yDAACC;GACC,UAAU,IAAI,KAAK;GACnB,MAAM,IAAI,KAAK;GACf,MAAM,IAAI,KAAK;GACf,8CAAkB;IAAE;IAAK,QAAQ,QAAQ;IAAQ,CAAC;GAClD,8CAAkB;IAAE;IAAK,QAAQ,QAAQ;IAAQ,CAAC;;IAEjD,QAAQ,OAAO,aACd;KACE,wDAACA,wBAAK;MAAO,MAAM;MAAS,MAAM,QAAQ,OAAO;OAAc;KAC/D,wDAACA,wBAAK;MAAO,MAAM;OAAC;OAAU;OAAiB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Server } from "./Server-
|
|
1
|
+
import { t as __name } from "./chunk-DKWOrOAv.js";
|
|
2
|
+
import { t as Server } from "./Server-D3kNei96.js";
|
|
3
3
|
import path from "node:path";
|
|
4
4
|
import { pluginTsName } from "@kubb/plugin-ts";
|
|
5
5
|
import { pluginZodName } from "@kubb/plugin-zod";
|
|
@@ -265,4 +265,4 @@ const serverGenerator = createReactGenerator({
|
|
|
265
265
|
|
|
266
266
|
//#endregion
|
|
267
267
|
export { mcpGenerator as n, serverGenerator as t };
|
|
268
|
-
//# sourceMappingURL=
|
|
268
|
+
//# sourceMappingURL=serverGenerator-DfxZTxke.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"serverGenerator-DfxZTxke.js","names":[],"sources":["../src/generators/mcpGenerator.tsx","../src/generators/serverGenerator.tsx"],"sourcesContent":["import path from 'node:path'\nimport { Client } from '@kubb/plugin-client/components'\nimport { createReactGenerator } from '@kubb/plugin-oas/generators'\nimport { useOas, useOperationManager } from '@kubb/plugin-oas/hooks'\nimport { getBanner, getFooter } from '@kubb/plugin-oas/utils'\nimport { pluginTsName } from '@kubb/plugin-ts'\nimport { File } from '@kubb/react-fabric'\nimport type { PluginMcp } from '../types'\n\nexport const mcpGenerator = createReactGenerator<PluginMcp>({\n name: 'mcp',\n Operation({ config, operation, generator, plugin }) {\n const { options } = plugin\n const oas = useOas()\n\n const { getSchemas, getName, getFile } = useOperationManager(generator)\n\n const mcp = {\n name: getName(operation, { type: 'function', suffix: 'handler' }),\n file: getFile(operation),\n }\n\n const type = {\n file: getFile(operation, { pluginKey: [pluginTsName] }),\n schemas: getSchemas(operation, { pluginKey: [pluginTsName], type: 'type' }),\n }\n\n return (\n <File\n baseName={mcp.file.baseName}\n path={mcp.file.path}\n meta={mcp.file.meta}\n banner={getBanner({ oas, output: options.output })}\n footer={getFooter({ oas, output: options.output })}\n >\n {options.client.importPath ? (\n <>\n <File.Import name={'fetch'} path={options.client.importPath} />\n <File.Import name={['Client', 'RequestConfig', 'ResponseErrorConfig']} path={options.client.importPath} isTypeOnly />\n {options.client.dataReturnType === 'full' && <File.Import name={['ResponseConfig']} path={options.client.importPath} isTypeOnly />}\n </>\n ) : (\n <>\n <File.Import name={['fetch']} root={mcp.file.path} path={path.resolve(config.root, config.output.path, '.kubb/fetch.ts')} />\n <File.Import\n name={['Client', 'RequestConfig', 'ResponseErrorConfig']}\n root={mcp.file.path}\n path={path.resolve(config.root, config.output.path, '.kubb/fetch.ts')}\n isTypeOnly\n />\n {options.client.dataReturnType === 'full' && (\n <File.Import name={['ResponseConfig']} root={mcp.file.path} path={path.resolve(config.root, config.output.path, '.kubb/fetch.ts')} isTypeOnly />\n )}\n </>\n )}\n <File.Import name={['buildFormData']} root={mcp.file.path} path={path.resolve(config.root, config.output.path, '.kubb/config.ts')} />\n <File.Import name={['CallToolResult']} path={'@modelcontextprotocol/sdk/types'} isTypeOnly />\n <File.Import\n name={[\n type.schemas.request?.name,\n type.schemas.response.name,\n type.schemas.pathParams?.name,\n type.schemas.queryParams?.name,\n type.schemas.headerParams?.name,\n ...(type.schemas.statusCodes?.map((item) => item.name) || []),\n ].filter(Boolean)}\n root={mcp.file.path}\n path={type.file.path}\n isTypeOnly\n />\n\n <Client\n name={mcp.name}\n isConfigurable={false}\n returnType={'Promise<CallToolResult>'}\n baseURL={options.client.baseURL}\n operation={operation}\n typeSchemas={type.schemas}\n zodSchemas={undefined}\n dataReturnType={options.client.dataReturnType || 'data'}\n paramsType={'object'}\n paramsCasing={options.client?.paramsCasing || options.paramsCasing}\n pathParamsType={'object'}\n parser={'client'}\n >\n {options.client.dataReturnType === 'data' &&\n `return {\n content: [\n {\n type: 'text',\n text: JSON.stringify(res.data)\n }\n ]\n }`}\n {options.client.dataReturnType === 'full' &&\n `return {\n content: [\n {\n type: 'text',\n text: JSON.stringify(res)\n }\n ]\n }`}\n </Client>\n </File>\n )\n },\n})\n","import { usePluginManager } from '@kubb/core/hooks'\nimport { createReactGenerator } from '@kubb/plugin-oas/generators'\nimport { useOas, useOperationManager } from '@kubb/plugin-oas/hooks'\nimport { getBanner, getFooter } from '@kubb/plugin-oas/utils'\nimport { pluginTsName } from '@kubb/plugin-ts'\nimport { pluginZodName } from '@kubb/plugin-zod'\nimport { File } from '@kubb/react-fabric'\nimport { Server } from '../components/Server'\nimport type { PluginMcp } from '../types'\n\nexport const serverGenerator = createReactGenerator<PluginMcp>({\n name: 'operations',\n Operations({ operations, generator, plugin }) {\n const pluginManager = usePluginManager()\n const { options } = plugin\n\n const oas = useOas()\n const { getFile, getName, getSchemas } = useOperationManager(generator)\n\n const name = 'server'\n const file = pluginManager.getFile({ name, extname: '.ts', pluginKey: plugin.key })\n\n const jsonFile = pluginManager.getFile({ name: '.mcp', extname: '.json', pluginKey: plugin.key })\n\n const operationsMapped = operations.map((operation) => {\n return {\n tool: {\n name: operation.getOperationId() || operation.getSummary() || `${operation.method.toUpperCase()} ${operation.path}`,\n description: operation.getDescription() || `Make a ${operation.method.toUpperCase()} request to ${operation.path}`,\n },\n mcp: {\n name: getName(operation, {\n type: 'function',\n suffix: 'handler',\n }),\n file: getFile(operation),\n },\n zod: {\n name: getName(operation, {\n type: 'function',\n pluginKey: [pluginZodName],\n }),\n schemas: getSchemas(operation, { pluginKey: [pluginZodName], type: 'function' }),\n file: getFile(operation, { pluginKey: [pluginZodName] }),\n },\n type: {\n schemas: getSchemas(operation, { pluginKey: [pluginTsName], type: 'type' }),\n },\n }\n })\n\n const imports = operationsMapped.flatMap(({ mcp, zod }) => {\n return [\n <File.Import key={mcp.name} name={[mcp.name]} root={file.path} path={mcp.file.path} />,\n <File.Import\n key={zod.name}\n name={[zod.schemas.request?.name, zod.schemas.pathParams?.name, zod.schemas.queryParams?.name, zod.schemas.headerParams?.name].filter(Boolean)}\n root={file.path}\n path={zod.file.path}\n />,\n ]\n })\n\n return (\n <>\n <File\n baseName={file.baseName}\n path={file.path}\n meta={file.meta}\n banner={getBanner({ oas, output: options.output, config: pluginManager.config })}\n footer={getFooter({ oas, output: options.output })}\n >\n <File.Import name={['McpServer']} path={'@modelcontextprotocol/sdk/server/mcp'} />\n <File.Import name={['StdioServerTransport']} path={'@modelcontextprotocol/sdk/server/stdio'} />\n\n {imports}\n <Server\n name={name}\n serverName={oas.api.info?.title}\n serverVersion={oas.getVersion()}\n paramsCasing={options.paramsCasing}\n operations={operationsMapped}\n />\n </File>\n\n <File baseName={jsonFile.baseName} path={jsonFile.path} meta={jsonFile.meta}>\n <File.Source name={name}>\n {`\n {\n \"mcpServers\": {\n \"${oas.api.info?.title || 'server'}\": {\n \"type\": \"stdio\",\n \"command\": \"npx\",\n \"args\": [\"tsx\", \"${file.path}\"]\n }\n }\n }\n `}\n </File.Source>\n </File>\n </>\n )\n },\n})\n"],"mappings":";;;;;;;;;;;;;;AASA,MAAa,eAAe,qBAAgC;CAC1D,MAAM;CACN,UAAU,EAAE,QAAQ,WAAW,WAAW,UAAU;EAClD,MAAM,EAAE,YAAY;EACpB,MAAM,MAAM,QAAQ;EAEpB,MAAM,EAAE,YAAY,SAAS,YAAY,oBAAoB,UAAU;EAEvE,MAAM,MAAM;GACV,MAAM,QAAQ,WAAW;IAAE,MAAM;IAAY,QAAQ;IAAW,CAAC;GACjE,MAAM,QAAQ,UAAU;GACzB;EAED,MAAM,OAAO;GACX,MAAM,QAAQ,WAAW,EAAE,WAAW,CAAC,aAAa,EAAE,CAAC;GACvD,SAAS,WAAW,WAAW;IAAE,WAAW,CAAC,aAAa;IAAE,MAAM;IAAQ,CAAC;GAC5E;AAED,SACE,qBAAC;GACC,UAAU,IAAI,KAAK;GACnB,MAAM,IAAI,KAAK;GACf,MAAM,IAAI,KAAK;GACf,QAAQ,UAAU;IAAE;IAAK,QAAQ,QAAQ;IAAQ,CAAC;GAClD,QAAQ,UAAU;IAAE;IAAK,QAAQ,QAAQ;IAAQ,CAAC;;IAEjD,QAAQ,OAAO,aACd;KACE,oBAAC,KAAK;MAAO,MAAM;MAAS,MAAM,QAAQ,OAAO;OAAc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4 +1,4 @@
|
|
|
1
|
-
import { t as __name } from "./chunk-
|
|
1
|
+
import { t as __name } from "./chunk-DKWOrOAv.js";
|
|
2
2
|
import { Group, Output, PluginFactoryOptions, ResolveNameParams } from "@kubb/core";
|
|
3
3
|
import { ClientImportPath, PluginClient } from "@kubb/plugin-client";
|
|
4
4
|
import { Exclude, Include, Override, ResolvePathOptions } from "@kubb/plugin-oas";
|
|
@@ -61,4 +61,4 @@ type ResolvedOptions = {
|
|
|
61
61
|
type PluginMcp = PluginFactoryOptions<'plugin-mcp', Options, ResolvedOptions, never, ResolvePathOptions>;
|
|
62
62
|
//#endregion
|
|
63
63
|
export { PluginMcp as n, Options as t };
|
|
64
|
-
//# sourceMappingURL=types-
|
|
64
|
+
//# sourceMappingURL=types-BTZNpUo1.d.ts.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { t as __name } from "./chunk-
|
|
1
|
+
import { t as __name } from "./chunk-cy2TeOE5.cjs";
|
|
2
2
|
import { Exclude, Include, Override, ResolvePathOptions } from "@kubb/plugin-oas";
|
|
3
3
|
import { Group, Output, PluginFactoryOptions, ResolveNameParams } from "@kubb/core";
|
|
4
4
|
import { Oas, contentType } from "@kubb/oas";
|
|
@@ -61,4 +61,4 @@ type ResolvedOptions = {
|
|
|
61
61
|
type PluginMcp = PluginFactoryOptions<'plugin-mcp', Options, ResolvedOptions, never, ResolvePathOptions>;
|
|
62
62
|
//#endregion
|
|
63
63
|
export { PluginMcp as n, Options as t };
|
|
64
|
-
//# sourceMappingURL=types-
|
|
64
|
+
//# sourceMappingURL=types-DigTVU-V.d.ts.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kubb/plugin-mcp",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.29.1",
|
|
4
4
|
"description": "Model Context Protocol (MCP) plugin for Kubb, generating MCP-compatible tools and schemas from OpenAPI specifications for AI assistants.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"mcp",
|
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
],
|
|
20
20
|
"repository": {
|
|
21
21
|
"type": "git",
|
|
22
|
-
"url": "https://github.com/kubb-labs/kubb.git",
|
|
22
|
+
"url": "git+https://github.com/kubb-labs/kubb.git",
|
|
23
23
|
"directory": "packages/plugin-mcp"
|
|
24
24
|
},
|
|
25
25
|
"license": "MIT",
|
|
@@ -28,22 +28,20 @@
|
|
|
28
28
|
"type": "module",
|
|
29
29
|
"exports": {
|
|
30
30
|
".": {
|
|
31
|
-
"
|
|
32
|
-
"
|
|
31
|
+
"import": "./dist/index.js",
|
|
32
|
+
"require": "./dist/index.cjs"
|
|
33
33
|
},
|
|
34
34
|
"./components": {
|
|
35
|
-
"
|
|
36
|
-
"
|
|
35
|
+
"import": "./dist/components.js",
|
|
36
|
+
"require": "./dist/components.cjs"
|
|
37
37
|
},
|
|
38
38
|
"./generators": {
|
|
39
|
-
"
|
|
40
|
-
"
|
|
39
|
+
"import": "./dist/generators.js",
|
|
40
|
+
"require": "./dist/generators.cjs"
|
|
41
41
|
},
|
|
42
42
|
"./package.json": "./package.json"
|
|
43
43
|
},
|
|
44
|
-
"
|
|
45
|
-
"module": "./dist/index.js",
|
|
46
|
-
"types": "./dist/index.d.cts",
|
|
44
|
+
"types": "./dist/index.d.ts",
|
|
47
45
|
"typesVersions": {
|
|
48
46
|
"*": {
|
|
49
47
|
"utils": [
|
|
@@ -74,13 +72,13 @@
|
|
|
74
72
|
}
|
|
75
73
|
],
|
|
76
74
|
"dependencies": {
|
|
77
|
-
"@kubb/react-fabric": "0.
|
|
78
|
-
"@kubb/core": "4.
|
|
79
|
-
"@kubb/oas": "4.
|
|
80
|
-
"@kubb/plugin-client": "4.
|
|
81
|
-
"@kubb/plugin-oas": "4.
|
|
82
|
-
"@kubb/plugin-ts": "4.
|
|
83
|
-
"@kubb/plugin-zod": "4.
|
|
75
|
+
"@kubb/react-fabric": "0.13.1",
|
|
76
|
+
"@kubb/core": "4.29.1",
|
|
77
|
+
"@kubb/oas": "4.29.1",
|
|
78
|
+
"@kubb/plugin-client": "4.29.1",
|
|
79
|
+
"@kubb/plugin-oas": "4.29.1",
|
|
80
|
+
"@kubb/plugin-ts": "4.29.1",
|
|
81
|
+
"@kubb/plugin-zod": "4.29.1"
|
|
84
82
|
},
|
|
85
83
|
"devDependencies": {},
|
|
86
84
|
"engines": {
|
|
@@ -90,6 +88,8 @@
|
|
|
90
88
|
"access": "public",
|
|
91
89
|
"registry": "https://registry.npmjs.org/"
|
|
92
90
|
},
|
|
91
|
+
"main": "./dist/index.cjs",
|
|
92
|
+
"module": "./dist/index.js",
|
|
93
93
|
"scripts": {
|
|
94
94
|
"build": "tsdown && size-limit",
|
|
95
95
|
"clean": "npx rimraf ./dist",
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
*/
|
|
5
5
|
import { McpServer } from '@modelcontextprotocol/sdk/server/mcp'
|
|
6
6
|
import { StdioServerTransport } from '@modelcontextprotocol/sdk/server/stdio'
|
|
7
|
-
import {
|
|
7
|
+
import { createPetsHandler, createPetsMutationRequest, listPetsHandler, listPetsQueryParams, showPetByIdHandler, showPetByIdPathParams } from './showPetById'
|
|
8
8
|
|
|
9
9
|
export const server = new McpServer({
|
|
10
10
|
name: 'Swagger PetStore',
|
package/dist/components.d.cts
DELETED
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
import { t as __name } from "./chunk-DHUGjThq.cjs";
|
|
2
|
-
import { KubbFile } from "@kubb/fabric-core/types";
|
|
3
|
-
import { OperationSchemas } from "@kubb/plugin-oas";
|
|
4
|
-
import { FabricReactNode } from "@kubb/react-fabric/types";
|
|
5
|
-
|
|
6
|
-
//#region src/components/Server.d.ts
|
|
7
|
-
type Props = {
|
|
8
|
-
name: string;
|
|
9
|
-
serverName: string;
|
|
10
|
-
serverVersion: string;
|
|
11
|
-
paramsCasing?: 'camelcase';
|
|
12
|
-
operations: Array<{
|
|
13
|
-
tool: {
|
|
14
|
-
name: string;
|
|
15
|
-
description: string;
|
|
16
|
-
};
|
|
17
|
-
mcp: {
|
|
18
|
-
name: string;
|
|
19
|
-
file: KubbFile.File;
|
|
20
|
-
};
|
|
21
|
-
zod: {
|
|
22
|
-
name: string;
|
|
23
|
-
file: KubbFile.File;
|
|
24
|
-
schemas: OperationSchemas;
|
|
25
|
-
};
|
|
26
|
-
type: {
|
|
27
|
-
schemas: OperationSchemas;
|
|
28
|
-
};
|
|
29
|
-
}>;
|
|
30
|
-
};
|
|
31
|
-
declare function Server({
|
|
32
|
-
name,
|
|
33
|
-
serverName,
|
|
34
|
-
serverVersion,
|
|
35
|
-
paramsCasing,
|
|
36
|
-
operations
|
|
37
|
-
}: Props): FabricReactNode;
|
|
38
|
-
//#endregion
|
|
39
|
-
export { Server };
|
|
40
|
-
//# sourceMappingURL=components.d.cts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"generators-CG-bxVZZ.cjs","names":["pluginTsName","File","path","Client","pluginZodName","pluginTsName","File","Server"],"sources":["../src/generators/mcpGenerator.tsx","../src/generators/serverGenerator.tsx"],"sourcesContent":["import path from 'node:path'\nimport { Client } from '@kubb/plugin-client/components'\nimport { createReactGenerator } from '@kubb/plugin-oas/generators'\nimport { useOas, useOperationManager } from '@kubb/plugin-oas/hooks'\nimport { getBanner, getFooter } from '@kubb/plugin-oas/utils'\nimport { pluginTsName } from '@kubb/plugin-ts'\nimport { File } from '@kubb/react-fabric'\nimport type { PluginMcp } from '../types'\n\nexport const mcpGenerator = createReactGenerator<PluginMcp>({\n name: 'mcp',\n Operation({ config, operation, generator, plugin }) {\n const { options } = plugin\n const oas = useOas()\n\n const { getSchemas, getName, getFile } = useOperationManager(generator)\n\n const mcp = {\n name: getName(operation, { type: 'function', suffix: 'handler' }),\n file: getFile(operation),\n }\n\n const type = {\n file: getFile(operation, { pluginKey: [pluginTsName] }),\n schemas: getSchemas(operation, { pluginKey: [pluginTsName], type: 'type' }),\n }\n\n return (\n <File\n baseName={mcp.file.baseName}\n path={mcp.file.path}\n meta={mcp.file.meta}\n banner={getBanner({ oas, output: options.output })}\n footer={getFooter({ oas, output: options.output })}\n >\n {options.client.importPath ? (\n <>\n <File.Import name={'fetch'} path={options.client.importPath} />\n <File.Import name={['Client', 'RequestConfig', 'ResponseErrorConfig']} path={options.client.importPath} isTypeOnly />\n {options.client.dataReturnType === 'full' && <File.Import name={['ResponseConfig']} path={options.client.importPath} isTypeOnly />}\n </>\n ) : (\n <>\n <File.Import name={['fetch']} root={mcp.file.path} path={path.resolve(config.root, config.output.path, '.kubb/fetch.ts')} />\n <File.Import\n name={['Client', 'RequestConfig', 'ResponseErrorConfig']}\n root={mcp.file.path}\n path={path.resolve(config.root, config.output.path, '.kubb/fetch.ts')}\n isTypeOnly\n />\n {options.client.dataReturnType === 'full' && (\n <File.Import name={['ResponseConfig']} root={mcp.file.path} path={path.resolve(config.root, config.output.path, '.kubb/fetch.ts')} isTypeOnly />\n )}\n </>\n )}\n <File.Import name={['buildFormData']} root={mcp.file.path} path={path.resolve(config.root, config.output.path, '.kubb/config.ts')} />\n <File.Import name={['CallToolResult']} path={'@modelcontextprotocol/sdk/types'} isTypeOnly />\n <File.Import\n name={[\n type.schemas.request?.name,\n type.schemas.response.name,\n type.schemas.pathParams?.name,\n type.schemas.queryParams?.name,\n type.schemas.headerParams?.name,\n ...(type.schemas.statusCodes?.map((item) => item.name) || []),\n ].filter(Boolean)}\n root={mcp.file.path}\n path={type.file.path}\n isTypeOnly\n />\n\n <Client\n name={mcp.name}\n isConfigurable={false}\n returnType={'Promise<CallToolResult>'}\n baseURL={options.client.baseURL}\n operation={operation}\n typeSchemas={type.schemas}\n zodSchemas={undefined}\n dataReturnType={options.client.dataReturnType || 'data'}\n paramsType={'object'}\n paramsCasing={options.client?.paramsCasing || options.paramsCasing}\n pathParamsType={'object'}\n parser={'client'}\n >\n {options.client.dataReturnType === 'data' &&\n `return {\n content: [\n {\n type: 'text',\n text: JSON.stringify(res.data)\n }\n ]\n }`}\n {options.client.dataReturnType === 'full' &&\n `return {\n content: [\n {\n type: 'text',\n text: JSON.stringify(res)\n }\n ]\n }`}\n </Client>\n </File>\n )\n },\n})\n","import { usePluginManager } from '@kubb/core/hooks'\nimport { createReactGenerator } from '@kubb/plugin-oas/generators'\nimport { useOas, useOperationManager } from '@kubb/plugin-oas/hooks'\nimport { getBanner, getFooter } from '@kubb/plugin-oas/utils'\nimport { pluginTsName } from '@kubb/plugin-ts'\nimport { pluginZodName } from '@kubb/plugin-zod'\nimport { File } from '@kubb/react-fabric'\nimport { Server } from '../components/Server'\nimport type { PluginMcp } from '../types'\n\nexport const serverGenerator = createReactGenerator<PluginMcp>({\n name: 'operations',\n Operations({ operations, generator, plugin }) {\n const pluginManager = usePluginManager()\n const { options } = plugin\n\n const oas = useOas()\n const { getFile, getName, getSchemas } = useOperationManager(generator)\n\n const name = 'server'\n const file = pluginManager.getFile({ name, extname: '.ts', pluginKey: plugin.key })\n\n const jsonFile = pluginManager.getFile({ name: '.mcp', extname: '.json', pluginKey: plugin.key })\n\n const operationsMapped = operations.map((operation) => {\n return {\n tool: {\n name: operation.getOperationId() || operation.getSummary() || `${operation.method.toUpperCase()} ${operation.path}`,\n description: operation.getDescription() || `Make a ${operation.method.toUpperCase()} request to ${operation.path}`,\n },\n mcp: {\n name: getName(operation, {\n type: 'function',\n suffix: 'handler',\n }),\n file: getFile(operation),\n },\n zod: {\n name: getName(operation, {\n type: 'function',\n pluginKey: [pluginZodName],\n }),\n schemas: getSchemas(operation, { pluginKey: [pluginZodName], type: 'function' }),\n file: getFile(operation, { pluginKey: [pluginZodName] }),\n },\n type: {\n schemas: getSchemas(operation, { pluginKey: [pluginTsName], type: 'type' }),\n },\n }\n })\n\n const imports = operationsMapped.flatMap(({ mcp, zod }) => {\n return [\n <File.Import key={mcp.name} name={[mcp.name]} root={file.path} path={mcp.file.path} />,\n <File.Import\n key={zod.name}\n name={[zod.schemas.request?.name, zod.schemas.pathParams?.name, zod.schemas.queryParams?.name, zod.schemas.headerParams?.name].filter(Boolean)}\n root={file.path}\n path={zod.file.path}\n />,\n ]\n })\n\n return (\n <>\n <File\n baseName={file.baseName}\n path={file.path}\n meta={file.meta}\n banner={getBanner({ oas, output: options.output, config: pluginManager.config })}\n footer={getFooter({ oas, output: options.output })}\n >\n <File.Import name={['McpServer']} path={'@modelcontextprotocol/sdk/server/mcp'} />\n <File.Import name={['StdioServerTransport']} path={'@modelcontextprotocol/sdk/server/stdio'} />\n\n {imports}\n <Server\n name={name}\n serverName={oas.api.info?.title}\n serverVersion={oas.getVersion()}\n paramsCasing={options.paramsCasing}\n operations={operationsMapped}\n />\n </File>\n\n <File baseName={jsonFile.baseName} path={jsonFile.path} meta={jsonFile.meta}>\n <File.Source name={name}>\n {`\n {\n \"mcpServers\": {\n \"${oas.api.info?.title || 'server'}\": {\n \"type\": \"stdio\",\n \"command\": \"npx\",\n \"args\": [\"tsx\", \"${file.path}\"]\n }\n }\n }\n `}\n </File.Source>\n </File>\n </>\n )\n },\n})\n"],"mappings":";;;;;;;;;;;;;;AASA,MAAa,qEAA+C;CAC1D,MAAM;CACN,UAAU,EAAE,QAAQ,WAAW,WAAW,UAAU;EAClD,MAAM,EAAE,YAAY;EACpB,MAAM,0CAAc;EAEpB,MAAM,EAAE,YAAY,SAAS,4DAAgC,UAAU;EAEvE,MAAM,MAAM;GACV,MAAM,QAAQ,WAAW;IAAE,MAAM;IAAY,QAAQ;IAAW,CAAC;GACjE,MAAM,QAAQ,UAAU;GACzB;EAED,MAAM,OAAO;GACX,MAAM,QAAQ,WAAW,EAAE,WAAW,CAACA,6BAAa,EAAE,CAAC;GACvD,SAAS,WAAW,WAAW;IAAE,WAAW,CAACA,6BAAa;IAAE,MAAM;IAAQ,CAAC;GAC5E;AAED,SACE,yDAACC;GACC,UAAU,IAAI,KAAK;GACnB,MAAM,IAAI,KAAK;GACf,MAAM,IAAI,KAAK;GACf,8CAAkB;IAAE;IAAK,QAAQ,QAAQ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AAS;aACrE,wDAACA,wBAAK;IAAa;cAChB;;;iBAGI,IAAI,IAAI,MAAM,SAAS,SAAS;;;mCAGd,KAAK,KAAK;;;;;KAKrB;IACT,IACN;;CAGR,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"generators-stveWfzc.js","names":[],"sources":["../src/generators/mcpGenerator.tsx","../src/generators/serverGenerator.tsx"],"sourcesContent":["import path from 'node:path'\nimport { Client } from '@kubb/plugin-client/components'\nimport { createReactGenerator } from '@kubb/plugin-oas/generators'\nimport { useOas, useOperationManager } from '@kubb/plugin-oas/hooks'\nimport { getBanner, getFooter } from '@kubb/plugin-oas/utils'\nimport { pluginTsName } from '@kubb/plugin-ts'\nimport { File } from '@kubb/react-fabric'\nimport type { PluginMcp } from '../types'\n\nexport const mcpGenerator = createReactGenerator<PluginMcp>({\n name: 'mcp',\n Operation({ config, operation, generator, plugin }) {\n const { options } = plugin\n const oas = useOas()\n\n const { getSchemas, getName, getFile } = useOperationManager(generator)\n\n const mcp = {\n name: getName(operation, { type: 'function', suffix: 'handler' }),\n file: getFile(operation),\n }\n\n const type = {\n file: getFile(operation, { pluginKey: [pluginTsName] }),\n schemas: getSchemas(operation, { pluginKey: [pluginTsName], type: 'type' }),\n }\n\n return (\n <File\n baseName={mcp.file.baseName}\n path={mcp.file.path}\n meta={mcp.file.meta}\n banner={getBanner({ oas, output: options.output })}\n footer={getFooter({ oas, output: options.output })}\n >\n {options.client.importPath ? (\n <>\n <File.Import name={'fetch'} path={options.client.importPath} />\n <File.Import name={['Client', 'RequestConfig', 'ResponseErrorConfig']} path={options.client.importPath} isTypeOnly />\n {options.client.dataReturnType === 'full' && <File.Import name={['ResponseConfig']} path={options.client.importPath} isTypeOnly />}\n </>\n ) : (\n <>\n <File.Import name={['fetch']} root={mcp.file.path} path={path.resolve(config.root, config.output.path, '.kubb/fetch.ts')} />\n <File.Import\n name={['Client', 'RequestConfig', 'ResponseErrorConfig']}\n root={mcp.file.path}\n path={path.resolve(config.root, config.output.path, '.kubb/fetch.ts')}\n isTypeOnly\n />\n {options.client.dataReturnType === 'full' && (\n <File.Import name={['ResponseConfig']} root={mcp.file.path} path={path.resolve(config.root, config.output.path, '.kubb/fetch.ts')} isTypeOnly />\n )}\n </>\n )}\n <File.Import name={['buildFormData']} root={mcp.file.path} path={path.resolve(config.root, config.output.path, '.kubb/config.ts')} />\n <File.Import name={['CallToolResult']} path={'@modelcontextprotocol/sdk/types'} isTypeOnly />\n <File.Import\n name={[\n type.schemas.request?.name,\n type.schemas.response.name,\n type.schemas.pathParams?.name,\n type.schemas.queryParams?.name,\n type.schemas.headerParams?.name,\n ...(type.schemas.statusCodes?.map((item) => item.name) || []),\n ].filter(Boolean)}\n root={mcp.file.path}\n path={type.file.path}\n isTypeOnly\n />\n\n <Client\n name={mcp.name}\n isConfigurable={false}\n returnType={'Promise<CallToolResult>'}\n baseURL={options.client.baseURL}\n operation={operation}\n typeSchemas={type.schemas}\n zodSchemas={undefined}\n dataReturnType={options.client.dataReturnType || 'data'}\n paramsType={'object'}\n paramsCasing={options.client?.paramsCasing || options.paramsCasing}\n pathParamsType={'object'}\n parser={'client'}\n >\n {options.client.dataReturnType === 'data' &&\n `return {\n content: [\n {\n type: 'text',\n text: JSON.stringify(res.data)\n }\n ]\n }`}\n {options.client.dataReturnType === 'full' &&\n `return {\n content: [\n {\n type: 'text',\n text: JSON.stringify(res)\n }\n ]\n }`}\n </Client>\n </File>\n )\n },\n})\n","import { usePluginManager } from '@kubb/core/hooks'\nimport { createReactGenerator } from '@kubb/plugin-oas/generators'\nimport { useOas, useOperationManager } from '@kubb/plugin-oas/hooks'\nimport { getBanner, getFooter } from '@kubb/plugin-oas/utils'\nimport { pluginTsName } from '@kubb/plugin-ts'\nimport { pluginZodName } from '@kubb/plugin-zod'\nimport { File } from '@kubb/react-fabric'\nimport { Server } from '../components/Server'\nimport type { PluginMcp } from '../types'\n\nexport const serverGenerator = createReactGenerator<PluginMcp>({\n name: 'operations',\n Operations({ operations, generator, plugin }) {\n const pluginManager = usePluginManager()\n const { options } = plugin\n\n const oas = useOas()\n const { getFile, getName, getSchemas } = useOperationManager(generator)\n\n const name = 'server'\n const file = pluginManager.getFile({ name, extname: '.ts', pluginKey: plugin.key })\n\n const jsonFile = pluginManager.getFile({ name: '.mcp', extname: '.json', pluginKey: plugin.key })\n\n const operationsMapped = operations.map((operation) => {\n return {\n tool: {\n name: operation.getOperationId() || operation.getSummary() || `${operation.method.toUpperCase()} ${operation.path}`,\n description: operation.getDescription() || `Make a ${operation.method.toUpperCase()} request to ${operation.path}`,\n },\n mcp: {\n name: getName(operation, {\n type: 'function',\n suffix: 'handler',\n }),\n file: getFile(operation),\n },\n zod: {\n name: getName(operation, {\n type: 'function',\n pluginKey: [pluginZodName],\n }),\n schemas: getSchemas(operation, { pluginKey: [pluginZodName], type: 'function' }),\n file: getFile(operation, { pluginKey: [pluginZodName] }),\n },\n type: {\n schemas: getSchemas(operation, { pluginKey: [pluginTsName], type: 'type' }),\n },\n }\n })\n\n const imports = operationsMapped.flatMap(({ mcp, zod }) => {\n return [\n <File.Import key={mcp.name} name={[mcp.name]} root={file.path} path={mcp.file.path} />,\n <File.Import\n key={zod.name}\n name={[zod.schemas.request?.name, zod.schemas.pathParams?.name, zod.schemas.queryParams?.name, zod.schemas.headerParams?.name].filter(Boolean)}\n root={file.path}\n path={zod.file.path}\n />,\n ]\n })\n\n return (\n <>\n <File\n baseName={file.baseName}\n path={file.path}\n meta={file.meta}\n banner={getBanner({ oas, output: options.output, config: pluginManager.config })}\n footer={getFooter({ oas, output: options.output })}\n >\n <File.Import name={['McpServer']} path={'@modelcontextprotocol/sdk/server/mcp'} />\n <File.Import name={['StdioServerTransport']} path={'@modelcontextprotocol/sdk/server/stdio'} />\n\n {imports}\n <Server\n name={name}\n serverName={oas.api.info?.title}\n serverVersion={oas.getVersion()}\n paramsCasing={options.paramsCasing}\n operations={operationsMapped}\n />\n </File>\n\n <File baseName={jsonFile.baseName} path={jsonFile.path} meta={jsonFile.meta}>\n <File.Source name={name}>\n {`\n {\n \"mcpServers\": {\n \"${oas.api.info?.title || 'server'}\": {\n \"type\": \"stdio\",\n \"command\": \"npx\",\n \"args\": [\"tsx\", \"${file.path}\"]\n }\n }\n }\n `}\n </File.Source>\n </File>\n </>\n )\n },\n})\n"],"mappings":";;;;;;;;;;;;;;AASA,MAAa,eAAe,qBAAgC;CAC1D,MAAM;CACN,UAAU,EAAE,QAAQ,WAAW,WAAW,UAAU;EAClD,MAAM,EAAE,YAAY;EACpB,MAAM,MAAM,QAAQ;EAEpB,MAAM,EAAE,YAAY,SAAS,YAAY,oBAAoB,UAAU;EAEvE,MAAM,MAAM;GACV,MAAM,QAAQ,WAAW;IAAE,MAAM;IAAY,QAAQ;IAAW,CAAC;GACjE,MAAM,QAAQ,UAAU;GACzB;EAED,MAAM,OAAO;GACX,MAAM,QAAQ,WAAW,EAAE,WAAW,CAAC,aAAa,EAAE,CAAC;GACvD,SAAS,WAAW,WAAW;IAAE,WAAW,CAAC,aAAa;IAAE,MAAM;IAAQ,CAAC;GAC5E;AAED,SACE,qBAAC;GACC,UAAU,IAAI,KAAK;GACnB,MAAM,IAAI,KAAK;GACf,MAAM,IAAI,KAAK;GACf,QAAQ,UAAU;IAAE;IAAK,QAAQ,QAAQ;IAAQ,CAAC;GAClD,QAAQ,UAAU;IAAE;IAAK,QAAQ,QAAQ;IAAQ,CAAC;;IAEjD,QAAQ,OAAO,aACd;KACE,oBAAC,KAAK;MAAO,MAAM;MAAS,MAAM,QAAQ,OAAO;OAAc;KAC/D,oBAAC,KAAK;MAAO,MAAM;OAAC;OAAU;OAAiB;OAAsB;MAAE,MAAM,QAAQ,OAAO;MAAY;OAAa;KACpH,QAAQ,OAAO,mBAAmB,UAAU,oBAAC,KAAK;MAAO,MAAM,CAAC,iBAAiB;MAAE,MAAM,QAAQ,OAAO;MAAY;OAAa;QACjI,GAEH;KACE,oBAAC,KAAK;MAAO,MAAM,CAAC,QAAQ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,KAAK;IAAE,MAAM,KAAK;IAAM,MAAM,IAAI,KAAK;MAA5D,IAAI,KAAgE,EACtF,oBAAC,KAAK;IAEJ,MAAM;KAAC,IAAI,QAAQ,SAAS;KAAM,IAAI,QAAQ,YAAY;KAAM,IAAI,QAAQ,aAAa;KAAM,IAAI,QAAQ,cAAc;KAAK,CAAC,OAAO,QAAQ;IAC9I,MAAM,KAAK;IACX,MAAM,IAAI,KAAK;MAHV,IAAI,KAIT,CACH;IACD;AAEF,SACE,4CACE,qBAAC;GACC,UAAU,KAAK;GACf,MAAM,KAAK;GACX,MAAM,KAAK;GACX,QAAQ,UAAU;IAAE;IAAK,QAAQ,QAAQ;IAAQ,QAAQ,cAAc;IAAQ,CAAC;GAChF,QAAQ,UAAU;IAAE;IAAK,QAAQ,QAAQ;IAAQ,CAAC;;IAElD,oBAAC,KAAK;KAAO,MAAM,CAAC,YAAY;KAAE,MAAM;MAA0C;IAClF,oBAAC,KAAK;KAAO,MAAM,CAAC,uBAAuB;KAAE,MAAM;MAA4C;IAE9F;IACD,oBAAC;KACO;KACN,YAAY,IAAI,IAAI,MAAM;KAC1B,eAAe,IAAI,YAAY;KAC/B,cAAc,QAAQ;KACtB,YAAY;MACZ;;IACG,EAEP,oBAAC;GAAK,UAAU,SAAS;GAAU,MAAM,SAAS;GAAM,MAAM,SAAS;aACrE,oBAAC,KAAK;IAAa;cAChB;;;iBAGI,IAAI,IAAI,MAAM,SAAS,SAAS;;;mCAGd,KAAK,KAAK;;;;;KAKrB;IACT,IACN;;CAGR,CAAC"}
|
package/dist/generators.d.cts
DELETED
|
@@ -1,471 +0,0 @@
|
|
|
1
|
-
import { t as __name } from "./chunk-DHUGjThq.cjs";
|
|
2
|
-
import { n as PluginMcp } from "./types-CRIAfDoH.cjs";
|
|
3
|
-
import { KubbFile } from "@kubb/fabric-core/types";
|
|
4
|
-
import { FabricReactNode } from "@kubb/react-fabric/types";
|
|
5
|
-
import { BaseGenerator, Config, FileMetaBase, Group, KubbEvents, Output, Plugin, PluginFactoryOptions, PluginManager, ResolveNameParams } from "@kubb/core";
|
|
6
|
-
import { HttpMethod, Oas, Operation, SchemaObject, contentType } from "@kubb/oas";
|
|
7
|
-
import { AsyncEventEmitter } from "@kubb/core/utils";
|
|
8
|
-
import { Fabric } from "@kubb/react-fabric";
|
|
9
|
-
|
|
10
|
-
//#region ../plugin-oas/src/types.d.ts
|
|
11
|
-
type GetOasOptions = {
|
|
12
|
-
validate?: boolean;
|
|
13
|
-
};
|
|
14
|
-
type Context$2 = {
|
|
15
|
-
getOas(options?: GetOasOptions): Promise<Oas>;
|
|
16
|
-
getBaseURL(): Promise<string | undefined>;
|
|
17
|
-
};
|
|
18
|
-
declare global {
|
|
19
|
-
namespace Kubb {
|
|
20
|
-
interface PluginContext extends Context$2 {}
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
/**
|
|
24
|
-
* `propertyName` is the ref name + resolved with the nameResolver
|
|
25
|
-
* @example import { Pet } from './Pet'
|
|
26
|
-
*
|
|
27
|
-
* `originalName` is the original name used(in PascalCase), only used to remove duplicates
|
|
28
|
-
*
|
|
29
|
-
* `pluginKey` can be used to override the current plugin being used, handy when you want to import a type/schema out of another plugin
|
|
30
|
-
* @example import a type(plugin-ts) for a mock file(swagger-faker)
|
|
31
|
-
*/
|
|
32
|
-
type Ref = {
|
|
33
|
-
propertyName: string;
|
|
34
|
-
originalName: string;
|
|
35
|
-
path: KubbFile.Path;
|
|
36
|
-
pluginKey?: Plugin['key'];
|
|
37
|
-
};
|
|
38
|
-
type Refs = Record<string, Ref>;
|
|
39
|
-
type OperationSchema = {
|
|
40
|
-
/**
|
|
41
|
-
* Converted name, contains already `PathParams`, `QueryParams`, ...
|
|
42
|
-
*/
|
|
43
|
-
name: string;
|
|
44
|
-
schema: SchemaObject;
|
|
45
|
-
operation?: Operation;
|
|
46
|
-
/**
|
|
47
|
-
* OperationName in PascalCase, only being used in OperationGenerator
|
|
48
|
-
*/
|
|
49
|
-
operationName: string;
|
|
50
|
-
description?: string;
|
|
51
|
-
statusCode?: number;
|
|
52
|
-
keys?: string[];
|
|
53
|
-
keysToOmit?: string[];
|
|
54
|
-
withData?: boolean;
|
|
55
|
-
};
|
|
56
|
-
type OperationSchemas = {
|
|
57
|
-
pathParams?: OperationSchema & {
|
|
58
|
-
keysToOmit?: never;
|
|
59
|
-
};
|
|
60
|
-
queryParams?: OperationSchema & {
|
|
61
|
-
keysToOmit?: never;
|
|
62
|
-
};
|
|
63
|
-
headerParams?: OperationSchema & {
|
|
64
|
-
keysToOmit?: never;
|
|
65
|
-
};
|
|
66
|
-
request?: OperationSchema;
|
|
67
|
-
response: OperationSchema;
|
|
68
|
-
responses: Array<OperationSchema>;
|
|
69
|
-
statusCodes?: Array<OperationSchema>;
|
|
70
|
-
errors?: Array<OperationSchema>;
|
|
71
|
-
};
|
|
72
|
-
type ByTag = {
|
|
73
|
-
type: 'tag';
|
|
74
|
-
pattern: string | RegExp;
|
|
75
|
-
};
|
|
76
|
-
type ByOperationId = {
|
|
77
|
-
type: 'operationId';
|
|
78
|
-
pattern: string | RegExp;
|
|
79
|
-
};
|
|
80
|
-
type ByPath = {
|
|
81
|
-
type: 'path';
|
|
82
|
-
pattern: string | RegExp;
|
|
83
|
-
};
|
|
84
|
-
type ByMethod = {
|
|
85
|
-
type: 'method';
|
|
86
|
-
pattern: HttpMethod | RegExp;
|
|
87
|
-
};
|
|
88
|
-
type BySchemaName = {
|
|
89
|
-
type: 'schemaName';
|
|
90
|
-
pattern: string | RegExp;
|
|
91
|
-
};
|
|
92
|
-
type ByContentType = {
|
|
93
|
-
type: 'contentType';
|
|
94
|
-
pattern: string | RegExp;
|
|
95
|
-
};
|
|
96
|
-
type Exclude = ByTag | ByOperationId | ByPath | ByMethod | ByContentType;
|
|
97
|
-
type Include = ByTag | ByOperationId | ByPath | ByMethod | ByContentType;
|
|
98
|
-
type Override<TOptions> = (ByTag | ByOperationId | ByPath | ByMethod | BySchemaName | ByContentType) & {
|
|
99
|
-
options: Partial<TOptions>;
|
|
100
|
-
};
|
|
101
|
-
//#endregion
|
|
102
|
-
//#region ../plugin-oas/src/OperationGenerator.d.ts
|
|
103
|
-
type Context$1<TOptions, TPluginOptions extends PluginFactoryOptions> = {
|
|
104
|
-
fabric: Fabric;
|
|
105
|
-
oas: Oas;
|
|
106
|
-
exclude: Array<Exclude> | undefined;
|
|
107
|
-
include: Array<Include> | undefined;
|
|
108
|
-
override: Array<Override<TOptions>> | undefined;
|
|
109
|
-
contentType: contentType | undefined;
|
|
110
|
-
pluginManager: PluginManager;
|
|
111
|
-
events?: AsyncEventEmitter<KubbEvents>;
|
|
112
|
-
/**
|
|
113
|
-
* Current plugin
|
|
114
|
-
*/
|
|
115
|
-
plugin: Plugin<TPluginOptions>;
|
|
116
|
-
mode: KubbFile.Mode;
|
|
117
|
-
UNSTABLE_NAMING?: true;
|
|
118
|
-
};
|
|
119
|
-
declare class OperationGenerator<TPluginOptions extends PluginFactoryOptions = PluginFactoryOptions, TFileMeta extends FileMetaBase = FileMetaBase> extends BaseGenerator<TPluginOptions['resolvedOptions'], Context$1<TPluginOptions['resolvedOptions'], TPluginOptions>> {
|
|
120
|
-
#private;
|
|
121
|
-
getOptions(operation: Operation, method: HttpMethod): Partial<TPluginOptions['resolvedOptions']>;
|
|
122
|
-
getSchemas(operation: Operation, {
|
|
123
|
-
resolveName
|
|
124
|
-
}?: {
|
|
125
|
-
resolveName?: (name: string) => string;
|
|
126
|
-
}): OperationSchemas;
|
|
127
|
-
getOperations(): Promise<Array<{
|
|
128
|
-
path: string;
|
|
129
|
-
method: HttpMethod;
|
|
130
|
-
operation: Operation;
|
|
131
|
-
}>>;
|
|
132
|
-
build(...generators: Array<Generator<TPluginOptions>>): Promise<Array<KubbFile.File<TFileMeta>>>;
|
|
133
|
-
}
|
|
134
|
-
//#endregion
|
|
135
|
-
//#region ../plugin-oas/src/SchemaMapper.d.ts
|
|
136
|
-
type SchemaKeywordMapper = {
|
|
137
|
-
object: {
|
|
138
|
-
keyword: 'object';
|
|
139
|
-
args: {
|
|
140
|
-
properties: {
|
|
141
|
-
[x: string]: Schema[];
|
|
142
|
-
};
|
|
143
|
-
additionalProperties: Schema[];
|
|
144
|
-
patternProperties?: Record<string, Schema[]>;
|
|
145
|
-
strict?: boolean;
|
|
146
|
-
};
|
|
147
|
-
};
|
|
148
|
-
url: {
|
|
149
|
-
keyword: 'url';
|
|
150
|
-
};
|
|
151
|
-
readOnly: {
|
|
152
|
-
keyword: 'readOnly';
|
|
153
|
-
};
|
|
154
|
-
writeOnly: {
|
|
155
|
-
keyword: 'writeOnly';
|
|
156
|
-
};
|
|
157
|
-
uuid: {
|
|
158
|
-
keyword: 'uuid';
|
|
159
|
-
};
|
|
160
|
-
email: {
|
|
161
|
-
keyword: 'email';
|
|
162
|
-
};
|
|
163
|
-
firstName: {
|
|
164
|
-
keyword: 'firstName';
|
|
165
|
-
};
|
|
166
|
-
lastName: {
|
|
167
|
-
keyword: 'lastName';
|
|
168
|
-
};
|
|
169
|
-
phone: {
|
|
170
|
-
keyword: 'phone';
|
|
171
|
-
};
|
|
172
|
-
password: {
|
|
173
|
-
keyword: 'password';
|
|
174
|
-
};
|
|
175
|
-
date: {
|
|
176
|
-
keyword: 'date';
|
|
177
|
-
args: {
|
|
178
|
-
type?: 'date' | 'string';
|
|
179
|
-
};
|
|
180
|
-
};
|
|
181
|
-
time: {
|
|
182
|
-
keyword: 'time';
|
|
183
|
-
args: {
|
|
184
|
-
type?: 'date' | 'string';
|
|
185
|
-
};
|
|
186
|
-
};
|
|
187
|
-
datetime: {
|
|
188
|
-
keyword: 'datetime';
|
|
189
|
-
args: {
|
|
190
|
-
offset?: boolean;
|
|
191
|
-
local?: boolean;
|
|
192
|
-
};
|
|
193
|
-
};
|
|
194
|
-
tuple: {
|
|
195
|
-
keyword: 'tuple';
|
|
196
|
-
args: {
|
|
197
|
-
items: Schema[];
|
|
198
|
-
min?: number;
|
|
199
|
-
max?: number;
|
|
200
|
-
rest?: Schema;
|
|
201
|
-
};
|
|
202
|
-
};
|
|
203
|
-
array: {
|
|
204
|
-
keyword: 'array';
|
|
205
|
-
args: {
|
|
206
|
-
items: Schema[];
|
|
207
|
-
min?: number;
|
|
208
|
-
max?: number;
|
|
209
|
-
unique?: boolean;
|
|
210
|
-
};
|
|
211
|
-
};
|
|
212
|
-
enum: {
|
|
213
|
-
keyword: 'enum';
|
|
214
|
-
args: {
|
|
215
|
-
name: string;
|
|
216
|
-
typeName: string;
|
|
217
|
-
asConst: boolean;
|
|
218
|
-
items: Array<{
|
|
219
|
-
name: string | number;
|
|
220
|
-
format: 'string' | 'number' | 'boolean';
|
|
221
|
-
value?: string | number | boolean;
|
|
222
|
-
}>;
|
|
223
|
-
};
|
|
224
|
-
};
|
|
225
|
-
and: {
|
|
226
|
-
keyword: 'and';
|
|
227
|
-
args: Schema[];
|
|
228
|
-
};
|
|
229
|
-
const: {
|
|
230
|
-
keyword: 'const';
|
|
231
|
-
args: {
|
|
232
|
-
name: string | number;
|
|
233
|
-
format: 'string' | 'number' | 'boolean';
|
|
234
|
-
value?: string | number | boolean;
|
|
235
|
-
};
|
|
236
|
-
};
|
|
237
|
-
union: {
|
|
238
|
-
keyword: 'union';
|
|
239
|
-
args: Schema[];
|
|
240
|
-
};
|
|
241
|
-
ref: {
|
|
242
|
-
keyword: 'ref';
|
|
243
|
-
args: {
|
|
244
|
-
name: string;
|
|
245
|
-
$ref: string;
|
|
246
|
-
/**
|
|
247
|
-
* Full qualified path.
|
|
248
|
-
*/
|
|
249
|
-
path: KubbFile.Path;
|
|
250
|
-
/**
|
|
251
|
-
* When true `File.Import` is used.
|
|
252
|
-
* When false a reference is used inside the current file.
|
|
253
|
-
*/
|
|
254
|
-
isImportable: boolean;
|
|
255
|
-
};
|
|
256
|
-
};
|
|
257
|
-
matches: {
|
|
258
|
-
keyword: 'matches';
|
|
259
|
-
args?: string;
|
|
260
|
-
};
|
|
261
|
-
boolean: {
|
|
262
|
-
keyword: 'boolean';
|
|
263
|
-
};
|
|
264
|
-
default: {
|
|
265
|
-
keyword: 'default';
|
|
266
|
-
args: string | number | boolean;
|
|
267
|
-
};
|
|
268
|
-
string: {
|
|
269
|
-
keyword: 'string';
|
|
270
|
-
};
|
|
271
|
-
integer: {
|
|
272
|
-
keyword: 'integer';
|
|
273
|
-
};
|
|
274
|
-
bigint: {
|
|
275
|
-
keyword: 'bigint';
|
|
276
|
-
};
|
|
277
|
-
number: {
|
|
278
|
-
keyword: 'number';
|
|
279
|
-
};
|
|
280
|
-
max: {
|
|
281
|
-
keyword: 'max';
|
|
282
|
-
args: number;
|
|
283
|
-
};
|
|
284
|
-
min: {
|
|
285
|
-
keyword: 'min';
|
|
286
|
-
args: number;
|
|
287
|
-
};
|
|
288
|
-
exclusiveMaximum: {
|
|
289
|
-
keyword: 'exclusiveMaximum';
|
|
290
|
-
args: number;
|
|
291
|
-
};
|
|
292
|
-
exclusiveMinimum: {
|
|
293
|
-
keyword: 'exclusiveMinimum';
|
|
294
|
-
args: number;
|
|
295
|
-
};
|
|
296
|
-
describe: {
|
|
297
|
-
keyword: 'describe';
|
|
298
|
-
args: string;
|
|
299
|
-
};
|
|
300
|
-
example: {
|
|
301
|
-
keyword: 'example';
|
|
302
|
-
args: string;
|
|
303
|
-
};
|
|
304
|
-
deprecated: {
|
|
305
|
-
keyword: 'deprecated';
|
|
306
|
-
};
|
|
307
|
-
optional: {
|
|
308
|
-
keyword: 'optional';
|
|
309
|
-
};
|
|
310
|
-
undefined: {
|
|
311
|
-
keyword: 'undefined';
|
|
312
|
-
};
|
|
313
|
-
nullish: {
|
|
314
|
-
keyword: 'nullish';
|
|
315
|
-
};
|
|
316
|
-
nullable: {
|
|
317
|
-
keyword: 'nullable';
|
|
318
|
-
};
|
|
319
|
-
null: {
|
|
320
|
-
keyword: 'null';
|
|
321
|
-
};
|
|
322
|
-
any: {
|
|
323
|
-
keyword: 'any';
|
|
324
|
-
};
|
|
325
|
-
unknown: {
|
|
326
|
-
keyword: 'unknown';
|
|
327
|
-
};
|
|
328
|
-
void: {
|
|
329
|
-
keyword: 'void';
|
|
330
|
-
};
|
|
331
|
-
blob: {
|
|
332
|
-
keyword: 'blob';
|
|
333
|
-
};
|
|
334
|
-
schema: {
|
|
335
|
-
keyword: 'schema';
|
|
336
|
-
args: {
|
|
337
|
-
type: 'string' | 'number' | 'integer' | 'boolean' | 'array' | 'object';
|
|
338
|
-
format?: string;
|
|
339
|
-
};
|
|
340
|
-
};
|
|
341
|
-
name: {
|
|
342
|
-
keyword: 'name';
|
|
343
|
-
args: string;
|
|
344
|
-
};
|
|
345
|
-
catchall: {
|
|
346
|
-
keyword: 'catchall';
|
|
347
|
-
};
|
|
348
|
-
interface: {
|
|
349
|
-
keyword: 'interface';
|
|
350
|
-
};
|
|
351
|
-
};
|
|
352
|
-
type Schema = {
|
|
353
|
-
keyword: string;
|
|
354
|
-
} | SchemaKeywordMapper[keyof SchemaKeywordMapper];
|
|
355
|
-
//#endregion
|
|
356
|
-
//#region ../plugin-oas/src/SchemaGenerator.d.ts
|
|
357
|
-
type Context<TOptions, TPluginOptions extends PluginFactoryOptions> = {
|
|
358
|
-
fabric: Fabric;
|
|
359
|
-
oas: Oas;
|
|
360
|
-
pluginManager: PluginManager;
|
|
361
|
-
events?: AsyncEventEmitter<KubbEvents>;
|
|
362
|
-
/**
|
|
363
|
-
* Current plugin
|
|
364
|
-
*/
|
|
365
|
-
plugin: Plugin<TPluginOptions>;
|
|
366
|
-
mode: KubbFile.Mode;
|
|
367
|
-
include?: Array<'schemas' | 'responses' | 'requestBodies'>;
|
|
368
|
-
override: Array<Override<TOptions>> | undefined;
|
|
369
|
-
contentType?: contentType;
|
|
370
|
-
output?: string;
|
|
371
|
-
};
|
|
372
|
-
type SchemaGeneratorOptions = {
|
|
373
|
-
dateType: false | 'string' | 'stringOffset' | 'stringLocal' | 'date';
|
|
374
|
-
integerType?: 'number' | 'bigint';
|
|
375
|
-
unknownType: 'any' | 'unknown' | 'void';
|
|
376
|
-
emptySchemaType: 'any' | 'unknown' | 'void';
|
|
377
|
-
enumType?: 'enum' | 'asConst' | 'asPascalConst' | 'constEnum' | 'literal' | 'inlineLiteral';
|
|
378
|
-
enumSuffix?: string;
|
|
379
|
-
/**
|
|
380
|
-
* @deprecated Will be removed in v5. Use `collisionDetection: true` instead to prevent enum name collisions.
|
|
381
|
-
* When `collisionDetection` is enabled, the rootName-based approach eliminates the need for numeric suffixes.
|
|
382
|
-
* @internal
|
|
383
|
-
*/
|
|
384
|
-
usedEnumNames?: Record<string, number>;
|
|
385
|
-
mapper?: Record<string, string>;
|
|
386
|
-
typed?: boolean;
|
|
387
|
-
transformers: {
|
|
388
|
-
/**
|
|
389
|
-
* Customize the names based on the type that is provided by the plugin.
|
|
390
|
-
*/
|
|
391
|
-
name?: (name: ResolveNameParams['name'], type?: ResolveNameParams['type']) => string;
|
|
392
|
-
/**
|
|
393
|
-
* Receive schema and name(propertyName) and return FakerMeta array
|
|
394
|
-
* TODO TODO add docs
|
|
395
|
-
* @beta
|
|
396
|
-
*/
|
|
397
|
-
schema?: (schemaProps: SchemaProps$1, defaultSchemas: Schema[]) => Array<Schema> | undefined;
|
|
398
|
-
};
|
|
399
|
-
};
|
|
400
|
-
type SchemaProps$1 = {
|
|
401
|
-
schema: SchemaObject | null;
|
|
402
|
-
name: string | null;
|
|
403
|
-
parentName: string | null;
|
|
404
|
-
rootName?: string | null;
|
|
405
|
-
};
|
|
406
|
-
declare class SchemaGenerator<TOptions extends SchemaGeneratorOptions = SchemaGeneratorOptions, TPluginOptions extends PluginFactoryOptions = PluginFactoryOptions, TFileMeta extends FileMetaBase = FileMetaBase> extends BaseGenerator<TOptions, Context<TOptions, TPluginOptions>> {
|
|
407
|
-
#private;
|
|
408
|
-
refs: Refs;
|
|
409
|
-
/**
|
|
410
|
-
* Creates a type node from a given schema.
|
|
411
|
-
* Delegates to getBaseTypeFromSchema internally and
|
|
412
|
-
* optionally adds a union with null.
|
|
413
|
-
*/
|
|
414
|
-
parse(props: SchemaProps$1): Schema[];
|
|
415
|
-
static deepSearch<T extends keyof SchemaKeywordMapper>(tree: Schema[] | undefined, keyword: T): Array<SchemaKeywordMapper[T]>;
|
|
416
|
-
static find<T extends keyof SchemaKeywordMapper>(tree: Schema[] | undefined, keyword: T): SchemaKeywordMapper[T] | undefined;
|
|
417
|
-
static combineObjects(tree: Schema[] | undefined): Schema[];
|
|
418
|
-
build(...generators: Array<Generator<TPluginOptions>>): Promise<Array<KubbFile.File<TFileMeta>>>;
|
|
419
|
-
}
|
|
420
|
-
//#endregion
|
|
421
|
-
//#region ../plugin-oas/src/generators/createGenerator.d.ts
|
|
422
|
-
type CoreGenerator<TOptions extends PluginFactoryOptions> = {
|
|
423
|
-
name: string;
|
|
424
|
-
type: 'core';
|
|
425
|
-
operations: (props: OperationsProps<TOptions>) => Promise<KubbFile.File[]>;
|
|
426
|
-
operation: (props: OperationProps<TOptions>) => Promise<KubbFile.File[]>;
|
|
427
|
-
schema: (props: SchemaProps<TOptions>) => Promise<KubbFile.File[]>;
|
|
428
|
-
};
|
|
429
|
-
//#endregion
|
|
430
|
-
//#region ../plugin-oas/src/generators/types.d.ts
|
|
431
|
-
type OperationsProps<TOptions extends PluginFactoryOptions> = {
|
|
432
|
-
config: Config;
|
|
433
|
-
generator: Omit<OperationGenerator<TOptions>, 'build'>;
|
|
434
|
-
plugin: Plugin<TOptions>;
|
|
435
|
-
operations: Array<Operation>;
|
|
436
|
-
};
|
|
437
|
-
type OperationProps<TOptions extends PluginFactoryOptions> = {
|
|
438
|
-
config: Config;
|
|
439
|
-
generator: Omit<OperationGenerator<TOptions>, 'build'>;
|
|
440
|
-
plugin: Plugin<TOptions>;
|
|
441
|
-
operation: Operation;
|
|
442
|
-
};
|
|
443
|
-
type SchemaProps<TOptions extends PluginFactoryOptions> = {
|
|
444
|
-
config: Config;
|
|
445
|
-
generator: Omit<SchemaGenerator<SchemaGeneratorOptions, TOptions>, 'build'>;
|
|
446
|
-
plugin: Plugin<TOptions>;
|
|
447
|
-
schema: {
|
|
448
|
-
name: string;
|
|
449
|
-
tree: Array<Schema>;
|
|
450
|
-
value: SchemaObject;
|
|
451
|
-
};
|
|
452
|
-
};
|
|
453
|
-
type Generator<TOptions extends PluginFactoryOptions> = CoreGenerator<TOptions> | ReactGenerator<TOptions>;
|
|
454
|
-
//#endregion
|
|
455
|
-
//#region ../plugin-oas/src/generators/createReactGenerator.d.ts
|
|
456
|
-
type ReactGenerator<TOptions extends PluginFactoryOptions> = {
|
|
457
|
-
name: string;
|
|
458
|
-
type: 'react';
|
|
459
|
-
Operations: (props: OperationsProps<TOptions>) => FabricReactNode;
|
|
460
|
-
Operation: (props: OperationProps<TOptions>) => FabricReactNode;
|
|
461
|
-
Schema: (props: SchemaProps<TOptions>) => FabricReactNode;
|
|
462
|
-
};
|
|
463
|
-
//#endregion
|
|
464
|
-
//#region src/generators/mcpGenerator.d.ts
|
|
465
|
-
declare const mcpGenerator: ReactGenerator<PluginMcp>;
|
|
466
|
-
//#endregion
|
|
467
|
-
//#region src/generators/serverGenerator.d.ts
|
|
468
|
-
declare const serverGenerator: ReactGenerator<PluginMcp>;
|
|
469
|
-
//#endregion
|
|
470
|
-
export { mcpGenerator, serverGenerator };
|
|
471
|
-
//# sourceMappingURL=generators.d.cts.map
|
package/dist/index.d.cts
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { t as __name } from "./chunk-DHUGjThq.cjs";
|
|
2
|
-
import { n as PluginMcp, t as Options } from "./types-CRIAfDoH.cjs";
|
|
3
|
-
import * as _kubb_core0 from "@kubb/core";
|
|
4
|
-
|
|
5
|
-
//#region src/plugin.d.ts
|
|
6
|
-
declare const pluginMcpName = "plugin-mcp";
|
|
7
|
-
declare const pluginMcp: (options?: Options | undefined) => _kubb_core0.UserPluginWithLifeCycle<PluginMcp>;
|
|
8
|
-
//#endregion
|
|
9
|
-
export { type PluginMcp, pluginMcp, pluginMcpName };
|
|
10
|
-
//# sourceMappingURL=index.d.cts.map
|