@orval/mcp 8.7.0 → 8.8.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/index.mjs +40 -28
- package/dist/index.mjs.map +1 -1
- package/package.json +5 -5
package/dist/index.mjs
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import path from "node:path";
|
|
2
|
-
import { camel, generateMutatorImports, getFileInfo, getFullRoute, isObject, isString, jsDoc, jsStringEscape, pascal, upath } from "@orval/core";
|
|
2
|
+
import { camel, generateMutatorImports, getFileInfo, getFullRoute, getParamsInPath, isObject, isString, jsDoc, jsStringEscape, pascal, upath } from "@orval/core";
|
|
3
3
|
import { generateClient, generateFetchHeader } from "@orval/fetch";
|
|
4
4
|
import { generateZod } from "@orval/zod";
|
|
5
|
-
|
|
6
5
|
//#region src/index.ts
|
|
7
6
|
const getHeader = (option, info) => {
|
|
8
7
|
if (!option) return "";
|
|
@@ -32,8 +31,9 @@ const getMcpHeader = ({ verbOptions, output }) => {
|
|
|
32
31
|
};
|
|
33
32
|
const generateMcp = (verbOptions) => {
|
|
34
33
|
const handlerArgsTypes = [];
|
|
35
|
-
const
|
|
36
|
-
|
|
34
|
+
const originalParamNames = getParamsInPath(verbOptions.pathRoute);
|
|
35
|
+
const pathParamsType = verbOptions.params.map((param, index) => {
|
|
36
|
+
return ` ${originalParamNames[index]}: ${param.implementation.split(": ")[1]}`;
|
|
37
37
|
}).join(",\n");
|
|
38
38
|
if (pathParamsType) handlerArgsTypes.push(` pathParams: {\n${pathParamsType}\n };`);
|
|
39
39
|
if (verbOptions.queryParams) handlerArgsTypes.push(` queryParams: ${verbOptions.queryParams.schema.name};`);
|
|
@@ -46,16 +46,14 @@ ${handlerArgsTypes.join("\n")}
|
|
|
46
46
|
` : "";
|
|
47
47
|
const fetchParams = [];
|
|
48
48
|
if (verbOptions.params.length > 0) {
|
|
49
|
-
const pathParamsArgs =
|
|
50
|
-
return `args.pathParams.${param.name.split(": ")[0]}`;
|
|
51
|
-
}).join(", ");
|
|
49
|
+
const pathParamsArgs = originalParamNames.map((paramName) => `args.pathParams.${paramName}`).join(", ");
|
|
52
50
|
fetchParams.push(pathParamsArgs);
|
|
53
51
|
}
|
|
54
52
|
if (verbOptions.body.definition) fetchParams.push(`args.bodyParams`);
|
|
55
53
|
if (verbOptions.queryParams) fetchParams.push(`args.queryParams`);
|
|
56
54
|
const handlersImplementation = [handlerArgsImplementation, `
|
|
57
|
-
export const ${`${verbOptions.operationName}Handler`} = async (${handlerArgsTypes.length > 0 ? `args: ${handlerArgsName}` : ""}) => {
|
|
58
|
-
const res = await ${verbOptions.operationName}(${fetchParams.join(", ")});
|
|
55
|
+
export const ${`${verbOptions.operationName}Handler`} = async (${handlerArgsTypes.length > 0 ? `args: ${handlerArgsName}, ` : ""}options?: RequestInit) => {
|
|
56
|
+
const res = await ${verbOptions.operationName}(${fetchParams.length > 0 ? `${fetchParams.join(", ")}, ` : ""}options);
|
|
59
57
|
|
|
60
58
|
return {
|
|
61
59
|
content: [
|
|
@@ -76,6 +74,7 @@ const generateServer = (verbOptions, output, context) => {
|
|
|
76
74
|
const { extension, dirname } = getFileInfo(output.target);
|
|
77
75
|
const serverPath = path.join(dirname, `server${extension}`);
|
|
78
76
|
const header = getHeader(output.override.header, info);
|
|
77
|
+
const mcpServerOptions = output.override.mcp.server;
|
|
79
78
|
const toolImplementations = Object.values(verbOptions).map((verbOption) => {
|
|
80
79
|
const pascalOperationName = pascal(verbOption.operationName);
|
|
81
80
|
const inputSchemaTypes = [];
|
|
@@ -85,11 +84,12 @@ const generateServer = (verbOptions, output, context) => {
|
|
|
85
84
|
const inputSchemaImplementation = inputSchemaTypes.length > 0 ? ` {
|
|
86
85
|
${inputSchemaTypes.join(",\n ")}
|
|
87
86
|
},` : "";
|
|
87
|
+
const handlerCallImplementation = inputSchemaImplementation ? `(args) => ${verbOption.operationName}Handler(args, options)` : `() => ${verbOption.operationName}Handler(options)`;
|
|
88
88
|
return `
|
|
89
89
|
server.tool(
|
|
90
90
|
'${jsStringEscape(verbOption.operationName)}',
|
|
91
91
|
'${jsStringEscape(verbOption.summary ?? "")}',${inputSchemaImplementation ? `\n${inputSchemaImplementation}` : ""}
|
|
92
|
-
${
|
|
92
|
+
${handlerCallImplementation}
|
|
93
93
|
);`;
|
|
94
94
|
}).join("\n");
|
|
95
95
|
const importToolSchemasImplementation = `import {\n${Object.values(verbOptions).flatMap((verbOption) => {
|
|
@@ -101,27 +101,39 @@ server.tool(
|
|
|
101
101
|
if (verbOption.body.definition) imports.push(` ${pascalOperationName}Body`);
|
|
102
102
|
return imports;
|
|
103
103
|
}).join(",\n")}\n} from './tool-schemas.zod';`;
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
104
|
+
const importHandlersImplementation = `import {\n${Object.values(verbOptions).filter((verbOption) => toolImplementations.includes(`${verbOption.operationName}Handler`)).map((verbOption) => ` ${verbOption.operationName}Handler`).join(`,\n`)}\n} from './handlers';`;
|
|
105
|
+
const createMcpServerImplementation = `
|
|
106
|
+
const createMcpServer = (options?: RequestInit) => {
|
|
107
|
+
const server = new McpServer({
|
|
108
|
+
name: '${camel(info.title)}Server',
|
|
109
|
+
version: '1.0.0',
|
|
110
|
+
});
|
|
111
|
+
${toolImplementations}
|
|
112
|
+
|
|
113
|
+
return server;
|
|
114
|
+
};
|
|
115
|
+
`;
|
|
116
|
+
const serverFunctionName = mcpServerOptions?.name ?? "customServer";
|
|
117
|
+
const relativeServerPath = mcpServerOptions ? upath.getRelativeImportPath(serverPath, mcpServerOptions.path) : "";
|
|
118
|
+
const importSpecifier = mcpServerOptions?.default ? serverFunctionName : `{ ${serverFunctionName} }`;
|
|
119
|
+
const importDependenciesImplementation = `import {
|
|
108
120
|
McpServer
|
|
109
121
|
} from '@modelcontextprotocol/sdk/server/mcp.js';
|
|
110
|
-
|
|
111
|
-
import {
|
|
122
|
+
|
|
123
|
+
${mcpServerOptions ? `import ${importSpecifier} from '${relativeServerPath}';` : `import {
|
|
112
124
|
StdioServerTransport
|
|
113
|
-
} from '@modelcontextprotocol/sdk/server/stdio.js'
|
|
114
|
-
|
|
115
|
-
|
|
125
|
+
} from '@modelcontextprotocol/sdk/server/stdio.js';`}
|
|
126
|
+
`;
|
|
127
|
+
const customServerConnectImplementation = `\n${serverFunctionName}(createMcpServer);\n`;
|
|
128
|
+
return [{
|
|
129
|
+
content: [
|
|
130
|
+
header,
|
|
131
|
+
importDependenciesImplementation,
|
|
132
|
+
importHandlersImplementation,
|
|
116
133
|
importToolSchemasImplementation,
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
version: '1.0.0',
|
|
121
|
-
});
|
|
122
|
-
`,
|
|
123
|
-
toolImplementations,
|
|
124
|
-
`
|
|
134
|
+
createMcpServerImplementation,
|
|
135
|
+
mcpServerOptions ? customServerConnectImplementation : `
|
|
136
|
+
const server = createMcpServer();
|
|
125
137
|
const transport = new StdioServerTransport();
|
|
126
138
|
|
|
127
139
|
server.connect(transport).then(() => {
|
|
@@ -206,7 +218,7 @@ const mcpClientBuilder = {
|
|
|
206
218
|
extraFiles: generateExtraFiles
|
|
207
219
|
};
|
|
208
220
|
const builder = () => () => mcpClientBuilder;
|
|
209
|
-
|
|
210
221
|
//#endregion
|
|
211
222
|
export { builder, builder as default, generateExtraFiles, generateMcp, generateServer, getMcpHeader };
|
|
223
|
+
|
|
212
224
|
//# sourceMappingURL=index.mjs.map
|
package/dist/index.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.mjs","names":[],"sources":["../src/index.ts"],"sourcesContent":["import path from 'node:path';\n\nimport {\n camel,\n type ClientBuilder,\n type ClientExtraFilesBuilder,\n type ClientGeneratorsBuilder,\n type ClientHeaderBuilder,\n type ContextSpec,\n generateMutatorImports,\n type GeneratorVerbOptions,\n getFileInfo,\n getFullRoute,\n isObject,\n isString,\n jsDoc,\n jsStringEscape,\n type NormalizedOutputOptions,\n type OpenApiInfoObject,\n pascal,\n upath,\n} from '@orval/core';\nimport { generateClient, generateFetchHeader } from '@orval/fetch';\nimport { generateZod } from '@orval/zod';\n\nconst getHeader = (\n option: false | ((info: OpenApiInfoObject) => string | string[]),\n info: OpenApiInfoObject,\n): string => {\n if (!option) {\n return '';\n }\n\n const header = option(info);\n\n return Array.isArray(header) ? jsDoc({ description: header }) : header;\n};\n\nconst getSpecInfo = (context: ContextSpec): OpenApiInfoObject =>\n context.spec.info ?? {\n title: 'API',\n version: '1.0.0',\n };\n\nexport const getMcpHeader: ClientHeaderBuilder = ({ verbOptions, output }) => {\n const targetInfo = getFileInfo(output.target);\n const schemasPath = (\n isObject(output.schemas)\n ? output.schemas.path\n : isString(output.schemas)\n ? output.schemas\n : undefined\n ) as string | undefined;\n const schemaInfo = schemasPath ? getFileInfo(schemasPath) : undefined;\n\n const isZodSchemaOutput =\n isObject(output.schemas) && output.schemas.type === 'zod';\n const basePath = schemaInfo?.dirname;\n const relativeSchemaImportPath = basePath\n ? isZodSchemaOutput && output.indexFiles\n ? upath.getRelativeImportPath(targetInfo.path, basePath, true)\n : upath.getRelativeImportPath(targetInfo.path, basePath)\n : './' + targetInfo.filename + '.schemas';\n\n const importSchemaNames = new Set(\n Object.values(verbOptions).flatMap((verbOption) => {\n const imports = [];\n const pascalOperationName = pascal(verbOption.operationName);\n\n if (verbOption.queryParams) {\n imports.push(`${pascalOperationName}Params`);\n }\n\n if (verbOption.body.imports[0]?.name) {\n imports.push(verbOption.body.imports[0]?.name);\n }\n\n return imports;\n }),\n )\n .values()\n .toArray();\n\n const importSchemasImplementation = `import {\\n ${importSchemaNames.join(\n ',\\n ',\n )}\\n} from '${relativeSchemaImportPath}';\n`;\n\n const relativeFetchClientPath = './http-client';\n const importFetchClientNames = new Set(\n Object.values(verbOptions).flatMap(\n (verbOption) => verbOption.operationName,\n ),\n )\n .values()\n .toArray();\n\n const importFetchClientImplementation = `import {\\n ${importFetchClientNames.join(\n ',\\n ',\n )}\\n} from '${relativeFetchClientPath}';\n `;\n\n const content = [\n importSchemasImplementation,\n importFetchClientImplementation,\n ].join('\\n');\n\n return content + '\\n';\n};\n\nexport const generateMcp: ClientBuilder = (verbOptions) => {\n const handlerArgsTypes = [];\n const pathParamsType = verbOptions.params\n .map((param) => {\n const paramName = param.name.split(': ')[0];\n const paramType = param.implementation.split(': ')[1];\n return ` ${paramName}: ${paramType}`;\n })\n .join(',\\n');\n if (pathParamsType) {\n handlerArgsTypes.push(` pathParams: {\\n${pathParamsType}\\n };`);\n }\n if (verbOptions.queryParams) {\n handlerArgsTypes.push(\n ` queryParams: ${verbOptions.queryParams.schema.name};`,\n );\n }\n if (verbOptions.body.definition) {\n handlerArgsTypes.push(` bodyParams: ${verbOptions.body.definition};`);\n }\n\n const handlerArgsName = `${verbOptions.operationName}Args`;\n const handlerArgsImplementation =\n handlerArgsTypes.length > 0\n ? `\nexport type ${handlerArgsName} = {\n${handlerArgsTypes.join('\\n')}\n}\n`\n : '';\n\n const fetchParams = [];\n if (verbOptions.params.length > 0) {\n const pathParamsArgs = verbOptions.params\n .map((param) => {\n const paramName = param.name.split(': ')[0];\n\n return `args.pathParams.${paramName}`;\n })\n .join(', ');\n\n fetchParams.push(pathParamsArgs);\n }\n if (verbOptions.body.definition) fetchParams.push(`args.bodyParams`);\n if (verbOptions.queryParams) fetchParams.push(`args.queryParams`);\n\n const handlerName = `${verbOptions.operationName}Handler`;\n const handlerImplementation = `\nexport const ${handlerName} = async (${handlerArgsTypes.length > 0 ? `args: ${handlerArgsName}` : ''}) => {\n const res = await ${verbOptions.operationName}(${fetchParams.join(', ')});\n\n return {\n content: [\n {\n type: 'text' as const,\n text: JSON.stringify(res),\n },\n ],\n };\n};`;\n\n const handlersImplementation = [\n handlerArgsImplementation,\n handlerImplementation,\n ].join('');\n\n return {\n implementation: handlersImplementation ? `${handlersImplementation}\\n` : '',\n imports: [],\n };\n};\n\nexport const generateServer = (\n verbOptions: Record<string, GeneratorVerbOptions>,\n output: NormalizedOutputOptions,\n context: ContextSpec,\n) => {\n const info = getSpecInfo(context);\n const { extension, dirname } = getFileInfo(output.target);\n const serverPath = path.join(dirname, `server${extension}`);\n const header = getHeader(output.override.header, info);\n\n const toolImplementations = Object.values(verbOptions)\n .map((verbOption) => {\n const pascalOperationName = pascal(verbOption.operationName);\n const inputSchemaTypes = [];\n if (verbOption.params.length > 0)\n inputSchemaTypes.push(` pathParams: ${pascalOperationName}Params`);\n if (verbOption.queryParams)\n inputSchemaTypes.push(\n ` queryParams: ${pascalOperationName}QueryParams`,\n );\n if (verbOption.body.definition)\n inputSchemaTypes.push(` bodyParams: ${pascalOperationName}Body`);\n\n const inputSchemaImplementation =\n inputSchemaTypes.length > 0\n ? ` {\n ${inputSchemaTypes.join(',\\n ')}\n },`\n : '';\n\n const toolImplementation = `\nserver.tool(\n '${jsStringEscape(verbOption.operationName)}',\n '${jsStringEscape(verbOption.summary ?? '')}',${inputSchemaImplementation ? `\\n${inputSchemaImplementation}` : ''}\n ${jsStringEscape(verbOption.operationName)}Handler\n);`;\n\n return toolImplementation;\n })\n .join('\\n');\n\n const importToolSchemas = Object.values(verbOptions)\n .flatMap((verbOption) => {\n const imports = [];\n\n const pascalOperationName = pascal(verbOption.operationName);\n\n if (verbOption.headers) imports.push(` ${pascalOperationName}Header`);\n if (verbOption.params.length > 0)\n imports.push(` ${pascalOperationName}Params`);\n if (verbOption.queryParams)\n imports.push(` ${pascalOperationName}QueryParams`);\n if (verbOption.body.definition)\n imports.push(` ${pascalOperationName}Body`);\n\n return imports;\n })\n .join(',\\n');\n const importToolSchemasImplementation = `import {\\n${importToolSchemas}\\n} from './tool-schemas.zod';`;\n\n const importHandlers = Object.values(verbOptions)\n .filter((verbOption) =>\n toolImplementations.includes(`${verbOption.operationName}Handler`),\n )\n .map((verbOption) => ` ${verbOption.operationName}Handler`)\n .join(`,\\n`);\n const importHandlersImplementation = `import {\\n${importHandlers}\\n} from './handlers';`;\n\n const importDependenciesImplementation = `import {\n McpServer\n} from '@modelcontextprotocol/sdk/server/mcp.js';\n \nimport {\n StdioServerTransport\n} from '@modelcontextprotocol/sdk/server/stdio.js'; \n`;\n const newMcpServerImplementation = `\nconst server = new McpServer({\n name: '${camel(info.title)}Server',\n version: '1.0.0',\n});\n`;\n const serverConnectImplementation = `\nconst transport = new StdioServerTransport();\n\nserver.connect(transport).then(() => {\n console.error('MCP server running on stdio');\n}).catch(console.error);\n`;\n\n const content = [\n header,\n importDependenciesImplementation,\n importHandlersImplementation,\n importToolSchemasImplementation,\n newMcpServerImplementation,\n toolImplementations,\n serverConnectImplementation,\n ].join('\\n');\n\n return [\n {\n content,\n path: serverPath,\n },\n ];\n};\n\nconst generateZodFiles = async (\n verbOptions: Record<string, GeneratorVerbOptions>,\n output: NormalizedOutputOptions,\n context: ContextSpec,\n) => {\n const { extension, dirname } = getFileInfo(output.target);\n\n const header = getHeader(output.override.header, getSpecInfo(context));\n\n const zods = await Promise.all(\n Object.values(verbOptions).map(async (verbOption) =>\n generateZod(\n verbOption,\n {\n route: verbOption.route,\n pathRoute: verbOption.pathRoute,\n override: output.override,\n context,\n mock: output.mock,\n output: output.target,\n },\n output.client,\n ),\n ),\n );\n\n const allMutators = new Map(\n zods.flatMap((z) => z.mutators ?? []).map((m) => [m.name, m]),\n )\n .values()\n .toArray();\n\n const mutatorsImports = generateMutatorImports({\n mutators: allMutators,\n });\n\n let content = `${header}import { z as zod } from 'zod';\\n${mutatorsImports}\\n`;\n\n const zodPath = path.join(dirname, `tool-schemas.zod${extension}`);\n\n content += zods.map((zod) => zod.implementation).join('\\n');\n\n return [\n {\n content,\n path: zodPath,\n },\n ];\n};\n\nconst generateHttpClientFiles = async (\n verbOptions: Record<string, GeneratorVerbOptions>,\n output: NormalizedOutputOptions,\n context: ContextSpec,\n) => {\n const {\n path: targetPath,\n extension,\n dirname,\n filename,\n } = getFileInfo(output.target);\n\n const header = getHeader(output.override.header, getSpecInfo(context));\n\n const clients = await Promise.all(\n Object.values(verbOptions).map(async (verbOption) => {\n const fullRoute = getFullRoute(\n verbOption.route,\n context.spec.servers,\n output.baseUrl,\n );\n\n const options = {\n route: fullRoute,\n pathRoute: verbOption.pathRoute,\n override: output.override,\n context,\n mock: output.mock,\n output: output.target,\n };\n\n return generateClient(verbOption, options, output.client, output);\n }),\n );\n\n const clientImplementation = clients\n .map((client) => client.implementation)\n .join('\\n');\n\n const isZodSchemaOutput =\n isObject(output.schemas) && output.schemas.type === 'zod';\n const schemasPath = (\n isObject(output.schemas)\n ? output.schemas.path\n : isString(output.schemas)\n ? output.schemas\n : undefined\n ) as string | undefined;\n const basePath = schemasPath ? getFileInfo(schemasPath).dirname : undefined;\n const relativeSchemasPath = basePath\n ? isZodSchemaOutput && output.indexFiles\n ? upath.getRelativeImportPath(targetPath, basePath, true)\n : upath.getRelativeImportPath(targetPath, basePath)\n : './' + filename + '.schemas';\n\n const importNames = clients\n .flatMap((client) => client.imports)\n .map((imp) => imp.name);\n const uniqueImportNames = new Set(importNames).values().toArray();\n\n const importImplementation = `import { ${uniqueImportNames.join(\n ',\\n',\n )} } from '${relativeSchemasPath}';`;\n\n const fetchHeader = generateFetchHeader({\n title: '',\n isRequestOptions: false,\n isMutator: false,\n noFunction: false,\n isGlobalMutator: false,\n provideIn: false,\n hasAwaitedType: false,\n output,\n verbOptions,\n clientImplementation,\n });\n\n const content = [\n header,\n importImplementation,\n fetchHeader,\n clientImplementation,\n ].join('\\n');\n const outputPath = path.join(dirname, `http-client${extension}`);\n\n return [\n {\n content,\n path: outputPath,\n },\n ];\n};\n\nexport const generateExtraFiles: ClientExtraFilesBuilder = async (\n verbOptions,\n output,\n context,\n) => {\n const server = generateServer(verbOptions, output, context);\n const [zods, httpClients] = await Promise.all([\n generateZodFiles(verbOptions, output, context),\n generateHttpClientFiles(verbOptions, output, context),\n ]);\n\n return [...server, ...zods, ...httpClients];\n};\n\nconst mcpClientBuilder: ClientGeneratorsBuilder = {\n client: generateMcp,\n header: getMcpHeader,\n extraFiles: gener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Q,EAC9C,wBAAwB,aAAa,QAAQ,QAAQ,CACtD,CAAC;AAEF,QAAO;EAAC,GAAG;EAAQ,GAAG;EAAM,GAAG;EAAY;;AAG7C,MAAM,mBAA4C;CAChD,QAAQ;CACR,QAAQ;CACR,YAAY;CACb;AAED,MAAa,sBAAsB"}
|
|
1
|
+
{"version":3,"file":"index.mjs","names":[],"sources":["../src/index.ts"],"sourcesContent":["import path from 'node:path';\n\nimport {\n camel,\n type ClientBuilder,\n type ClientExtraFilesBuilder,\n type ClientGeneratorsBuilder,\n type ClientHeaderBuilder,\n type ContextSpec,\n generateMutatorImports,\n type GeneratorVerbOptions,\n getFileInfo,\n getFullRoute,\n getParamsInPath,\n isObject,\n isString,\n jsDoc,\n jsStringEscape,\n type NormalizedOutputOptions,\n type OpenApiInfoObject,\n pascal,\n upath,\n} from '@orval/core';\nimport { generateClient, generateFetchHeader } from '@orval/fetch';\nimport { generateZod } from '@orval/zod';\n\nconst getHeader = (\n option: false | ((info: OpenApiInfoObject) => string | string[]),\n info: OpenApiInfoObject,\n): string => {\n if (!option) {\n return '';\n }\n\n const header = option(info);\n\n return Array.isArray(header) ? jsDoc({ description: header }) : header;\n};\n\nconst getSpecInfo = (context: ContextSpec): OpenApiInfoObject =>\n context.spec.info ?? {\n title: 'API',\n version: '1.0.0',\n };\n\nexport const getMcpHeader: ClientHeaderBuilder = ({ verbOptions, output }) => {\n const targetInfo = getFileInfo(output.target);\n const schemasPath = (\n isObject(output.schemas)\n ? output.schemas.path\n : isString(output.schemas)\n ? output.schemas\n : undefined\n ) as string | undefined;\n const schemaInfo = schemasPath ? getFileInfo(schemasPath) : undefined;\n\n const isZodSchemaOutput =\n isObject(output.schemas) && output.schemas.type === 'zod';\n const basePath = schemaInfo?.dirname;\n const relativeSchemaImportPath = basePath\n ? isZodSchemaOutput && output.indexFiles\n ? upath.getRelativeImportPath(targetInfo.path, basePath, true)\n : upath.getRelativeImportPath(targetInfo.path, basePath)\n : './' + targetInfo.filename + '.schemas';\n\n const importSchemaNames = new Set(\n Object.values(verbOptions).flatMap((verbOption) => {\n const imports = [];\n const pascalOperationName = pascal(verbOption.operationName);\n\n if (verbOption.queryParams) {\n imports.push(`${pascalOperationName}Params`);\n }\n\n if (verbOption.body.imports[0]?.name) {\n imports.push(verbOption.body.imports[0]?.name);\n }\n\n return imports;\n }),\n )\n .values()\n .toArray();\n\n const importSchemasImplementation = `import {\\n ${importSchemaNames.join(\n ',\\n ',\n )}\\n} from '${relativeSchemaImportPath}';\n`;\n\n const relativeFetchClientPath = './http-client';\n const importFetchClientNames = new Set(\n Object.values(verbOptions).flatMap(\n (verbOption) => verbOption.operationName,\n ),\n )\n .values()\n .toArray();\n\n const importFetchClientImplementation = `import {\\n ${importFetchClientNames.join(\n ',\\n ',\n )}\\n} from '${relativeFetchClientPath}';\n `;\n\n const content = [\n importSchemasImplementation,\n importFetchClientImplementation,\n ].join('\\n');\n\n return content + '\\n';\n};\n\nexport const generateMcp: ClientBuilder = (verbOptions) => {\n const handlerArgsTypes = [];\n const originalParamNames = getParamsInPath(verbOptions.pathRoute);\n const pathParamsType = verbOptions.params\n .map((param, index) => {\n const paramName = originalParamNames[index];\n const paramType = param.implementation.split(': ')[1];\n return ` ${paramName}: ${paramType}`;\n })\n .join(',\\n');\n if (pathParamsType) {\n handlerArgsTypes.push(` pathParams: {\\n${pathParamsType}\\n };`);\n }\n if (verbOptions.queryParams) {\n handlerArgsTypes.push(\n ` queryParams: ${verbOptions.queryParams.schema.name};`,\n );\n }\n if (verbOptions.body.definition) {\n handlerArgsTypes.push(` bodyParams: ${verbOptions.body.definition};`);\n }\n\n const handlerArgsName = `${verbOptions.operationName}Args`;\n const handlerArgsImplementation =\n handlerArgsTypes.length > 0\n ? `\nexport type ${handlerArgsName} = {\n${handlerArgsTypes.join('\\n')}\n}\n`\n : '';\n\n const fetchParams = [];\n if (verbOptions.params.length > 0) {\n const pathParamsArgs = originalParamNames\n .map((paramName) => `args.pathParams.${paramName}`)\n .join(', ');\n\n fetchParams.push(pathParamsArgs);\n }\n if (verbOptions.body.definition) fetchParams.push(`args.bodyParams`);\n if (verbOptions.queryParams) fetchParams.push(`args.queryParams`);\n\n const handlerName = `${verbOptions.operationName}Handler`;\n const handlerImplementation = `\nexport const ${handlerName} = async (${handlerArgsTypes.length > 0 ? `args: ${handlerArgsName}, ` : ''}options?: RequestInit) => {\n const res = await ${verbOptions.operationName}(${fetchParams.length > 0 ? `${fetchParams.join(', ')}, ` : ''}options);\n\n return {\n content: [\n {\n type: 'text' as const,\n text: JSON.stringify(res),\n },\n ],\n };\n};`;\n\n const handlersImplementation = [\n handlerArgsImplementation,\n handlerImplementation,\n ].join('');\n\n return {\n implementation: handlersImplementation ? `${handlersImplementation}\\n` : '',\n imports: [],\n };\n};\n\nexport const generateServer = (\n verbOptions: Record<string, GeneratorVerbOptions>,\n output: NormalizedOutputOptions,\n context: ContextSpec,\n) => {\n const info = getSpecInfo(context);\n const { extension, dirname } = getFileInfo(output.target);\n const serverPath = path.join(dirname, `server${extension}`);\n const header = getHeader(output.override.header, info);\n\n const mcpServerOptions = output.override.mcp.server;\n\n const toolImplementations = Object.values(verbOptions)\n .map((verbOption) => {\n const pascalOperationName = pascal(verbOption.operationName);\n const inputSchemaTypes = [];\n if (verbOption.params.length > 0)\n inputSchemaTypes.push(` pathParams: ${pascalOperationName}Params`);\n if (verbOption.queryParams)\n inputSchemaTypes.push(\n ` queryParams: ${pascalOperationName}QueryParams`,\n );\n if (verbOption.body.definition)\n inputSchemaTypes.push(` bodyParams: ${pascalOperationName}Body`);\n\n const inputSchemaImplementation =\n inputSchemaTypes.length > 0\n ? ` {\n ${inputSchemaTypes.join(',\\n ')}\n },`\n : '';\n\n const handlerCallImplementation = inputSchemaImplementation\n ? `(args) => ${verbOption.operationName}Handler(args, options)`\n : `() => ${verbOption.operationName}Handler(options)`;\n\n const toolImplementation = `\nserver.tool(\n '${jsStringEscape(verbOption.operationName)}',\n '${jsStringEscape(verbOption.summary ?? '')}',${inputSchemaImplementation ? `\\n${inputSchemaImplementation}` : ''}\n ${handlerCallImplementation}\n);`;\n\n return toolImplementation;\n })\n .join('\\n');\n\n const importToolSchemas = Object.values(verbOptions)\n .flatMap((verbOption) => {\n const imports = [];\n\n const pascalOperationName = pascal(verbOption.operationName);\n\n if (verbOption.headers) imports.push(` ${pascalOperationName}Header`);\n if (verbOption.params.length > 0)\n imports.push(` ${pascalOperationName}Params`);\n if (verbOption.queryParams)\n imports.push(` ${pascalOperationName}QueryParams`);\n if (verbOption.body.definition)\n imports.push(` ${pascalOperationName}Body`);\n\n return imports;\n })\n .join(',\\n');\n const importToolSchemasImplementation = `import {\\n${importToolSchemas}\\n} from './tool-schemas.zod';`;\n\n const importHandlers = Object.values(verbOptions)\n .filter((verbOption) =>\n toolImplementations.includes(`${verbOption.operationName}Handler`),\n )\n .map((verbOption) => ` ${verbOption.operationName}Handler`)\n .join(`,\\n`);\n const importHandlersImplementation = `import {\\n${importHandlers}\\n} from './handlers';`;\n\n const createMcpServerImplementation = `\nconst createMcpServer = (options?: RequestInit) => {\n const server = new McpServer({\n name: '${camel(info.title)}Server',\n version: '1.0.0',\n });\n${toolImplementations}\n\n return server;\n};\n`;\n\n const serverFunctionName = mcpServerOptions?.name ?? 'customServer';\n const relativeServerPath = mcpServerOptions\n ? upath.getRelativeImportPath(serverPath, mcpServerOptions.path)\n : '';\n const importSpecifier = mcpServerOptions?.default\n ? serverFunctionName\n : `{ ${serverFunctionName} }`;\n\n const importMcpServer = `import {\n McpServer\n} from '@modelcontextprotocol/sdk/server/mcp.js';\n`;\n\n const importTransport = mcpServerOptions\n ? `import ${importSpecifier} from '${relativeServerPath}';`\n : `import {\n StdioServerTransport\n} from '@modelcontextprotocol/sdk/server/stdio.js';`;\n\n const importDependenciesImplementation = `${importMcpServer}\n${importTransport}\n`;\n\n const customServerConnectImplementation = `\\n${serverFunctionName}(createMcpServer);\\n`;\n const stdioServerConnectImplementation = `\nconst server = createMcpServer();\nconst transport = new StdioServerTransport();\n\nserver.connect(transport).then(() => {\n console.error('MCP server running on stdio');\n}).catch(console.error);\n`;\n\n const serverConnectImplementation = mcpServerOptions\n ? customServerConnectImplementation\n : stdioServerConnectImplementation;\n\n const content = [\n header,\n importDependenciesImplementation,\n importHandlersImplementation,\n importToolSchemasImplementation,\n createMcpServerImplementation,\n serverConnectImplementation,\n ].join('\\n');\n\n return [\n {\n content,\n path: serverPath,\n },\n ];\n};\n\nconst generateZodFiles = async (\n verbOptions: Record<string, GeneratorVerbOptions>,\n output: NormalizedOutputOptions,\n context: ContextSpec,\n) => {\n const { extension, dirname } = getFileInfo(output.target);\n\n const header = getHeader(output.override.header, getSpecInfo(context));\n\n const zods = await Promise.all(\n Object.values(verbOptions).map(async (verbOption) =>\n generateZod(\n verbOption,\n {\n route: verbOption.route,\n pathRoute: verbOption.pathRoute,\n override: output.override,\n context,\n mock: output.mock,\n output: output.target,\n },\n output.client,\n ),\n ),\n );\n\n const allMutators = new Map(\n zods.flatMap((z) => z.mutators ?? []).map((m) => [m.name, m]),\n )\n .values()\n .toArray();\n\n const mutatorsImports = generateMutatorImports({\n mutators: allMutators,\n });\n\n let content = `${header}import { z as zod } from 'zod';\\n${mutatorsImports}\\n`;\n\n const zodPath = path.join(dirname, `tool-schemas.zod${extension}`);\n\n content += zods.map((zod) => zod.implementation).join('\\n');\n\n return [\n {\n content,\n path: zodPath,\n },\n ];\n};\n\nconst generateHttpClientFiles = async (\n verbOptions: Record<string, GeneratorVerbOptions>,\n output: NormalizedOutputOptions,\n context: ContextSpec,\n) => {\n const {\n path: targetPath,\n extension,\n dirname,\n filename,\n } = getFileInfo(output.target);\n\n const header = getHeader(output.override.header, getSpecInfo(context));\n\n const clients = await Promise.all(\n Object.values(verbOptions).map(async (verbOption) => {\n const fullRoute = getFullRoute(\n verbOption.route,\n context.spec.servers,\n output.baseUrl,\n );\n\n const options = {\n route: fullRoute,\n pathRoute: verbOption.pathRoute,\n override: output.override,\n context,\n mock: output.mock,\n output: output.target,\n };\n\n return generateClient(verbOption, options, output.client, output);\n }),\n );\n\n const clientImplementation = clients\n .map((client) => client.implementation)\n .join('\\n');\n\n const isZodSchemaOutput =\n isObject(output.schemas) && output.schemas.type === 'zod';\n const schemasPath = (\n isObject(output.schemas)\n ? output.schemas.path\n : isString(output.schemas)\n ? output.schemas\n : undefined\n ) as string | undefined;\n const basePath = schemasPath ? getFileInfo(schemasPath).dirname : undefined;\n const relativeSchemasPath = basePath\n ? isZodSchemaOutput && output.indexFiles\n ? upath.getRelativeImportPath(targetPath, basePath, true)\n : upath.getRelativeImportPath(targetPath, basePath)\n : './' + filename + '.schemas';\n\n const importNames = clients\n .flatMap((client) => client.imports)\n .map((imp) => imp.name);\n const uniqueImportNames = new Set(importNames).values().toArray();\n\n const importImplementation = `import { ${uniqueImportNames.join(\n ',\\n',\n )} } from '${relativeSchemasPath}';`;\n\n const fetchHeader = generateFetchHeader({\n title: '',\n isRequestOptions: false,\n isMutator: false,\n noFunction: false,\n isGlobalMutator: false,\n provideIn: false,\n hasAwaitedType: false,\n output,\n verbOptions,\n clientImplementation,\n });\n\n const content = [\n header,\n importImplementation,\n fetchHeader,\n clientImplementation,\n ].join('\\n');\n const outputPath = path.join(dirname, `http-client${extension}`);\n\n return [\n {\n content,\n path: outputPath,\n },\n ];\n};\n\nexport const generateExtraFiles: ClientExtraFilesBuilder = async (\n verbOptions,\n output,\n context,\n) => {\n const server = generateServer(verbOptions, output, context);\n const [zods, httpClients] = await Promise.all([\n generateZodFiles(verbOptions, output, context),\n generateHttpClientFiles(verbOptions, output, context),\n ]);\n\n return [...server, ...zods, ...httpClients];\n};\n\nconst mcpClientBuilder: ClientGeneratorsBuilder = {\n client: generateMcp,\n header: getMcpHeader,\n extraFiles: generateExtraFiles,\n};\n\nexport const builder = () => () => mcpClientBuilder;\n\nexport default builder;\n"],"mappings":";;;;;AA0BA,MAAM,aACJ,QACA,SACW;AACX,KAAI,CAAC,OACH,QAAO;CAGT,MAAM,SAAS,OAAO,KAA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;IACZ,iBAAiB;IACjB,WAAW;IACX,gBAAgB;IAChB;IACA;IACA;IACD,CAAC;GAMA;GACD,CAAC,KAAK,KAAK;EAMR,MALe,KAAK,KAAK,SAAS,cAAc,YAAY;EAM7D,CACF;;AAGH,MAAa,qBAA8C,OACzD,aACA,QACA,YACG;CACH,MAAM,SAAS,eAAe,aAAa,QAAQ,QAAQ;CAC3D,MAAM,CAAC,MAAM,eAAe,MAAM,QAAQ,IAAI,CAC5C,iBAAiB,aAAa,QAAQ,QAAQ,EAC9C,wBAAwB,aAAa,QAAQ,QAAQ,CACtD,CAAC;AAEF,QAAO;EAAC,GAAG;EAAQ,GAAG;EAAM,GAAG;EAAY;;AAG7C,MAAM,mBAA4C;CAChD,QAAQ;CACR,QAAQ;CACR,YAAY;CACb;AAED,MAAa,sBAAsB"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@orval/mcp",
|
|
3
|
-
"version": "8.
|
|
3
|
+
"version": "8.8.1",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -35,14 +35,14 @@
|
|
|
35
35
|
"nuke": "rimraf .turbo dist node_modules"
|
|
36
36
|
},
|
|
37
37
|
"dependencies": {
|
|
38
|
-
"@orval/core": "8.
|
|
39
|
-
"@orval/fetch": "8.
|
|
40
|
-
"@orval/zod": "8.
|
|
38
|
+
"@orval/core": "8.8.1",
|
|
39
|
+
"@orval/fetch": "8.8.1",
|
|
40
|
+
"@orval/zod": "8.8.1"
|
|
41
41
|
},
|
|
42
42
|
"devDependencies": {
|
|
43
43
|
"eslint": "10.1.0",
|
|
44
44
|
"rimraf": "6.1.2",
|
|
45
|
-
"tsdown": "0.
|
|
45
|
+
"tsdown": "0.21.9",
|
|
46
46
|
"typescript": "5.9.3",
|
|
47
47
|
"vitest": "4.0.18"
|
|
48
48
|
},
|