@kubb/plugin-mcp 4.3.0 → 4.4.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/dist/{OperationGenerator-Bq_OAgZR.d.cts → SchemaGenerator-C1vgcKII.d.cts} +220 -201
- package/dist/{OperationGenerator-CVN32WMS.d.ts → SchemaGenerator-wXj7HtlS.d.ts} +225 -206
- package/dist/{Server-CKHk0vlR.js → Server-DMDo69md.js} +3 -3
- package/dist/Server-DMDo69md.js.map +1 -0
- package/dist/{Server-AWXKgK_d.cjs → Server-vKCXRjmg.cjs} +8 -8
- package/dist/Server-vKCXRjmg.cjs.map +1 -0
- package/dist/chunk-DMmIE7y6.js +28 -0
- package/dist/components.cjs +1 -1
- package/dist/components.d.cts +3 -2
- package/dist/components.d.ts +3 -2
- package/dist/components.js +1 -1
- package/dist/{generators-naBCKi9F.cjs → generators-8HowWmDg.cjs} +20 -20
- package/dist/generators-8HowWmDg.cjs.map +1 -0
- package/dist/{generators-zuKj-GtG.js → generators-Bp0d1HbP.js} +4 -4
- package/dist/generators-Bp0d1HbP.js.map +1 -0
- package/dist/generators.cjs +2 -2
- package/dist/generators.d.cts +4 -4
- package/dist/generators.d.ts +4 -4
- package/dist/generators.js +2 -2
- package/dist/index.cjs +3 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +3 -2
- package/dist/index.js.map +1 -1
- package/dist/{types-BtZpMsBD.d.ts → types-3zb5y21F.d.cts} +2 -2
- package/dist/{types-Dr8_aqGF.d.cts → types-b6nPxXzv.d.ts} +2 -2
- package/package.json +10 -10
- package/src/components/Server.tsx +3 -2
- package/src/generators/mcpGenerator.tsx +1 -1
- package/src/generators/serverGenerator.tsx +1 -1
- package/src/plugin.ts +1 -0
- package/src/types.ts +2 -2
- package/dist/Server-AWXKgK_d.cjs.map +0 -1
- package/dist/Server-CKHk0vlR.js.map +0 -1
- package/dist/generators-naBCKi9F.cjs.map +0 -1
- package/dist/generators-zuKj-GtG.js.map +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Server-DMDo69md.js","names":[],"sources":["../src/components/Server.tsx"],"sourcesContent":["import type { KubbFile } from '@kubb/core/fs'\nimport type { KubbNode } from '@kubb/react-fabric/types'\n\nimport { Const, File, FunctionParams } from '@kubb/react-fabric'\nimport type { OperationSchemas } from '@kubb/plugin-oas'\nimport { getPathParams, isOptional } from '@kubb/plugin-oas/utils'\nimport { isNullable, isReference } from '@kubb/oas'\nimport { camelCase } from '@kubb/core/transformers'\n\ntype Props = {\n name: string\n serverName: string\n serverVersion: string\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}\n\nfunction getParams({ schemas }: GetParamsProps) {\n const pathParams = getPathParams(schemas.pathParams, {\n typed: false,\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 [camelCase(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, operations }: Props): KubbNode {\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 })\n\n if (zod.schemas.request?.name || zod.schemas.headerParams?.name || zod.schemas.queryParams?.name || zod.schemas.pathParams?.name) {\n return `\nserver.tool(${JSON.stringify(tool.name)}, ${JSON.stringify(tool.description)}, ${paramsClient.toObjectValue()}, async (${paramsClient.toObject()}) => {\n return ${mcp.name}(${paramsClient.toObject()})\n})\n `\n }\n\n return `\nserver.tool(${JSON.stringify(tool.name)}, ${JSON.stringify(tool.description)}, async () => {\n return ${mcp.name}(${paramsClient.toObject()})\n})\n `\n })\n .filter(Boolean)}\n\n {`\nasync function startServer() {\n try {\n const transport = new StdioServerTransport()\n await server.connect(transport)\n\n } catch (error) {\n console.error('Failed to start server:', error)\n process.exit(1)\n }\n}\n\nstartServer()\n`}\n </File.Source>\n )\n}\n"],"mappings":";;;;;;;AAqCA,SAAS,UAAU,EAAE,WAA2B;CAC9C,MAAM,aAAa,cAAc,QAAQ,YAAY,EACnD,OAAO,OACR,CAAC;AAEF,QAAO,eAAe,QAAQ,EAC5B,MAAM;EACJ,MAAM;EACN,UAAU;GACR,GAAG,OAAO,QAAQ,WAAW,CAAC,QAAQ,KAAK,CAAC,KAAK,WAAW;AAC1D,QAAI,SAAS,QAAQ,YAAY,MAAM;KACrC,IAAI,SAAS;AAEb,SAAI,WAAW,QAAQ,WAAW,OAAO,CACvC,KAAI,YAAY,QAAQ,WAAW,CACjC,UAAS;SAET,UAAS;cAGP,YAAY,QAAQ,WAAW,CACjC,UAAS;AAIb,WAAM,QAAQ,GAAG,QAAQ,YAAY,OAAO,OAAO,IAAI,IAAI;;AA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b_core_transformers);
|
|
26
26
|
let __kubb_plugin_oas_utils = require("@kubb/plugin-oas/utils");
|
|
27
27
|
__kubb_plugin_oas_utils = __toESM(__kubb_plugin_oas_utils);
|
|
28
|
-
let
|
|
29
|
-
|
|
30
|
-
let
|
|
31
|
-
|
|
28
|
+
let __kubb_react_fabric = require("@kubb/react-fabric");
|
|
29
|
+
__kubb_react_fabric = __toESM(__kubb_react_fabric);
|
|
30
|
+
let __kubb_react_fabric_jsx_runtime = require("@kubb/react-fabric/jsx-runtime");
|
|
31
|
+
__kubb_react_fabric_jsx_runtime = __toESM(__kubb_react_fabric_jsx_runtime);
|
|
32
32
|
let __kubb_oas = require("@kubb/oas");
|
|
33
33
|
__kubb_oas = __toESM(__kubb_oas);
|
|
34
34
|
|
|
35
35
|
//#region src/components/Server.tsx
|
|
36
36
|
function getParams({ schemas }) {
|
|
37
37
|
const pathParams = (0, __kubb_plugin_oas_utils.getPathParams)(schemas.pathParams, { typed: false });
|
|
38
|
-
return
|
|
38
|
+
return __kubb_react_fabric.FunctionParams.factory({ data: {
|
|
39
39
|
mode: "object",
|
|
40
40
|
children: {
|
|
41
41
|
...Object.entries(pathParams).reduce((acc, [key, param]) => {
|
|
@@ -67,12 +67,12 @@ function getParams({ schemas }) {
|
|
|
67
67
|
} });
|
|
68
68
|
}
|
|
69
69
|
function Server({ name, serverName, serverVersion, operations }) {
|
|
70
|
-
return /* @__PURE__ */ (0,
|
|
70
|
+
return /* @__PURE__ */ (0, __kubb_react_fabric_jsx_runtime.jsxs)(__kubb_react_fabric.File.Source, {
|
|
71
71
|
name,
|
|
72
72
|
isExportable: true,
|
|
73
73
|
isIndexable: true,
|
|
74
74
|
children: [
|
|
75
|
-
/* @__PURE__ */ (0,
|
|
75
|
+
/* @__PURE__ */ (0, __kubb_react_fabric_jsx_runtime.jsx)(__kubb_react_fabric.Const, {
|
|
76
76
|
name: "server",
|
|
77
77
|
export: true,
|
|
78
78
|
children: `
|
|
@@ -126,4 +126,4 @@ Object.defineProperty(exports, '__toESM', {
|
|
|
126
126
|
return __toESM;
|
|
127
127
|
}
|
|
128
128
|
});
|
|
129
|
-
//# sourceMappingURL=Server-
|
|
129
|
+
//# sourceMappingURL=Server-vKCXRjmg.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Server-vKCXRjmg.cjs","names":["FunctionParams","File","Const"],"sources":["../src/components/Server.tsx"],"sourcesContent":["import type { KubbFile } from '@kubb/core/fs'\nimport type { KubbNode } from '@kubb/react-fabric/types'\n\nimport { Const, File, FunctionParams } from '@kubb/react-fabric'\nimport type { OperationSchemas } from '@kubb/plugin-oas'\nimport { getPathParams, isOptional } from '@kubb/plugin-oas/utils'\nimport { isNullable, isReference } from '@kubb/oas'\nimport { camelCase } from '@kubb/core/transformers'\n\ntype Props = {\n name: string\n serverName: string\n serverVersion: string\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}\n\nfunction getParams({ schemas }: GetParamsProps) {\n const pathParams = getPathParams(schemas.pathParams, {\n typed: false,\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 [camelCase(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, operations }: Props): KubbNode {\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 })\n\n if (zod.schemas.request?.name || zod.schemas.headerParams?.name || zod.schemas.queryParams?.name || zod.schemas.pathParams?.name) {\n return `\nserver.tool(${JSON.stringify(tool.name)}, ${JSON.stringify(tool.description)}, ${paramsClient.toObjectValue()}, async (${paramsClient.toObject()}) => {\n return ${mcp.name}(${paramsClient.toObject()})\n})\n `\n }\n\n return `\nserver.tool(${JSON.stringify(tool.name)}, ${JSON.stringify(tool.description)}, async () => {\n return ${mcp.name}(${paramsClient.toObject()})\n})\n `\n })\n .filter(Boolean)}\n\n {`\nasync function startServer() {\n try {\n const transport = new StdioServerTransport()\n await server.connect(transport)\n\n } catch (error) {\n console.error('Failed to start server:', error)\n process.exit(1)\n }\n}\n\nstartServer()\n`}\n </File.Source>\n )\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAqCA,SAAS,UAAU,EAAE,WAA2B;CAC9C,MAAM,wDAA2B,QAAQ,YAAY,EACnD,OAAO,OACR,CAAC;AAEF,QAAOA,mCAAe,QAAQ,EAC5B,MAAM;EACJ,MAAM;EACN,UAAU;GACR,GAAG,OAAO,QAAQ,WAAW,CAAC,QAAQ,KAAK,CAAC,KAAK,WAAW;AAC1D,QAAI,SAAS,QAAQ,YAAY,MAAM;KACrC,IAAI,SAAS;AAEb,oCAAe,QAAQ,WAAW,OAAO,CACvC,iCAAgB,QA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;;;;;;;;;;;;;;;GAcW"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { createRequire } from "node:module";
|
|
2
|
+
|
|
3
|
+
//#region rolldown:runtime
|
|
4
|
+
var __create = Object.create;
|
|
5
|
+
var __defProp = Object.defineProperty;
|
|
6
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
7
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
8
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
9
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
|
|
12
|
+
key = keys[i];
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
14
|
+
get: ((k) => from[k]).bind(null, key),
|
|
15
|
+
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
16
|
+
});
|
|
17
|
+
}
|
|
18
|
+
return to;
|
|
19
|
+
};
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
|
|
21
|
+
value: mod,
|
|
22
|
+
enumerable: true
|
|
23
|
+
}) : target, mod));
|
|
24
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
25
|
+
var __require = /* @__PURE__ */ createRequire(import.meta.url);
|
|
26
|
+
|
|
27
|
+
//#endregion
|
|
28
|
+
export { };
|
package/dist/components.cjs
CHANGED
package/dist/components.d.cts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { h as File, r as OperationSchemas } from "./SchemaGenerator-C1vgcKII.cjs";
|
|
2
|
+
import { KubbNode } from "@kubb/react-fabric/types";
|
|
2
3
|
|
|
3
4
|
//#region src/components/Server.d.ts
|
|
4
5
|
type Props = {
|
|
@@ -29,7 +30,7 @@ declare function Server({
|
|
|
29
30
|
serverName,
|
|
30
31
|
serverVersion,
|
|
31
32
|
operations
|
|
32
|
-
}: Props):
|
|
33
|
+
}: Props): KubbNode;
|
|
33
34
|
//#endregion
|
|
34
35
|
export { Server };
|
|
35
36
|
//# sourceMappingURL=components.d.cts.map
|
package/dist/components.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { h as File, r as OperationSchemas } from "./SchemaGenerator-wXj7HtlS.js";
|
|
2
|
+
import { KubbNode } from "@kubb/react-fabric/types";
|
|
2
3
|
|
|
3
4
|
//#region src/components/Server.d.ts
|
|
4
5
|
type Props = {
|
|
@@ -29,7 +30,7 @@ declare function Server({
|
|
|
29
30
|
serverName,
|
|
30
31
|
serverVersion,
|
|
31
32
|
operations
|
|
32
|
-
}: Props):
|
|
33
|
+
}: Props): KubbNode;
|
|
33
34
|
//#endregion
|
|
34
35
|
export { Server };
|
|
35
36
|
//# sourceMappingURL=components.d.ts.map
|
package/dist/components.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const require_Server = require('./Server-
|
|
1
|
+
const require_Server = require('./Server-vKCXRjmg.cjs');
|
|
2
2
|
let __kubb_plugin_oas = require("@kubb/plugin-oas");
|
|
3
3
|
__kubb_plugin_oas = require_Server.__toESM(__kubb_plugin_oas);
|
|
4
4
|
let __kubb_plugin_ts = require("@kubb/plugin-ts");
|
|
@@ -13,10 +13,10 @@ let __kubb_plugin_oas_hooks = require("@kubb/plugin-oas/hooks");
|
|
|
13
13
|
__kubb_plugin_oas_hooks = require_Server.__toESM(__kubb_plugin_oas_hooks);
|
|
14
14
|
let __kubb_plugin_oas_utils = require("@kubb/plugin-oas/utils");
|
|
15
15
|
__kubb_plugin_oas_utils = require_Server.__toESM(__kubb_plugin_oas_utils);
|
|
16
|
-
let
|
|
17
|
-
|
|
18
|
-
let
|
|
19
|
-
|
|
16
|
+
let __kubb_react_fabric = require("@kubb/react-fabric");
|
|
17
|
+
__kubb_react_fabric = require_Server.__toESM(__kubb_react_fabric);
|
|
18
|
+
let __kubb_react_fabric_jsx_runtime = require("@kubb/react-fabric/jsx-runtime");
|
|
19
|
+
__kubb_react_fabric_jsx_runtime = require_Server.__toESM(__kubb_react_fabric_jsx_runtime);
|
|
20
20
|
|
|
21
21
|
//#region src/generators/mcpGenerator.tsx
|
|
22
22
|
const mcpGenerator = (0, __kubb_plugin_oas.createReactGenerator)({
|
|
@@ -39,7 +39,7 @@ const mcpGenerator = (0, __kubb_plugin_oas.createReactGenerator)({
|
|
|
39
39
|
type: "type"
|
|
40
40
|
})
|
|
41
41
|
};
|
|
42
|
-
return /* @__PURE__ */ (0,
|
|
42
|
+
return /* @__PURE__ */ (0, __kubb_react_fabric_jsx_runtime.jsxs)(__kubb_react_fabric.File, {
|
|
43
43
|
baseName: mcp.file.baseName,
|
|
44
44
|
path: mcp.file.path,
|
|
45
45
|
meta: mcp.file.meta,
|
|
@@ -52,21 +52,21 @@ const mcpGenerator = (0, __kubb_plugin_oas.createReactGenerator)({
|
|
|
52
52
|
output: options.output
|
|
53
53
|
}),
|
|
54
54
|
children: [
|
|
55
|
-
/* @__PURE__ */ (0,
|
|
55
|
+
/* @__PURE__ */ (0, __kubb_react_fabric_jsx_runtime.jsx)(__kubb_react_fabric.File.Import, {
|
|
56
56
|
name: ["CallToolResult"],
|
|
57
57
|
path: "@modelcontextprotocol/sdk/types",
|
|
58
58
|
isTypeOnly: true
|
|
59
59
|
}),
|
|
60
|
-
/* @__PURE__ */ (0,
|
|
60
|
+
/* @__PURE__ */ (0, __kubb_react_fabric_jsx_runtime.jsx)(__kubb_react_fabric.File.Import, {
|
|
61
61
|
name: "fetch",
|
|
62
62
|
path: options.client.importPath
|
|
63
63
|
}),
|
|
64
|
-
/* @__PURE__ */ (0,
|
|
64
|
+
/* @__PURE__ */ (0, __kubb_react_fabric_jsx_runtime.jsx)(__kubb_react_fabric.File.Import, {
|
|
65
65
|
name: ["RequestConfig", "ResponseErrorConfig"],
|
|
66
66
|
path: options.client.importPath,
|
|
67
67
|
isTypeOnly: true
|
|
68
68
|
}),
|
|
69
|
-
/* @__PURE__ */ (0,
|
|
69
|
+
/* @__PURE__ */ (0, __kubb_react_fabric_jsx_runtime.jsx)(__kubb_react_fabric.File.Import, {
|
|
70
70
|
name: [
|
|
71
71
|
type.schemas.request?.name,
|
|
72
72
|
type.schemas.response.name,
|
|
@@ -79,7 +79,7 @@ const mcpGenerator = (0, __kubb_plugin_oas.createReactGenerator)({
|
|
|
79
79
|
path: type.file.path,
|
|
80
80
|
isTypeOnly: true
|
|
81
81
|
}),
|
|
82
|
-
/* @__PURE__ */ (0,
|
|
82
|
+
/* @__PURE__ */ (0, __kubb_react_fabric_jsx_runtime.jsxs)(__kubb_plugin_client_components.Client, {
|
|
83
83
|
name: mcp.name,
|
|
84
84
|
isConfigurable: false,
|
|
85
85
|
returnType: "Promise<CallToolResult>",
|
|
@@ -164,11 +164,11 @@ const serverGenerator = (0, __kubb_plugin_oas.createReactGenerator)({
|
|
|
164
164
|
};
|
|
165
165
|
});
|
|
166
166
|
const imports = operationsMapped.flatMap(({ mcp, zod }) => {
|
|
167
|
-
return [/* @__PURE__ */ (0,
|
|
167
|
+
return [/* @__PURE__ */ (0, __kubb_react_fabric_jsx_runtime.jsx)(__kubb_react_fabric.File.Import, {
|
|
168
168
|
name: [mcp.name],
|
|
169
169
|
root: file.path,
|
|
170
170
|
path: mcp.file.path
|
|
171
|
-
}, mcp.name), /* @__PURE__ */ (0,
|
|
171
|
+
}, mcp.name), /* @__PURE__ */ (0, __kubb_react_fabric_jsx_runtime.jsx)(__kubb_react_fabric.File.Import, {
|
|
172
172
|
name: [
|
|
173
173
|
zod.schemas.request?.name,
|
|
174
174
|
zod.schemas.pathParams?.name,
|
|
@@ -179,7 +179,7 @@ const serverGenerator = (0, __kubb_plugin_oas.createReactGenerator)({
|
|
|
179
179
|
path: zod.file.path
|
|
180
180
|
}, zod.name)];
|
|
181
181
|
});
|
|
182
|
-
return /* @__PURE__ */ (0,
|
|
182
|
+
return /* @__PURE__ */ (0, __kubb_react_fabric_jsx_runtime.jsxs)(__kubb_react_fabric_jsx_runtime.Fragment, { children: [/* @__PURE__ */ (0, __kubb_react_fabric_jsx_runtime.jsxs)(__kubb_react_fabric.File, {
|
|
183
183
|
baseName: file.baseName,
|
|
184
184
|
path: file.path,
|
|
185
185
|
meta: file.meta,
|
|
@@ -193,27 +193,27 @@ const serverGenerator = (0, __kubb_plugin_oas.createReactGenerator)({
|
|
|
193
193
|
output: options.output
|
|
194
194
|
}),
|
|
195
195
|
children: [
|
|
196
|
-
/* @__PURE__ */ (0,
|
|
196
|
+
/* @__PURE__ */ (0, __kubb_react_fabric_jsx_runtime.jsx)(__kubb_react_fabric.File.Import, {
|
|
197
197
|
name: ["McpServer"],
|
|
198
198
|
path: "@modelcontextprotocol/sdk/server/mcp"
|
|
199
199
|
}),
|
|
200
|
-
/* @__PURE__ */ (0,
|
|
200
|
+
/* @__PURE__ */ (0, __kubb_react_fabric_jsx_runtime.jsx)(__kubb_react_fabric.File.Import, {
|
|
201
201
|
name: ["StdioServerTransport"],
|
|
202
202
|
path: "@modelcontextprotocol/sdk/server/stdio"
|
|
203
203
|
}),
|
|
204
204
|
imports,
|
|
205
|
-
/* @__PURE__ */ (0,
|
|
205
|
+
/* @__PURE__ */ (0, __kubb_react_fabric_jsx_runtime.jsx)(require_Server.Server, {
|
|
206
206
|
name,
|
|
207
207
|
serverName: oas.api.info?.title,
|
|
208
208
|
serverVersion: oas.getVersion(),
|
|
209
209
|
operations: operationsMapped
|
|
210
210
|
})
|
|
211
211
|
]
|
|
212
|
-
}), /* @__PURE__ */ (0,
|
|
212
|
+
}), /* @__PURE__ */ (0, __kubb_react_fabric_jsx_runtime.jsx)(__kubb_react_fabric.File, {
|
|
213
213
|
baseName: jsonFile.baseName,
|
|
214
214
|
path: jsonFile.path,
|
|
215
215
|
meta: jsonFile.meta,
|
|
216
|
-
children: /* @__PURE__ */ (0,
|
|
216
|
+
children: /* @__PURE__ */ (0, __kubb_react_fabric_jsx_runtime.jsx)(__kubb_react_fabric.File.Source, {
|
|
217
217
|
name,
|
|
218
218
|
children: `
|
|
219
219
|
{
|
|
@@ -244,4 +244,4 @@ Object.defineProperty(exports, 'serverGenerator', {
|
|
|
244
244
|
return serverGenerator;
|
|
245
245
|
}
|
|
246
246
|
});
|
|
247
|
-
//# sourceMappingURL=generators-
|
|
247
|
+
//# sourceMappingURL=generators-8HowWmDg.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"generators-8HowWmDg.cjs","names":["pluginTsName","File","Client","pluginZodName","pluginTsName","File","Server"],"sources":["../src/generators/mcpGenerator.tsx","../src/generators/serverGenerator.tsx"],"sourcesContent":["import { usePlugin } from '@kubb/core/hooks'\nimport { Client } from '@kubb/plugin-client/components'\nimport { createReactGenerator } from '@kubb/plugin-oas'\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({ operation }) {\n const { options } = usePlugin<PluginMcp>()\n const oas = useOas()\n const { getSchemas, getName, getFile } = useOperationManager()\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 <File.Import name={['CallToolResult']} path={'@modelcontextprotocol/sdk/types'} isTypeOnly />\n <File.Import name={'fetch'} path={options.client.importPath} />\n <File.Import name={['RequestConfig', 'ResponseErrorConfig']} path={options.client.importPath} 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}\n paramsType={'object'}\n paramsCasing={'camelcase'}\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 { usePlugin, usePluginManager } from '@kubb/core/hooks'\nimport { createReactGenerator } from '@kubb/plugin-oas'\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, options }) {\n const plugin = usePlugin<PluginMcp>()\n const pluginManager = usePluginManager()\n\n const oas = useOas()\n const { getFile, getName, getSchemas } = useOperationManager()\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 name={name} serverName={oas.api.info?.title} serverVersion={oas.getVersion()} operations={operationsMapped} />\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":";;;;;;;;;;;;;;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C,EAC5E;IACF;IACD;EAEF,MAAM,UAAU,iBAAiB,SAAS,EAAE,KAAK,UAAU;AACzD,UAAO,CACL,yDAACC,yBAAK;IAAsB,MAAM,CAAC,IAAI,KAAK;IAAE,MAAM,KAAK;IAAM,MAAM,IAAI,KAAK;MAA5D,IAAI,KAAgE,EACtF,yDAACA,yBAAK;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,iHACE,0DAACA;GACC,UAAU,KAAK;GACf,MAAM,KAAK;GACX,MAAM,KAAK;GACX,+CAAkB;IAAE;IAAK,QAAQ,QAAQ;IAAQ,QAAQ,cAAc;IAAQ,CAAC;GAChF,+CAAkB;IAAE;IAAK,QAAQ,QAAQ;IAAQ,CAAC;;IAElD,yDAACA,yBAAK;KAAO,MAAM,CAAC,YAAY;KAAE,MAAM;MAA0C;IAClF,yDAACA,yBAAK;KAAO,MAAM,CAAC,uBAAuB;KAAE,MAAM;MAA4C;IAE9F;IACD,yDAACC;KAAa;KAAM,YAAY,IAAI,IAAI,MAAM;KAAO,eAAe,IAAI,YAAY;KAAE,YAAY;MAAoB;;IACjH,EAEP,yDAACD;GAAK,UAAU,SAAS;GAAU,MAAM,SAAS;GAAM,MAAM,SAAS;aACrE,yDAACA,yBAAK;IAAa;cAChB;;;iBAGI,IAAI,IAAI,MAAM,SAAS,SAAS;;;mCAGd,KAAK,KAAK;;;;;KAKrB;IACT,IACN;;CAGR,CAAC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { t as Server } from "./Server-
|
|
1
|
+
import { t as Server } from "./Server-DMDo69md.js";
|
|
2
2
|
import { createReactGenerator } from "@kubb/plugin-oas";
|
|
3
3
|
import { pluginTsName } from "@kubb/plugin-ts";
|
|
4
4
|
import { pluginZodName } from "@kubb/plugin-zod";
|
|
@@ -6,8 +6,8 @@ import { usePlugin, usePluginManager } from "@kubb/core/hooks";
|
|
|
6
6
|
import { Client } from "@kubb/plugin-client/components";
|
|
7
7
|
import { useOas, useOperationManager } from "@kubb/plugin-oas/hooks";
|
|
8
8
|
import { getBanner, getFooter } from "@kubb/plugin-oas/utils";
|
|
9
|
-
import { File } from "@kubb/react";
|
|
10
|
-
import { Fragment, jsx, jsxs } from "@kubb/react/jsx-runtime";
|
|
9
|
+
import { File } from "@kubb/react-fabric";
|
|
10
|
+
import { Fragment, jsx, jsxs } from "@kubb/react-fabric/jsx-runtime";
|
|
11
11
|
|
|
12
12
|
//#region src/generators/mcpGenerator.tsx
|
|
13
13
|
const mcpGenerator = createReactGenerator({
|
|
@@ -224,4 +224,4 @@ const serverGenerator = createReactGenerator({
|
|
|
224
224
|
|
|
225
225
|
//#endregion
|
|
226
226
|
export { mcpGenerator as n, serverGenerator as t };
|
|
227
|
-
//# sourceMappingURL=generators-
|
|
227
|
+
//# sourceMappingURL=generators-Bp0d1HbP.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"generators-Bp0d1HbP.js","names":[],"sources":["../src/generators/mcpGenerator.tsx","../src/generators/serverGenerator.tsx"],"sourcesContent":["import { usePlugin } from '@kubb/core/hooks'\nimport { Client } from '@kubb/plugin-client/components'\nimport { createReactGenerator } from '@kubb/plugin-oas'\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({ operation }) {\n const { options } = usePlugin<PluginMcp>()\n const oas = useOas()\n const { getSchemas, getName, getFile } = useOperationManager()\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 <File.Import name={['CallToolResult']} path={'@modelcontextprotocol/sdk/types'} isTypeOnly />\n <File.Import name={'fetch'} path={options.client.importPath} />\n <File.Import name={['RequestConfig', 'ResponseErrorConfig']} path={options.client.importPath} 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}\n paramsType={'object'}\n paramsCasing={'camelcase'}\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 { usePlugin, usePluginManager } from '@kubb/core/hooks'\nimport { createReactGenerator } from '@kubb/plugin-oas'\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, options }) {\n const plugin = usePlugin<PluginMcp>()\n const pluginManager = usePluginManager()\n\n const oas = useOas()\n const { getFile, getName, getSchemas } = useOperationManager()\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 name={name} serverName={oas.api.info?.title} serverVersion={oas.getVersion()} operations={operationsMapped} />\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,aAAa;EACvB,MAAM,EAAE,YAAY,WAAsB;EAC1C,MAAM,MAAM,QAAQ;EACpB,MAAM,EAAE,YAAY,SAAS,YAAY,qBAAqB;EAE9D,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;;IAElD,oBAAC,KAAK;KAAO,MAAM,CAAC,iBAAiB;KAAE,MAAM;KAAmC;MAAa;IAC7F,oBAAC,KAAK;KAAO,MAAM;KAAS,MAAM,QAAQ,OAAO;MAAc;IAC/D,oBAAC,KAAK;KAAO,MAAM,CAAC,iBAAiB,sBAAsB;KAAE,MAAM,QAAQ,OAAO;KAAY;MAAa;IAC3G,oBAAC,KAAK;KACJ,MAAM;MACJ,KAAK,QAAQ,SAAS;MACtB,KAAK,QAAQ,SAAS;MACtB,KAAK,QAAQ,YAA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AAM,SAAS;aACrE,oBAAC,KAAK;IAAa;cAChB;;;iBAGI,IAAI,IAAI,MAAM,SAAS,SAAS;;;mCAGd,KAAK,KAAK;;;;;KAKrB;IACT,IACN;;CAGR,CAAC"}
|
package/dist/generators.cjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
require('./Server-
|
|
2
|
-
const require_generators = require('./generators-
|
|
1
|
+
require('./Server-vKCXRjmg.cjs');
|
|
2
|
+
const require_generators = require('./generators-8HowWmDg.cjs');
|
|
3
3
|
|
|
4
4
|
exports.mcpGenerator = require_generators.mcpGenerator;
|
|
5
5
|
exports.serverGenerator = require_generators.serverGenerator;
|
package/dist/generators.d.cts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { n as PluginMcp } from "./types-
|
|
1
|
+
import { s as ReactGenerator } from "./SchemaGenerator-C1vgcKII.cjs";
|
|
2
|
+
import { n as PluginMcp } from "./types-3zb5y21F.cjs";
|
|
3
3
|
|
|
4
4
|
//#region src/generators/mcpGenerator.d.ts
|
|
5
|
-
declare const mcpGenerator:
|
|
5
|
+
declare const mcpGenerator: ReactGenerator<PluginMcp>;
|
|
6
6
|
//#endregion
|
|
7
7
|
//#region src/generators/serverGenerator.d.ts
|
|
8
|
-
declare const serverGenerator:
|
|
8
|
+
declare const serverGenerator: ReactGenerator<PluginMcp>;
|
|
9
9
|
//#endregion
|
|
10
10
|
export { mcpGenerator, serverGenerator };
|
|
11
11
|
//# sourceMappingURL=generators.d.cts.map
|
package/dist/generators.d.ts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { n as PluginMcp } from "./types-
|
|
1
|
+
import { s as ReactGenerator } from "./SchemaGenerator-wXj7HtlS.js";
|
|
2
|
+
import { n as PluginMcp } from "./types-b6nPxXzv.js";
|
|
3
3
|
|
|
4
4
|
//#region src/generators/mcpGenerator.d.ts
|
|
5
|
-
declare const mcpGenerator:
|
|
5
|
+
declare const mcpGenerator: ReactGenerator<PluginMcp>;
|
|
6
6
|
//#endregion
|
|
7
7
|
//#region src/generators/serverGenerator.d.ts
|
|
8
|
-
declare const serverGenerator:
|
|
8
|
+
declare const serverGenerator: ReactGenerator<PluginMcp>;
|
|
9
9
|
//#endregion
|
|
10
10
|
export { mcpGenerator, serverGenerator };
|
|
11
11
|
//# sourceMappingURL=generators.d.ts.map
|
package/dist/generators.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { n as mcpGenerator, t as serverGenerator } from "./generators-
|
|
2
|
-
import "./Server-
|
|
1
|
+
import { n as mcpGenerator, t as serverGenerator } from "./generators-Bp0d1HbP.js";
|
|
2
|
+
import "./Server-DMDo69md.js";
|
|
3
3
|
|
|
4
4
|
export { mcpGenerator, serverGenerator };
|
package/dist/index.cjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
const require_Server = require('./Server-
|
|
2
|
-
const require_generators = require('./generators-
|
|
1
|
+
const require_Server = require('./Server-vKCXRjmg.cjs');
|
|
2
|
+
const require_generators = require('./generators-8HowWmDg.cjs');
|
|
3
3
|
let node_path = require("node:path");
|
|
4
4
|
node_path = require_Server.__toESM(node_path);
|
|
5
5
|
let __kubb_core = require("@kubb/core");
|
|
@@ -64,6 +64,7 @@ const pluginMcp = (0, __kubb_core.createPlugin)((options) => {
|
|
|
64
64
|
const root = node_path.default.resolve(this.config.root, this.config.output.path);
|
|
65
65
|
const mode = (0, __kubb_core.getMode)(node_path.default.resolve(root, output.path));
|
|
66
66
|
const files = await new __kubb_plugin_oas.OperationGenerator(this.plugin.options, {
|
|
67
|
+
fabric: this.fabric,
|
|
67
68
|
oas,
|
|
68
69
|
pluginManager: this.pluginManager,
|
|
69
70
|
plugin: this.plugin,
|
package/dist/index.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","names":["mcpGenerator","serverGenerator","pluginOasName","pluginTsName","pluginZodName","path","options","groupName: Group['name']","PluginManager","OperationGenerator"],"sources":["../src/plugin.ts"],"sourcesContent":["import path from 'node:path'\nimport { createPlugin, type Group, getBarrelFiles, getMode, type Plugin, PluginManager } from '@kubb/core'\nimport { camelCase } from '@kubb/core/transformers'\nimport type { PluginOas as SwaggerPluginOptions } from '@kubb/plugin-oas'\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 = createPlugin<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 } = options\n\n return {\n name: pluginMcpName,\n options: {\n output,\n group,\n client: {\n importPath: '@kubb/plugin-client/clients/axios',\n dataReturnType: 'data',\n ...options.client,\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 buildStart() {\n const [swaggerPlugin]: [Plugin<SwaggerPluginOptions>] = PluginManager.getDependedPlugins<SwaggerPluginOptions>(this.plugins, [pluginOasName])\n\n const oas = await swaggerPlugin.context.getOas()\n const root = path.resolve(this.config.root, this.config.output.path)\n const mode = getMode(path.resolve(root, output.path))\n\n const operationGenerator = new OperationGenerator(this.plugin.options, {\n oas,\n pluginManager: this.pluginManager,\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.addFile(...files)\n\n const barrelFiles = await getBarrelFiles(this.fileManager.files, {\n type: output.barrelType ?? 'named',\n root,\n output,\n meta: {\n pluginKey: this.plugin.key,\n },\n logger: this.logger,\n })\n\n await this.addFile(...barrelFiles)\n },\n }\n})\n"],"mappings":";;;;;;;;;;;;;;;;AAUA,MAAa,gBAAgB;AAE7B,MAAa,2CAAqC,YAAY;CAC5D,MAAM,EACJ,SAAS;EAAE,MAAM;EAAO,YAAY;EAAS,EAC7C,OACA,UAAU,EAAE,EACZ,SACA,WAAW,EAAE,EACb,eAAe,EAAE,EACjB,aAAa,CAACA,iCAAcC,mCAAgB,CAAC,OAAO,QAAQ,EAC5D,gBACE;AAEJ,QAAO;EACL,MAAM;EACN,SAAS;GACP;GACA;GACA,QAAQ;IACN,YAAY;IACZ,gBAAgB;IAChB,GAAG,QAAQ;IACZ;GACF;EACD,KAAK;GAACC;GAAeC;GAAcC;GAAc,CAAC,OAAO,QAAQ;EACjE,YAAY,UAAU,UAAU,WAAS;GACvC,MAAM,OAAOC,kBAAK,QAAQ,KAAK,OAAO,MAAM,KAAK,OAAO,OAAO,KAAK;AAGpE,QAFa,qCAAoBA,kBAAK,QAAQ,MAAM,OAAO,KAAK,CAAC,MAEpD;;;;;AAKX,UAAOA,kBAAK,QAAQ,MAAM,OAAO,KAAK;AAGxC,OAAI,UAAUC,WAAS,OAAO,QAAQA,WAAS,OAAO,MAAM;IAC1D,MAAMC,YAA2B,OAAO,OACpC,MAAM,QACL,QAAQ;AACP,SAAI,OAAO,SAAS,OAClB,QAAO,GAAG,IAAI,MAAM,MAAM,IAAI,CAAC;AAEjC,YAAO,2CAAa,IAAI,MAAM,CAAC;;AAGrC,WAAOF,kBAAK,QACV,MACA,OAAO,MACP,UAAU,EACR,OAAO,MAAM,SAAS,SAASC,UAAQ,MAAM,OAAQA,UAAQ,MAAM,KACpE,CAAC,EACF,SACD;;AAGH,UAAOD,kBAAK,QAAQ,MAAM,OAAO,MAAM,SAAS;;EAElD,YAAY,MAAM,MAAM;GACtB,MAAM,uDAAyB,MAAM,EACnC,QAAQ,SAAS,QAClB,CAAC;AAEF,OAAI,KACF,QAAO,cAAc,OAAO,cAAc,KAAK,IAAI;AAGrD,UAAO;;EAET,MAAM,aAAa;GACjB,MAAM,CAAC,iBAAiDG,0BAAc,mBAAyC,KAAK,SAAS,CAACN,gCAAc,CAAC;GAE7I,MAAM,MAAM,MAAM,cAAc,QAAQ,QAAQ;GAChD,MAAM,OAAOG,kBAAK,QAAQ,KAAK,OAAO,MAAM,KAAK,OAAO,OAAO,KAAK;GACpE,MAAM,gCAAeA,kBAAK,QAAQ,MAAM,OAAO,KAAK,CAAC;
|
|
1
|
+
{"version":3,"file":"index.cjs","names":["mcpGenerator","serverGenerator","pluginOasName","pluginTsName","pluginZodName","path","options","groupName: Group['name']","PluginManager","OperationGenerator"],"sources":["../src/plugin.ts"],"sourcesContent":["import path from 'node:path'\nimport { createPlugin, type Group, getBarrelFiles, getMode, type Plugin, PluginManager } from '@kubb/core'\nimport { camelCase } from '@kubb/core/transformers'\nimport type { PluginOas as SwaggerPluginOptions } from '@kubb/plugin-oas'\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 = createPlugin<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 } = options\n\n return {\n name: pluginMcpName,\n options: {\n output,\n group,\n client: {\n importPath: '@kubb/plugin-client/clients/axios',\n dataReturnType: 'data',\n ...options.client,\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 buildStart() {\n const [swaggerPlugin]: [Plugin<SwaggerPluginOptions>] = PluginManager.getDependedPlugins<SwaggerPluginOptions>(this.plugins, [pluginOasName])\n\n const oas = await swaggerPlugin.context.getOas()\n const root = path.resolve(this.config.root, this.config.output.path)\n const mode = getMode(path.resolve(root, output.path))\n\n const operationGenerator = new OperationGenerator(this.plugin.options, {\n fabric: this.fabric,\n oas,\n pluginManager: this.pluginManager,\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.addFile(...files)\n\n const barrelFiles = await getBarrelFiles(this.fileManager.files, {\n type: output.barrelType ?? 'named',\n root,\n output,\n meta: {\n pluginKey: this.plugin.key,\n },\n logger: this.logger,\n })\n\n await this.addFile(...barrelFiles)\n },\n }\n})\n"],"mappings":";;;;;;;;;;;;;;;;AAUA,MAAa,gBAAgB;AAE7B,MAAa,2CAAqC,YAAY;CAC5D,MAAM,EACJ,SAAS;EAAE,MAAM;EAAO,YAAY;EAAS,EAC7C,OACA,UAAU,EAAE,EACZ,SACA,WAAW,EAAE,EACb,eAAe,EAAE,EACjB,aAAa,CAACA,iCAAcC,mCAAgB,CAAC,OAAO,QAAQ,EAC5D,gBACE;AAEJ,QAAO;EACL,MAAM;EACN,SAAS;GACP;GACA;GACA,QAAQ;IACN,YAAY;IACZ,gBAAgB;IAChB,GAAG,QAAQ;IACZ;GACF;EACD,KAAK;GAACC;GAAeC;GAAcC;GAAc,CAAC,OAAO,QAAQ;EACjE,YAAY,UAAU,UAAU,WAAS;GACvC,MAAM,OAAOC,kBAAK,QAAQ,KAAK,OAAO,MAAM,KAAK,OAAO,OAAO,KAAK;AAGpE,QAFa,qCAAoBA,kBAAK,QAAQ,MAAM,OAAO,KAAK,CAAC,MAEpD;;;;;AAKX,UAAOA,kBAAK,QAAQ,MAAM,OAAO,KAAK;AAGxC,OAAI,UAAUC,WAAS,OAAO,QAAQA,WAAS,OAAO,MAAM;IAC1D,MAAMC,YAA2B,OAAO,OACpC,MAAM,QACL,QAAQ;AACP,SAAI,OAAO,SAAS,OAClB,QAAO,GAAG,IAAI,MAAM,MAAM,IAAI,CAAC;AAEjC,YAAO,2CAAa,IAAI,MAAM,CAAC;;AAGrC,WAAOF,kBAAK,QACV,MACA,OAAO,MACP,UAAU,EACR,OAAO,MAAM,SAAS,SAASC,UAAQ,MAAM,OAAQA,UAAQ,MAAM,KACpE,CAAC,EACF,SACD;;AAGH,UAAOD,kBAAK,QAAQ,MAAM,OAAO,MAAM,SAAS;;EAElD,YAAY,MAAM,MAAM;GACtB,MAAM,uDAAyB,MAAM,EACnC,QAAQ,SAAS,QAClB,CAAC;AAEF,OAAI,KACF,QAAO,cAAc,OAAO,cAAc,KAAK,IAAI;AAGrD,UAAO;;EAET,MAAM,aAAa;GACjB,MAAM,CAAC,iBAAiDG,0BAAc,mBAAyC,KAAK,SAAS,CAACN,gCAAc,CAAC;GAE7I,MAAM,MAAM,MAAM,cAAc,QAAQ,QAAQ;GAChD,MAAM,OAAOG,kBAAK,QAAQ,KAAK,OAAO,MAAM,KAAK,OAAO,OAAO,KAAK;GACpE,MAAM,gCAAeA,kBAAK,QAAQ,MAAM,OAAO,KAAK,CAAC;GAcrD,MAAM,QAAQ,MAZa,IAAII,qCAAmB,KAAK,OAAO,SAAS;IACrE,QAAQ,KAAK;IACb;IACA,eAAe,KAAK;IACpB,QAAQ,KAAK;IACb;IACA;IACA;IACA;IACA;IACD,CAAC,CAEqC,MAAM,GAAG,WAAW;AAC3D,SAAM,KAAK,QAAQ,GAAG,MAAM;GAE5B,MAAM,cAAc,sCAAqB,KAAK,YAAY,OAAO;IAC/D,MAAM,OAAO,cAAc;IAC3B;IACA;IACA,MAAM,EACJ,WAAW,KAAK,OAAO,KACxB;IACD,QAAQ,KAAK;IACd,CAAC;AAEF,SAAM,KAAK,QAAQ,GAAG,YAAY;;EAErC;EACD"}
|
package/dist/index.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { n as PluginMcp, t as Options } from "./types-
|
|
1
|
+
import { m as UserPluginWithLifeCycle } from "./SchemaGenerator-C1vgcKII.cjs";
|
|
2
|
+
import { n as PluginMcp, t as Options } from "./types-3zb5y21F.cjs";
|
|
3
3
|
|
|
4
4
|
//#region src/plugin.d.ts
|
|
5
5
|
declare const pluginMcpName = "plugin-mcp";
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { n as PluginMcp, t as Options } from "./types-
|
|
1
|
+
import { m as UserPluginWithLifeCycle } from "./SchemaGenerator-wXj7HtlS.js";
|
|
2
|
+
import { n as PluginMcp, t as Options } from "./types-b6nPxXzv.js";
|
|
3
3
|
|
|
4
4
|
//#region src/plugin.d.ts
|
|
5
5
|
declare const pluginMcpName = "plugin-mcp";
|
package/dist/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { n as mcpGenerator, t as serverGenerator } from "./generators-
|
|
2
|
-
import "./Server-
|
|
1
|
+
import { n as mcpGenerator, t as serverGenerator } from "./generators-Bp0d1HbP.js";
|
|
2
|
+
import "./Server-DMDo69md.js";
|
|
3
3
|
import path from "node:path";
|
|
4
4
|
import { PluginManager, createPlugin, getBarrelFiles, getMode } from "@kubb/core";
|
|
5
5
|
import { camelCase } from "@kubb/core/transformers";
|
|
@@ -58,6 +58,7 @@ const pluginMcp = createPlugin((options) => {
|
|
|
58
58
|
const root = path.resolve(this.config.root, this.config.output.path);
|
|
59
59
|
const mode = getMode(path.resolve(root, output.path));
|
|
60
60
|
const files = await new OperationGenerator(this.plugin.options, {
|
|
61
|
+
fabric: this.fabric,
|
|
61
62
|
oas,
|
|
62
63
|
pluginManager: this.pluginManager,
|
|
63
64
|
plugin: this.plugin,
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["options","groupName: Group['name']"],"sources":["../src/plugin.ts"],"sourcesContent":["import path from 'node:path'\nimport { createPlugin, type Group, getBarrelFiles, getMode, type Plugin, PluginManager } from '@kubb/core'\nimport { camelCase } from '@kubb/core/transformers'\nimport type { PluginOas as SwaggerPluginOptions } from '@kubb/plugin-oas'\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 = createPlugin<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 } = options\n\n return {\n name: pluginMcpName,\n options: {\n output,\n group,\n client: {\n importPath: '@kubb/plugin-client/clients/axios',\n dataReturnType: 'data',\n ...options.client,\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 buildStart() {\n const [swaggerPlugin]: [Plugin<SwaggerPluginOptions>] = PluginManager.getDependedPlugins<SwaggerPluginOptions>(this.plugins, [pluginOasName])\n\n const oas = await swaggerPlugin.context.getOas()\n const root = path.resolve(this.config.root, this.config.output.path)\n const mode = getMode(path.resolve(root, output.path))\n\n const operationGenerator = new OperationGenerator(this.plugin.options, {\n oas,\n pluginManager: this.pluginManager,\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.addFile(...files)\n\n const barrelFiles = await getBarrelFiles(this.fileManager.files, {\n type: output.barrelType ?? 'named',\n root,\n output,\n meta: {\n pluginKey: this.plugin.key,\n },\n logger: this.logger,\n })\n\n await this.addFile(...barrelFiles)\n },\n }\n})\n"],"mappings":";;;;;;;;;;AAUA,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,gBACE;AAEJ,QAAO;EACL,MAAM;EACN,SAAS;GACP;GACA;GACA,QAAQ;IACN,YAAY;IACZ,gBAAgB;IAChB,GAAG,QAAQ;IACZ;GACF;EACD,KAAK;GAAC;GAAe;GAAc;GAAc,CAAC,OAAO,QAAQ;EACjE,YAAY,UAAU,UAAU,WAAS;GACvC,MAAM,OAAO,KAAK,QAAQ,KAAK,OAAO,MAAM,KAAK,OAAO,OAAO,KAAK;AAGpE,QAFa,YAAY,QAAQ,KAAK,QAAQ,MAAM,OAAO,KAAK,CAAC,MAEpD;;;;;AAKX,UAAO,KAAK,QAAQ,MAAM,OAAO,KAAK;AAGxC,OAAI,UAAUA,WAAS,OAAO,QAAQA,WAAS,OAAO,MAAM;IAC1D,MAAMC,YAA2B,OAAO,OACpC,MAAM,QACL,QAAQ;AACP,SAAI,OAAO,SAAS,OAClB,QAAO,GAAG,IAAI,MAAM,MAAM,IAAI,CAAC;AAEjC,YAAO,GAAG,UAAU,IAAI,MAAM,CAAC;;AAGrC,WAAO,KAAK,QACV,MACA,OAAO,MACP,UAAU,EACR,OAAO,MAAM,SAAS,SAASD,UAAQ,MAAM,OAAQA,UAAQ,MAAM,KACpE,CAAC,EACF,SACD;;AAGH,UAAO,KAAK,QAAQ,MAAM,OAAO,MAAM,SAAS;;EAElD,YAAY,MAAM,MAAM;GACtB,MAAM,eAAe,UAAU,MAAM,EACnC,QAAQ,SAAS,QAClB,CAAC;AAEF,OAAI,KACF,QAAO,cAAc,OAAO,cAAc,KAAK,IAAI;AAGrD,UAAO;;EAET,MAAM,aAAa;GACjB,MAAM,CAAC,iBAAiD,cAAc,mBAAyC,KAAK,SAAS,CAAC,cAAc,CAAC;GAE7I,MAAM,MAAM,MAAM,cAAc,QAAQ,QAAQ;GAChD,MAAM,OAAO,KAAK,QAAQ,KAAK,OAAO,MAAM,KAAK,OAAO,OAAO,KAAK;GACpE,MAAM,OAAO,QAAQ,KAAK,QAAQ,MAAM,OAAO,KAAK,CAAC;
|
|
1
|
+
{"version":3,"file":"index.js","names":["options","groupName: Group['name']"],"sources":["../src/plugin.ts"],"sourcesContent":["import path from 'node:path'\nimport { createPlugin, type Group, getBarrelFiles, getMode, type Plugin, PluginManager } from '@kubb/core'\nimport { camelCase } from '@kubb/core/transformers'\nimport type { PluginOas as SwaggerPluginOptions } from '@kubb/plugin-oas'\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 = createPlugin<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 } = options\n\n return {\n name: pluginMcpName,\n options: {\n output,\n group,\n client: {\n importPath: '@kubb/plugin-client/clients/axios',\n dataReturnType: 'data',\n ...options.client,\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 buildStart() {\n const [swaggerPlugin]: [Plugin<SwaggerPluginOptions>] = PluginManager.getDependedPlugins<SwaggerPluginOptions>(this.plugins, [pluginOasName])\n\n const oas = await swaggerPlugin.context.getOas()\n const root = path.resolve(this.config.root, this.config.output.path)\n const mode = getMode(path.resolve(root, output.path))\n\n const operationGenerator = new OperationGenerator(this.plugin.options, {\n fabric: this.fabric,\n oas,\n pluginManager: this.pluginManager,\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.addFile(...files)\n\n const barrelFiles = await getBarrelFiles(this.fileManager.files, {\n type: output.barrelType ?? 'named',\n root,\n output,\n meta: {\n pluginKey: this.plugin.key,\n },\n logger: this.logger,\n })\n\n await this.addFile(...barrelFiles)\n },\n }\n})\n"],"mappings":";;;;;;;;;;AAUA,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,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GACpE,MAAM,OAAO,QAAQ,KAAK,QAAQ,MAAM,OAAO,KAAK,CAAC;GAcrD,MAAM,QAAQ,MAZa,IAAI,mBAAmB,KAAK,OAAO,SAAS;IACrE,QAAQ,KAAK;IACb;IACA,eAAe,KAAK;IACpB,QAAQ,KAAK;IACb;IACA;IACA;IACA;IACA;IACD,CAAC,CAEqC,MAAM,GAAG,WAAW;AAC3D,SAAM,KAAK,QAAQ,GAAG,MAAM;GAE5B,MAAM,cAAc,MAAM,eAAe,KAAK,YAAY,OAAO;IAC/D,MAAM,OAAO,cAAc;IAC3B;IACA;IACA,MAAM,EACJ,WAAW,KAAK,OAAO,KACxB;IACD,QAAQ,KAAK;IACd,CAAC;AAEF,SAAM,KAAK,QAAQ,GAAG,YAAY;;EAErC;EACD"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as
|
|
1
|
+
import { a as ResolvePathOptions, c as Oas, d as Output, f as PluginFactoryOptions, i as Override, l as contentType, n as Include, o as Generator, p as ResolveNameParams, t as Exclude, u as Group } from "./SchemaGenerator-C1vgcKII.cjs";
|
|
2
2
|
|
|
3
3
|
//#region ../plugin-client/src/types.d.ts
|
|
4
4
|
type Options$1 = {
|
|
@@ -165,4 +165,4 @@ type ResolvedOptions = {
|
|
|
165
165
|
type PluginMcp = PluginFactoryOptions<'plugin-mcp', Options, ResolvedOptions, never, ResolvePathOptions>;
|
|
166
166
|
//#endregion
|
|
167
167
|
export { PluginMcp as n, Options as t };
|
|
168
|
-
//# sourceMappingURL=types-
|
|
168
|
+
//# sourceMappingURL=types-3zb5y21F.d.cts.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as
|
|
1
|
+
import { a as ResolvePathOptions, c as Oas, d as Output, f as PluginFactoryOptions, i as Override, l as contentType, n as Include, o as Generator, p as ResolveNameParams, t as Exclude, u as Group } from "./SchemaGenerator-wXj7HtlS.js";
|
|
2
2
|
|
|
3
3
|
//#region ../plugin-client/src/types.d.ts
|
|
4
4
|
type Options$1 = {
|
|
@@ -165,4 +165,4 @@ type ResolvedOptions = {
|
|
|
165
165
|
type PluginMcp = PluginFactoryOptions<'plugin-mcp', Options, ResolvedOptions, never, ResolvePathOptions>;
|
|
166
166
|
//#endregion
|
|
167
167
|
export { PluginMcp as n, Options as t };
|
|
168
|
-
//# sourceMappingURL=types-
|
|
168
|
+
//# sourceMappingURL=types-b6nPxXzv.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.4.0",
|
|
4
4
|
"description": "Generator mcp",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"typescript",
|
|
@@ -62,20 +62,20 @@
|
|
|
62
62
|
"!/**/__tests__/**"
|
|
63
63
|
],
|
|
64
64
|
"dependencies": {
|
|
65
|
-
"@kubb/
|
|
66
|
-
"@kubb/
|
|
67
|
-
"@kubb/
|
|
68
|
-
"@kubb/plugin-
|
|
69
|
-
"@kubb/plugin-
|
|
70
|
-
"@kubb/plugin-
|
|
71
|
-
"@kubb/
|
|
65
|
+
"@kubb/react-fabric": "0.2.8",
|
|
66
|
+
"@kubb/core": "4.4.0",
|
|
67
|
+
"@kubb/oas": "4.4.0",
|
|
68
|
+
"@kubb/plugin-client": "4.4.0",
|
|
69
|
+
"@kubb/plugin-oas": "4.4.0",
|
|
70
|
+
"@kubb/plugin-ts": "4.4.0",
|
|
71
|
+
"@kubb/plugin-zod": "4.4.0"
|
|
72
72
|
},
|
|
73
73
|
"devDependencies": {
|
|
74
|
-
"tsdown": "^0.15.
|
|
74
|
+
"tsdown": "^0.15.11",
|
|
75
75
|
"typescript": "^5.9.3"
|
|
76
76
|
},
|
|
77
77
|
"peerDependencies": {
|
|
78
|
-
"@kubb/react": "
|
|
78
|
+
"@kubb/react-fabric": "0.2.8"
|
|
79
79
|
},
|
|
80
80
|
"engines": {
|
|
81
81
|
"node": ">=20"
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { KubbFile } from '@kubb/core/fs'
|
|
2
|
+
import type { KubbNode } from '@kubb/react-fabric/types'
|
|
2
3
|
|
|
3
|
-
import { Const, File, FunctionParams } from '@kubb/react'
|
|
4
|
+
import { Const, File, FunctionParams } from '@kubb/react-fabric'
|
|
4
5
|
import type { OperationSchemas } from '@kubb/plugin-oas'
|
|
5
6
|
import { getPathParams, isOptional } from '@kubb/plugin-oas/utils'
|
|
6
7
|
import { isNullable, isReference } from '@kubb/oas'
|
|
@@ -90,7 +91,7 @@ function getParams({ schemas }: GetParamsProps) {
|
|
|
90
91
|
})
|
|
91
92
|
}
|
|
92
93
|
|
|
93
|
-
export function Server({ name, serverName, serverVersion, operations }: Props) {
|
|
94
|
+
export function Server({ name, serverName, serverVersion, operations }: Props): KubbNode {
|
|
94
95
|
return (
|
|
95
96
|
<File.Source name={name} isExportable isIndexable>
|
|
96
97
|
<Const name={'server'} export>
|
|
@@ -4,7 +4,7 @@ import { createReactGenerator } from '@kubb/plugin-oas'
|
|
|
4
4
|
import { useOas, useOperationManager } from '@kubb/plugin-oas/hooks'
|
|
5
5
|
import { getBanner, getFooter } from '@kubb/plugin-oas/utils'
|
|
6
6
|
import { pluginTsName } from '@kubb/plugin-ts'
|
|
7
|
-
import { File } from '@kubb/react'
|
|
7
|
+
import { File } from '@kubb/react-fabric'
|
|
8
8
|
import type { PluginMcp } from '../types'
|
|
9
9
|
|
|
10
10
|
export const mcpGenerator = createReactGenerator<PluginMcp>({
|