@orval/mcp 7.9.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/README.md +54 -0
- package/dist/index.d.ts +12 -0
- package/dist/index.js +605 -0
- package/dist/index.js.map +1 -0
- package/package.json +19 -0
package/README.md
ADDED
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
[](https://badge.fury.io/js/orval)
|
|
2
|
+
[](https://opensource.org/licenses/MIT)
|
|
3
|
+
[](https://github.com/orval-labs/orval/actions/workflows/tests.yaml)
|
|
4
|
+
|
|
5
|
+
<p align="center">
|
|
6
|
+
<img src="./logo/orval-logo-horizontal.svg?raw=true" width="500" height="160" alt="orval - Restfull Client Generator" />
|
|
7
|
+
</p>
|
|
8
|
+
<h1 align="center">
|
|
9
|
+
Visit <a href="https://orval.dev" target="_blank">orval.dev</a> for docs, guides, API and beer!
|
|
10
|
+
</h1>
|
|
11
|
+
|
|
12
|
+
### Code Generation
|
|
13
|
+
|
|
14
|
+
`orval` is able to generate client with appropriate type-signatures (TypeScript) from any valid OpenAPI v3 or Swagger v2 specification, either in `yaml` or `json` formats.
|
|
15
|
+
|
|
16
|
+
`Generate`, `valid`, `cache` and `mock` in your React, Vue, Svelte and Angular applications all with your OpenAPI specification.
|
|
17
|
+
|
|
18
|
+
### How to use the generated mcp server
|
|
19
|
+
|
|
20
|
+
Add a setting to the mcp client to launch the generated `server.ts`.
|
|
21
|
+
For example, like this:
|
|
22
|
+
|
|
23
|
+
```
|
|
24
|
+
"pet-store-server": {
|
|
25
|
+
"command": "docker",
|
|
26
|
+
"args": [
|
|
27
|
+
"run",
|
|
28
|
+
"-i",
|
|
29
|
+
"--rm",
|
|
30
|
+
"pet-store-mcp",
|
|
31
|
+
"bash",
|
|
32
|
+
"-c",
|
|
33
|
+
"ts-node",
|
|
34
|
+
"src/gen/server.ts"
|
|
35
|
+
],
|
|
36
|
+
"disabled": false,
|
|
37
|
+
"alwaysAllow": []
|
|
38
|
+
}
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
Here, `src/gen/server.ts` is started using `Docker`.
|
|
42
|
+
|
|
43
|
+
### Samples
|
|
44
|
+
|
|
45
|
+
You can find below some samples
|
|
46
|
+
|
|
47
|
+
- [react app](https://github.com/orval-labs/orval/tree/master/samples/react-app)
|
|
48
|
+
- [react query](https://github.com/orval-labs/orval/tree/master/samples/react-query)
|
|
49
|
+
- [svelte query](https://github.com/orval-labs/orval/tree/master/samples/svelte-query)
|
|
50
|
+
- [vue query](https://github.com/orval-labs/orval/tree/master/samples/vue-query)
|
|
51
|
+
- [react app with swr](https://github.com/orval-labs/orval/tree/master/samples/react-app-with-swr)
|
|
52
|
+
- [angular app](https://github.com/orval-labs/orval/tree/master/samples/angular-app)
|
|
53
|
+
- [hono](https://github.com/orval-labs/orval/tree/master/samples/hono)
|
|
54
|
+
- [next app with fetch](https://github.com/orval-labs/orval/tree/master/samples/next-app-with-fetch)
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { ClientHeaderBuilder, ClientBuilder, GeneratorVerbOptions, NormalizedOutputOptions, ContextSpecs, ClientExtraFilesBuilder, ClientGeneratorsBuilder } from '@orval/core';
|
|
2
|
+
|
|
3
|
+
declare const getMcpHeader: ClientHeaderBuilder;
|
|
4
|
+
declare const generateMcp: ClientBuilder;
|
|
5
|
+
declare const generateServer: (verbOptions: Record<string, GeneratorVerbOptions>, output: NormalizedOutputOptions, context: ContextSpecs) => Promise<{
|
|
6
|
+
content: string;
|
|
7
|
+
path: string;
|
|
8
|
+
}[]>;
|
|
9
|
+
declare const generateExtraFiles: ClientExtraFilesBuilder;
|
|
10
|
+
declare const builder: () => () => ClientGeneratorsBuilder;
|
|
11
|
+
|
|
12
|
+
export { builder, builder as default, generateExtraFiles, generateMcp, generateServer, getMcpHeader };
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,605 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
3
|
+
var __defProp = Object.defineProperty;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __commonJS = (cb, mod) => function __require() {
|
|
9
|
+
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
|
10
|
+
};
|
|
11
|
+
var __export = (target, all) => {
|
|
12
|
+
for (var name in all)
|
|
13
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
14
|
+
};
|
|
15
|
+
var __copyProps = (to, from, except, desc) => {
|
|
16
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
17
|
+
for (let key of __getOwnPropNames(from))
|
|
18
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
19
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
20
|
+
}
|
|
21
|
+
return to;
|
|
22
|
+
};
|
|
23
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
24
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
25
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
26
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
27
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
28
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
29
|
+
mod
|
|
30
|
+
));
|
|
31
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
32
|
+
|
|
33
|
+
// ../fetch/dist/index.js
|
|
34
|
+
var require_dist = __commonJS({
|
|
35
|
+
"../fetch/dist/index.js"(exports2, module2) {
|
|
36
|
+
"use strict";
|
|
37
|
+
var __defProp2 = Object.defineProperty;
|
|
38
|
+
var __getOwnPropDesc2 = Object.getOwnPropertyDescriptor;
|
|
39
|
+
var __getOwnPropNames2 = Object.getOwnPropertyNames;
|
|
40
|
+
var __hasOwnProp2 = Object.prototype.hasOwnProperty;
|
|
41
|
+
var __export2 = (target, all) => {
|
|
42
|
+
for (var name in all)
|
|
43
|
+
__defProp2(target, name, { get: all[name], enumerable: true });
|
|
44
|
+
};
|
|
45
|
+
var __copyProps2 = (to, from, except, desc) => {
|
|
46
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
47
|
+
for (let key of __getOwnPropNames2(from))
|
|
48
|
+
if (!__hasOwnProp2.call(to, key) && key !== except)
|
|
49
|
+
__defProp2(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc2(from, key)) || desc.enumerable });
|
|
50
|
+
}
|
|
51
|
+
return to;
|
|
52
|
+
};
|
|
53
|
+
var __toCommonJS2 = (mod) => __copyProps2(__defProp2({}, "__esModule", { value: true }), mod);
|
|
54
|
+
var src_exports2 = {};
|
|
55
|
+
__export2(src_exports2, {
|
|
56
|
+
builder: () => builder2,
|
|
57
|
+
default: () => src_default2,
|
|
58
|
+
fetchResponseTypeName: () => fetchResponseTypeName,
|
|
59
|
+
generateClient: () => generateClient2,
|
|
60
|
+
generateFetchHeader: () => generateFetchHeader2,
|
|
61
|
+
generateRequestFunction: () => generateRequestFunction
|
|
62
|
+
});
|
|
63
|
+
module2.exports = __toCommonJS2(src_exports2);
|
|
64
|
+
var import_core2 = require("@orval/core");
|
|
65
|
+
var import_core22 = require("@orval/core");
|
|
66
|
+
var generateRequestFunction = ({
|
|
67
|
+
queryParams,
|
|
68
|
+
headers,
|
|
69
|
+
operationName,
|
|
70
|
+
response,
|
|
71
|
+
mutator,
|
|
72
|
+
body,
|
|
73
|
+
props,
|
|
74
|
+
verb,
|
|
75
|
+
formData,
|
|
76
|
+
formUrlEncoded,
|
|
77
|
+
override
|
|
78
|
+
}, { route, context, pathRoute }) => {
|
|
79
|
+
var _a, _b, _c;
|
|
80
|
+
const isRequestOptions = (override == null ? void 0 : override.requestOptions) !== false;
|
|
81
|
+
const isFormData = (override == null ? void 0 : override.formData.disabled) === false;
|
|
82
|
+
const isFormUrlEncoded = (override == null ? void 0 : override.formUrlEncoded) !== false;
|
|
83
|
+
const getUrlFnName = (0, import_core22.camel)(`get-${operationName}-url`);
|
|
84
|
+
const getUrlFnProps = (0, import_core22.toObjectString)(
|
|
85
|
+
props.filter(
|
|
86
|
+
(prop) => prop.type === import_core22.GetterPropType.PARAM || prop.type === import_core22.GetterPropType.NAMED_PATH_PARAMS || prop.type === import_core22.GetterPropType.QUERY_PARAM
|
|
87
|
+
),
|
|
88
|
+
"implementation"
|
|
89
|
+
);
|
|
90
|
+
const spec = context.specs[context.specKey].paths[pathRoute];
|
|
91
|
+
const parameters = ((_a = spec == null ? void 0 : spec[verb]) == null ? void 0 : _a.parameters) || [];
|
|
92
|
+
const explodeParameters = parameters.filter((parameter) => {
|
|
93
|
+
const { schema } = (0, import_core22.resolveRef)(parameter, context);
|
|
94
|
+
return schema.in === "query" && schema.explode;
|
|
95
|
+
});
|
|
96
|
+
const explodeParametersNames = explodeParameters.map((parameter) => {
|
|
97
|
+
const { schema } = (0, import_core22.resolveRef)(parameter, context);
|
|
98
|
+
return schema.name;
|
|
99
|
+
});
|
|
100
|
+
const explodeArrayImplementation = explodeParameters.length > 0 ? `const explodeParameters = ${JSON.stringify(explodeParametersNames)};
|
|
101
|
+
|
|
102
|
+
if (value instanceof Array && explodeParameters.includes(key)) {
|
|
103
|
+
value.forEach((v) => normalizedParams.append(key, v === null ? 'null' : v.toString()));
|
|
104
|
+
return;
|
|
105
|
+
}
|
|
106
|
+
` : "";
|
|
107
|
+
const isExplodeParametersOnly = explodeParameters.length === parameters.length;
|
|
108
|
+
const nomalParamsImplementation = `if (value !== undefined) {
|
|
109
|
+
normalizedParams.append(key, value === null ? 'null' : value.toString())
|
|
110
|
+
}`;
|
|
111
|
+
const getUrlFnImplementation = `export const ${getUrlFnName} = (${getUrlFnProps}) => {
|
|
112
|
+
${queryParams ? ` const normalizedParams = new URLSearchParams();
|
|
113
|
+
|
|
114
|
+
Object.entries(params || {}).forEach(([key, value]) => {
|
|
115
|
+
${explodeArrayImplementation}
|
|
116
|
+
${!isExplodeParametersOnly ? nomalParamsImplementation : ""}
|
|
117
|
+
});` : ""}
|
|
118
|
+
|
|
119
|
+
${queryParams ? `const stringifiedParams = normalizedParams.toString();` : ``}
|
|
120
|
+
|
|
121
|
+
${queryParams ? `return stringifiedParams.length > 0 ? \`${route}${"?${stringifiedParams}"}\` : \`${route}\`` : `return \`${route}\``}
|
|
122
|
+
}
|
|
123
|
+
`;
|
|
124
|
+
const isContentTypeNdJson = (contentType) => contentType === "application/nd-json" || contentType === "application/x-ndjson";
|
|
125
|
+
const isNdJson = response.contentTypes.some(isContentTypeNdJson);
|
|
126
|
+
const responseTypeName = fetchResponseTypeName(
|
|
127
|
+
override.fetch.includeHttpResponseReturnType,
|
|
128
|
+
isNdJson ? "Response" : response.definition.success,
|
|
129
|
+
operationName
|
|
130
|
+
);
|
|
131
|
+
const allResponses = [...response.types.success, ...response.types.errors];
|
|
132
|
+
if (allResponses.length === 0) {
|
|
133
|
+
allResponses.push({
|
|
134
|
+
contentType: "",
|
|
135
|
+
hasReadonlyProps: false,
|
|
136
|
+
imports: [],
|
|
137
|
+
isEnum: false,
|
|
138
|
+
isRef: false,
|
|
139
|
+
key: "default",
|
|
140
|
+
schemas: [],
|
|
141
|
+
type: "unknown",
|
|
142
|
+
value: "unknown"
|
|
143
|
+
});
|
|
144
|
+
}
|
|
145
|
+
const nonDefaultStatuses = allResponses.filter((r) => r.key !== "default").map((r) => r.key);
|
|
146
|
+
const responseDataTypes = allResponses.map(
|
|
147
|
+
(r) => `export type ${responseTypeName}${(0, import_core2.pascal)(r.key)} = {
|
|
148
|
+
${isContentTypeNdJson(r.contentType) ? "stream: Response" : `data: ${r.value || "unknown"}`}
|
|
149
|
+
status: ${r.key === "default" ? nonDefaultStatuses.length ? `Exclude<HTTPStatusCodes, ${nonDefaultStatuses.join(" | ")}>` : "number" : r.key}
|
|
150
|
+
}`
|
|
151
|
+
).join("\n\n");
|
|
152
|
+
const compositeName = `${responseTypeName}Composite`;
|
|
153
|
+
const compositeResponse = `${compositeName} = ${allResponses.map((r) => `${responseTypeName}${(0, import_core2.pascal)(r.key)}`).join(" | ")}`;
|
|
154
|
+
const responseTypeImplementation = override.fetch.includeHttpResponseReturnType ? `${responseDataTypes}
|
|
155
|
+
|
|
156
|
+
export type ${compositeResponse};
|
|
157
|
+
|
|
158
|
+
export type ${responseTypeName} = ${compositeName} & {
|
|
159
|
+
headers: Headers;
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
` : "";
|
|
163
|
+
const getUrlFnProperties = props.filter(
|
|
164
|
+
(prop) => prop.type === import_core22.GetterPropType.PARAM || prop.type === import_core22.GetterPropType.QUERY_PARAM || prop.type === import_core22.GetterPropType.NAMED_PATH_PARAMS
|
|
165
|
+
).map((param) => {
|
|
166
|
+
if (param.type === import_core22.GetterPropType.NAMED_PATH_PARAMS) {
|
|
167
|
+
return param.destructured;
|
|
168
|
+
} else {
|
|
169
|
+
return param.name;
|
|
170
|
+
}
|
|
171
|
+
}).join(",");
|
|
172
|
+
const args = `${(0, import_core22.toObjectString)(props, "implementation")} ${isRequestOptions ? `options?: RequestInit` : ""}`;
|
|
173
|
+
const returnType = `Promise<${responseTypeName}>`;
|
|
174
|
+
const globalFetchOptions = (0, import_core22.isObject)(override == null ? void 0 : override.requestOptions) ? `${(_c = (_b = (0, import_core22.stringify)(override == null ? void 0 : override.requestOptions)) == null ? void 0 : _b.slice(1, -1)) == null ? void 0 : _c.trim()}` : "";
|
|
175
|
+
const fetchMethodOption = `method: '${verb.toUpperCase()}'`;
|
|
176
|
+
const ignoreContentTypes = ["multipart/form-data"];
|
|
177
|
+
const fetchHeadersOption = body.contentType && !ignoreContentTypes.includes(body.contentType) ? `headers: { 'Content-Type': '${body.contentType}',${headers ? "...headers," : ""} ...options?.headers }` : headers ? "headers: {...headers, ...options?.headers}" : "";
|
|
178
|
+
const requestBodyParams = (0, import_core22.generateBodyOptions)(
|
|
179
|
+
body,
|
|
180
|
+
isFormData,
|
|
181
|
+
isFormUrlEncoded
|
|
182
|
+
);
|
|
183
|
+
const fetchBodyOption = requestBodyParams ? isFormData && body.formData || isFormUrlEncoded && body.formUrlEncoded ? `body: ${requestBodyParams}` : `body: JSON.stringify(${requestBodyParams})` : "";
|
|
184
|
+
const fetchFnOptions = `${getUrlFnName}(${getUrlFnProperties}),
|
|
185
|
+
{${globalFetchOptions ? "\n" : ""} ${globalFetchOptions}
|
|
186
|
+
${isRequestOptions ? "...options," : ""}
|
|
187
|
+
${fetchMethodOption}${fetchHeadersOption ? "," : ""}
|
|
188
|
+
${fetchHeadersOption}${fetchBodyOption ? "," : ""}
|
|
189
|
+
${fetchBodyOption}
|
|
190
|
+
}
|
|
191
|
+
`;
|
|
192
|
+
const fetchResponseImplementation = isNdJson ? `const stream = await fetch(${fetchFnOptions})
|
|
193
|
+
|
|
194
|
+
${override.fetch.includeHttpResponseReturnType ? "return { status: stream.status, stream, headers: stream.headers }" : `return stream`}
|
|
195
|
+
` : `const res = await fetch(${fetchFnOptions})
|
|
196
|
+
|
|
197
|
+
const body = [204, 205, 304].includes(res.status) ? null : await res.text()
|
|
198
|
+
const data: ${responseTypeName}${override.fetch.includeHttpResponseReturnType ? `['data']` : ""} = body ? JSON.parse(body) : {}
|
|
199
|
+
|
|
200
|
+
${override.fetch.includeHttpResponseReturnType ? `return { data, status: res.status, headers: res.headers } as ${responseTypeName}` : "return data"}
|
|
201
|
+
`;
|
|
202
|
+
const customFetchResponseImplementation = `return ${mutator == null ? void 0 : mutator.name}<${responseTypeName}>(${fetchFnOptions});`;
|
|
203
|
+
const bodyForm = (0, import_core22.generateFormDataAndUrlEncodedFunction)({
|
|
204
|
+
formData,
|
|
205
|
+
formUrlEncoded,
|
|
206
|
+
body,
|
|
207
|
+
isFormData,
|
|
208
|
+
isFormUrlEncoded
|
|
209
|
+
});
|
|
210
|
+
const fetchImplementationBody = mutator ? customFetchResponseImplementation : fetchResponseImplementation;
|
|
211
|
+
const fetchImplementation = `export const ${operationName} = async (${args}): ${returnType} => {
|
|
212
|
+
${bodyForm ? ` ${bodyForm}` : ""}
|
|
213
|
+
${fetchImplementationBody}}
|
|
214
|
+
`;
|
|
215
|
+
const implementation = `${responseTypeImplementation}${getUrlFnImplementation}
|
|
216
|
+
${fetchImplementation}
|
|
217
|
+
`;
|
|
218
|
+
return implementation;
|
|
219
|
+
};
|
|
220
|
+
var fetchResponseTypeName = (includeHttpResponseReturnType, definitionSuccessResponse, operationName) => {
|
|
221
|
+
return includeHttpResponseReturnType ? `${operationName}Response` : definitionSuccessResponse;
|
|
222
|
+
};
|
|
223
|
+
var generateClient2 = (verbOptions, options) => {
|
|
224
|
+
const imports = (0, import_core22.generateVerbImports)(verbOptions);
|
|
225
|
+
const functionImplementation = generateRequestFunction(verbOptions, options);
|
|
226
|
+
return {
|
|
227
|
+
implementation: `${functionImplementation}
|
|
228
|
+
`,
|
|
229
|
+
imports
|
|
230
|
+
};
|
|
231
|
+
};
|
|
232
|
+
var getHTTPStatusCodes = () => `
|
|
233
|
+
export type HTTPStatusCode1xx = 100 | 101 | 102 | 103;
|
|
234
|
+
export type HTTPStatusCode2xx = 200 | 201 | 202 | 203 | 204 | 205 | 206 | 207;
|
|
235
|
+
export type HTTPStatusCode3xx = 300 | 301 | 302 | 303 | 304 | 305 | 307 | 308;
|
|
236
|
+
export type HTTPStatusCode4xx = 400 | 401 | 402 | 403 | 404 | 405 | 406 | 407 | 408 | 409 | 410 | 411 | 412 | 413 | 414 | 415 | 416 | 417 | 418 | 419 | 420 | 421 | 422 | 423 | 424 | 426 | 428 | 429 | 431 | 451;
|
|
237
|
+
export type HTTPStatusCode5xx = 500 | 501 | 502 | 503 | 504 | 505 | 507 | 511;
|
|
238
|
+
export type HTTPStatusCodes = HTTPStatusCode1xx | HTTPStatusCode2xx | HTTPStatusCode3xx | HTTPStatusCode4xx | HTTPStatusCode5xx;
|
|
239
|
+
|
|
240
|
+
`;
|
|
241
|
+
var generateFetchHeader2 = ({
|
|
242
|
+
clientImplementation
|
|
243
|
+
}) => {
|
|
244
|
+
return clientImplementation.includes("<HTTPStatusCodes,") ? getHTTPStatusCodes() : "";
|
|
245
|
+
};
|
|
246
|
+
var fetchClientBuilder = {
|
|
247
|
+
client: generateClient2,
|
|
248
|
+
header: generateFetchHeader2,
|
|
249
|
+
dependencies: () => []
|
|
250
|
+
};
|
|
251
|
+
var builder2 = () => () => fetchClientBuilder;
|
|
252
|
+
var src_default2 = builder2;
|
|
253
|
+
}
|
|
254
|
+
});
|
|
255
|
+
|
|
256
|
+
// src/index.ts
|
|
257
|
+
var src_exports = {};
|
|
258
|
+
__export(src_exports, {
|
|
259
|
+
builder: () => builder,
|
|
260
|
+
default: () => src_default,
|
|
261
|
+
generateExtraFiles: () => generateExtraFiles,
|
|
262
|
+
generateMcp: () => generateMcp,
|
|
263
|
+
generateServer: () => generateServer,
|
|
264
|
+
getMcpHeader: () => getMcpHeader
|
|
265
|
+
});
|
|
266
|
+
module.exports = __toCommonJS(src_exports);
|
|
267
|
+
var import_core = require("@orval/core");
|
|
268
|
+
var import_zod = require("@orval/zod");
|
|
269
|
+
var import_fetch = __toESM(require_dist());
|
|
270
|
+
var getHeader = (option, info) => {
|
|
271
|
+
if (!option) {
|
|
272
|
+
return "";
|
|
273
|
+
}
|
|
274
|
+
const header = option(info);
|
|
275
|
+
return Array.isArray(header) ? (0, import_core.jsDoc)({ description: header }) : header;
|
|
276
|
+
};
|
|
277
|
+
var getMcpHeader = ({
|
|
278
|
+
verbOptions,
|
|
279
|
+
output,
|
|
280
|
+
clientImplementation
|
|
281
|
+
}) => {
|
|
282
|
+
const targetInfo = (0, import_core.getFileInfo)(output.target);
|
|
283
|
+
const schemaInfo = (0, import_core.getFileInfo)(output.schemas);
|
|
284
|
+
const relativeSchemaImportPath = output.schemas ? import_core.upath.relativeSafe(targetInfo.dirname, schemaInfo.dirname) : "./" + targetInfo.filename + ".schemas";
|
|
285
|
+
const importSchemaNames = Object.values(verbOptions).flatMap((verbOption) => {
|
|
286
|
+
const imports = [];
|
|
287
|
+
const pascalOperationName = (0, import_core.pascal)(verbOption.operationName);
|
|
288
|
+
if (verbOption.queryParams) {
|
|
289
|
+
imports.push(`${pascalOperationName}Params`);
|
|
290
|
+
}
|
|
291
|
+
if (verbOption.body.definition) {
|
|
292
|
+
imports.push(`${pascalOperationName}Body`);
|
|
293
|
+
}
|
|
294
|
+
return imports;
|
|
295
|
+
}).reduce((acc, name) => {
|
|
296
|
+
if (!acc.find((i) => i === name)) {
|
|
297
|
+
acc.push(name);
|
|
298
|
+
}
|
|
299
|
+
return acc;
|
|
300
|
+
}, []);
|
|
301
|
+
const importSchemasImplementation = `import {
|
|
302
|
+
${importSchemaNames.join(
|
|
303
|
+
",\n "
|
|
304
|
+
)}
|
|
305
|
+
} from '${relativeSchemaImportPath}';
|
|
306
|
+
`;
|
|
307
|
+
const relativeFetchClientPath = "./http-client";
|
|
308
|
+
const importFetchClientNames = Object.values(verbOptions).flatMap((verbOption) => verbOption.operationName).reduce((acc, name) => {
|
|
309
|
+
if (!acc.find((i) => i === name)) {
|
|
310
|
+
acc.push(name);
|
|
311
|
+
}
|
|
312
|
+
return acc;
|
|
313
|
+
}, []);
|
|
314
|
+
const importFetchClientImplementation = `import {
|
|
315
|
+
${importFetchClientNames.join(
|
|
316
|
+
",\n "
|
|
317
|
+
)}
|
|
318
|
+
} from '${relativeFetchClientPath}';
|
|
319
|
+
`;
|
|
320
|
+
const content = [
|
|
321
|
+
importSchemasImplementation,
|
|
322
|
+
importFetchClientImplementation
|
|
323
|
+
].join("\n");
|
|
324
|
+
return content + "\n";
|
|
325
|
+
};
|
|
326
|
+
var generateMcp = async (verbOptions, options) => {
|
|
327
|
+
const handlerArgsTypes = [];
|
|
328
|
+
const pathParamsType = verbOptions.params.map((param) => {
|
|
329
|
+
const paramName = param.name.split(": ")[0];
|
|
330
|
+
const paramType = param.implementation.split(": ")[1];
|
|
331
|
+
return ` ${paramName}: ${paramType}`;
|
|
332
|
+
}).join(",\n");
|
|
333
|
+
if (pathParamsType) {
|
|
334
|
+
handlerArgsTypes.push(` pathParams: {
|
|
335
|
+
${pathParamsType}
|
|
336
|
+
};`);
|
|
337
|
+
}
|
|
338
|
+
if (verbOptions.queryParams) {
|
|
339
|
+
handlerArgsTypes.push(
|
|
340
|
+
` queryParams: ${verbOptions.queryParams.schema.name};`
|
|
341
|
+
);
|
|
342
|
+
}
|
|
343
|
+
if (verbOptions.body.definition) {
|
|
344
|
+
handlerArgsTypes.push(` bodyParams: ${verbOptions.body.definition};`);
|
|
345
|
+
}
|
|
346
|
+
const handlerArgsName = `${verbOptions.operationName}Args`;
|
|
347
|
+
const handlerArgsImplementation = handlerArgsTypes.length ? `
|
|
348
|
+
export type ${handlerArgsName} = {
|
|
349
|
+
${handlerArgsTypes.join("\n")}
|
|
350
|
+
}
|
|
351
|
+
` : "";
|
|
352
|
+
const fetchParams = [];
|
|
353
|
+
if (verbOptions.params.length) {
|
|
354
|
+
const pathParamsArgs = verbOptions.params.map((param) => {
|
|
355
|
+
const paramName = param.name.split(": ")[0];
|
|
356
|
+
return `args.pathParams.${paramName}`;
|
|
357
|
+
}).join(", ");
|
|
358
|
+
fetchParams.push(`${pathParamsArgs}`);
|
|
359
|
+
}
|
|
360
|
+
if (verbOptions.body.definition) fetchParams.push(`args.bodyParams`);
|
|
361
|
+
if (verbOptions.queryParams) fetchParams.push(`args.queryParams`);
|
|
362
|
+
const handlerName = `${verbOptions.operationName}Handler`;
|
|
363
|
+
const handlerImplementation = `
|
|
364
|
+
export const ${handlerName} = async (${handlerArgsTypes.length ? `args: ${handlerArgsName}` : ""}) => {
|
|
365
|
+
const res = await ${verbOptions.operationName}(${fetchParams.join(", ")});
|
|
366
|
+
|
|
367
|
+
return {
|
|
368
|
+
content: [
|
|
369
|
+
{
|
|
370
|
+
type: 'text' as const,
|
|
371
|
+
text: JSON.stringify(res),
|
|
372
|
+
},
|
|
373
|
+
],
|
|
374
|
+
};
|
|
375
|
+
};`;
|
|
376
|
+
const handlersImplementation = [
|
|
377
|
+
handlerArgsImplementation,
|
|
378
|
+
handlerImplementation
|
|
379
|
+
].join("");
|
|
380
|
+
return {
|
|
381
|
+
implementation: handlersImplementation ? `${handlersImplementation}
|
|
382
|
+
` : "",
|
|
383
|
+
imports: []
|
|
384
|
+
};
|
|
385
|
+
};
|
|
386
|
+
var generateServer = async (verbOptions, output, context) => {
|
|
387
|
+
const info = context.specs[context.specKey].info;
|
|
388
|
+
const { extension, dirname } = (0, import_core.getFileInfo)(output.target);
|
|
389
|
+
const serverPath = import_core.upath.join(dirname, `server${extension}`);
|
|
390
|
+
const header = getHeader(output.override.header, info);
|
|
391
|
+
const toolImplementations = Object.values(verbOptions).map((verbOption) => {
|
|
392
|
+
const imputSchemaTypes = [];
|
|
393
|
+
if (verbOption.params.length)
|
|
394
|
+
imputSchemaTypes.push(
|
|
395
|
+
` pathParams: ${verbOption.operationName}Params`
|
|
396
|
+
);
|
|
397
|
+
if (verbOption.queryParams)
|
|
398
|
+
imputSchemaTypes.push(
|
|
399
|
+
` queryParams: ${verbOption.operationName}QueryParams`
|
|
400
|
+
);
|
|
401
|
+
if (verbOption.body.definition)
|
|
402
|
+
imputSchemaTypes.push(` bodyParams: ${verbOption.operationName}Body`);
|
|
403
|
+
const imputSchemaImplementation = imputSchemaTypes.length ? ` {
|
|
404
|
+
${imputSchemaTypes.join(",\n ")}
|
|
405
|
+
},` : "";
|
|
406
|
+
const toolImplementation = `
|
|
407
|
+
server.tool(
|
|
408
|
+
'${verbOption.operationName}',
|
|
409
|
+
'${verbOption.summary}',${imputSchemaImplementation ? `
|
|
410
|
+
${imputSchemaImplementation}` : ""}
|
|
411
|
+
${verbOption.operationName}Handler
|
|
412
|
+
);`;
|
|
413
|
+
return toolImplementation;
|
|
414
|
+
}).join("\n");
|
|
415
|
+
const importToolSchemas = Object.values(verbOptions).flatMap((verbOption) => {
|
|
416
|
+
const imports = [];
|
|
417
|
+
if (verbOption.headers)
|
|
418
|
+
imports.push(` ${verbOption.operationName}Header`);
|
|
419
|
+
if (verbOption.params.length)
|
|
420
|
+
imports.push(` ${verbOption.operationName}Params`);
|
|
421
|
+
if (verbOption.queryParams)
|
|
422
|
+
imports.push(` ${verbOption.operationName}QueryParams`);
|
|
423
|
+
if (verbOption.body.definition)
|
|
424
|
+
imports.push(` ${verbOption.operationName}Body`);
|
|
425
|
+
return imports;
|
|
426
|
+
}).join(",\n");
|
|
427
|
+
const importToolSchemasImplementation = `import {
|
|
428
|
+
${importToolSchemas}
|
|
429
|
+
} from './tool-schemas.zod';`;
|
|
430
|
+
const importHandlers = Object.values(verbOptions).filter(
|
|
431
|
+
(verbOption) => toolImplementations.includes(`${verbOption.operationName}Handler`)
|
|
432
|
+
).map((verbOption) => ` ${verbOption.operationName}Handler`).join(`,
|
|
433
|
+
`);
|
|
434
|
+
const importHandlersImplementation = `import {
|
|
435
|
+
${importHandlers}
|
|
436
|
+
} from './handlers';`;
|
|
437
|
+
const importDependenciesImplementation = `import {
|
|
438
|
+
McpServer
|
|
439
|
+
} from '@modelcontextprotocol/sdk/server/mcp.js';
|
|
440
|
+
|
|
441
|
+
import {
|
|
442
|
+
StdioServerTransport
|
|
443
|
+
} from '@modelcontextprotocol/sdk/server/stdio.js';
|
|
444
|
+
`;
|
|
445
|
+
const newMcpServerImplementation = `
|
|
446
|
+
const server = new McpServer({
|
|
447
|
+
name: '${(0, import_core.camel)(info.title)}Server',
|
|
448
|
+
version: '1.0.0',
|
|
449
|
+
});
|
|
450
|
+
`;
|
|
451
|
+
const serverConnectImplementation = `
|
|
452
|
+
const transport = new StdioServerTransport();
|
|
453
|
+
|
|
454
|
+
server.connect(transport).then(() => {
|
|
455
|
+
console.error('MCP server running on stdio');
|
|
456
|
+
}).catch(console.error);
|
|
457
|
+
`;
|
|
458
|
+
const content = [
|
|
459
|
+
header,
|
|
460
|
+
importDependenciesImplementation,
|
|
461
|
+
importHandlersImplementation,
|
|
462
|
+
importToolSchemasImplementation,
|
|
463
|
+
newMcpServerImplementation,
|
|
464
|
+
toolImplementations,
|
|
465
|
+
serverConnectImplementation
|
|
466
|
+
].join("\n");
|
|
467
|
+
return [
|
|
468
|
+
{
|
|
469
|
+
content,
|
|
470
|
+
path: serverPath
|
|
471
|
+
}
|
|
472
|
+
];
|
|
473
|
+
};
|
|
474
|
+
var generateZodFiles = async (verbOptions, output, context) => {
|
|
475
|
+
const { extension, dirname, filename } = (0, import_core.getFileInfo)(output.target);
|
|
476
|
+
const header = getHeader(
|
|
477
|
+
output.override.header,
|
|
478
|
+
context.specs[context.specKey].info
|
|
479
|
+
);
|
|
480
|
+
const zods = await Promise.all(
|
|
481
|
+
Object.values(verbOptions).map(
|
|
482
|
+
(verbOption) => (0, import_zod.generateZod)(
|
|
483
|
+
verbOption,
|
|
484
|
+
{
|
|
485
|
+
route: verbOption.route,
|
|
486
|
+
pathRoute: verbOption.pathRoute,
|
|
487
|
+
override: output.override,
|
|
488
|
+
context,
|
|
489
|
+
mock: output.mock,
|
|
490
|
+
output: output.target
|
|
491
|
+
},
|
|
492
|
+
output.client
|
|
493
|
+
)
|
|
494
|
+
)
|
|
495
|
+
);
|
|
496
|
+
const allMutators = zods.reduce(
|
|
497
|
+
(acc, z) => {
|
|
498
|
+
var _a;
|
|
499
|
+
((_a = z.mutators) != null ? _a : []).forEach((mutator) => {
|
|
500
|
+
acc[mutator.name] = mutator;
|
|
501
|
+
});
|
|
502
|
+
return acc;
|
|
503
|
+
},
|
|
504
|
+
{}
|
|
505
|
+
);
|
|
506
|
+
const mutatorsImports = (0, import_core.generateMutatorImports)({
|
|
507
|
+
mutators: Object.values(allMutators)
|
|
508
|
+
});
|
|
509
|
+
let content = `${header}import { z as zod } from 'zod';
|
|
510
|
+
${mutatorsImports}
|
|
511
|
+
`;
|
|
512
|
+
const zodPath = import_core.upath.join(dirname, `tool-schemas.zod${extension}`);
|
|
513
|
+
content += zods.map((zod) => zod.implementation).join("\n");
|
|
514
|
+
return [
|
|
515
|
+
{
|
|
516
|
+
content,
|
|
517
|
+
path: zodPath
|
|
518
|
+
}
|
|
519
|
+
];
|
|
520
|
+
};
|
|
521
|
+
var generateHttpClinetFiles = async (verbOptions, output, context) => {
|
|
522
|
+
const { extension, dirname, filename } = (0, import_core.getFileInfo)(output.target);
|
|
523
|
+
const header = getHeader(
|
|
524
|
+
output.override.header,
|
|
525
|
+
context.specs[context.specKey].info
|
|
526
|
+
);
|
|
527
|
+
const clients = await Promise.all(
|
|
528
|
+
Object.values(verbOptions).map((verbOption) => {
|
|
529
|
+
const fullRoute = (0, import_core.getFullRoute)(
|
|
530
|
+
verbOption.route,
|
|
531
|
+
context.specs[context.specKey].servers,
|
|
532
|
+
output.baseUrl
|
|
533
|
+
);
|
|
534
|
+
const options = {
|
|
535
|
+
route: fullRoute,
|
|
536
|
+
pathRoute: verbOption.pathRoute,
|
|
537
|
+
override: output.override,
|
|
538
|
+
context,
|
|
539
|
+
mock: output.mock,
|
|
540
|
+
output: output.target
|
|
541
|
+
};
|
|
542
|
+
return (0, import_fetch.generateClient)(verbOption, options, output.client, output);
|
|
543
|
+
})
|
|
544
|
+
);
|
|
545
|
+
const clientImplementation = clients.map((client) => client.implementation).join("\n");
|
|
546
|
+
const relativeSchemasPath = output.schemas ? import_core.upath.relativeSafe(dirname, (0, import_core.getFileInfo)(output.schemas).dirname) : "./" + filename + ".schemas";
|
|
547
|
+
const importNames = clients.flatMap((client) => client.imports).reduce((acc, imp) => {
|
|
548
|
+
if (!acc.find((i) => i === imp.name)) {
|
|
549
|
+
acc.push(imp.name);
|
|
550
|
+
}
|
|
551
|
+
return acc;
|
|
552
|
+
}, []);
|
|
553
|
+
const importImplementation = `import { ${importNames.join(
|
|
554
|
+
",\n"
|
|
555
|
+
)} } from '${relativeSchemasPath}';`;
|
|
556
|
+
const fetchHeader = (0, import_fetch.generateFetchHeader)({
|
|
557
|
+
title: "",
|
|
558
|
+
isRequestOptions: false,
|
|
559
|
+
isMutator: false,
|
|
560
|
+
noFunction: false,
|
|
561
|
+
isGlobalMutator: false,
|
|
562
|
+
provideIn: false,
|
|
563
|
+
hasAwaitedType: false,
|
|
564
|
+
output,
|
|
565
|
+
verbOptions,
|
|
566
|
+
clientImplementation
|
|
567
|
+
});
|
|
568
|
+
const content = [
|
|
569
|
+
header,
|
|
570
|
+
importImplementation,
|
|
571
|
+
fetchHeader,
|
|
572
|
+
clientImplementation
|
|
573
|
+
].join("\n");
|
|
574
|
+
const outputPath = import_core.upath.join(dirname, `http-client${extension}`);
|
|
575
|
+
return [
|
|
576
|
+
{
|
|
577
|
+
content,
|
|
578
|
+
path: outputPath
|
|
579
|
+
}
|
|
580
|
+
];
|
|
581
|
+
};
|
|
582
|
+
var generateExtraFiles = async (verbOptions, output, context) => {
|
|
583
|
+
const [server, zods, httpClients] = await Promise.all([
|
|
584
|
+
generateServer(verbOptions, output, context),
|
|
585
|
+
generateZodFiles(verbOptions, output, context),
|
|
586
|
+
generateHttpClinetFiles(verbOptions, output, context)
|
|
587
|
+
]);
|
|
588
|
+
return [...server, ...zods, ...httpClients];
|
|
589
|
+
};
|
|
590
|
+
var mcpClientBuilder = {
|
|
591
|
+
client: generateMcp,
|
|
592
|
+
header: getMcpHeader,
|
|
593
|
+
extraFiles: generateExtraFiles
|
|
594
|
+
};
|
|
595
|
+
var builder = () => () => mcpClientBuilder;
|
|
596
|
+
var src_default = builder;
|
|
597
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
598
|
+
0 && (module.exports = {
|
|
599
|
+
builder,
|
|
600
|
+
generateExtraFiles,
|
|
601
|
+
generateMcp,
|
|
602
|
+
generateServer,
|
|
603
|
+
getMcpHeader
|
|
604
|
+
});
|
|
605
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../fetch/src/index.ts","../src/index.ts"],"sourcesContent":["import { ClientHeaderBuilder, pascal } from '@orval/core';\nimport {\n camel,\n ClientBuilder,\n ClientGeneratorsBuilder,\n generateFormDataAndUrlEncodedFunction,\n generateVerbImports,\n GeneratorOptions,\n GeneratorVerbOptions,\n GetterPropType,\n stringify,\n toObjectString,\n generateBodyOptions,\n isObject,\n resolveRef,\n} from '@orval/core';\nimport {\n PathItemObject,\n ParameterObject,\n ReferenceObject,\n} from 'openapi3-ts/oas30';\n\nexport const generateRequestFunction = (\n {\n queryParams,\n headers,\n operationName,\n response,\n mutator,\n body,\n props,\n verb,\n formData,\n formUrlEncoded,\n override,\n }: GeneratorVerbOptions,\n { route, context, pathRoute }: GeneratorOptions,\n) => {\n const isRequestOptions = override?.requestOptions !== false;\n const isFormData = override?.formData.disabled === false;\n const isFormUrlEncoded = override?.formUrlEncoded !== false;\n\n const getUrlFnName = camel(`get-${operationName}-url`);\n const getUrlFnProps = toObjectString(\n props.filter(\n (prop) =>\n prop.type === GetterPropType.PARAM ||\n prop.type === GetterPropType.NAMED_PATH_PARAMS ||\n prop.type === GetterPropType.QUERY_PARAM,\n ),\n 'implementation',\n );\n\n const spec = context.specs[context.specKey].paths[pathRoute] as\n | PathItemObject\n | undefined;\n const parameters =\n spec?.[verb]?.parameters || ([] as (ParameterObject | ReferenceObject)[]);\n\n const explodeParameters = parameters.filter((parameter) => {\n const { schema } = resolveRef<ParameterObject>(parameter, context);\n\n return schema.in === 'query' && schema.explode;\n });\n\n const explodeParametersNames = explodeParameters.map((parameter) => {\n const { schema } = resolveRef<ParameterObject>(parameter, context);\n\n return schema.name;\n });\n\n const explodeArrayImplementation =\n explodeParameters.length > 0\n ? `const explodeParameters = ${JSON.stringify(explodeParametersNames)};\n\n if (value instanceof Array && explodeParameters.includes(key)) {\n value.forEach((v) => normalizedParams.append(key, v === null ? 'null' : v.toString()));\n return;\n }\n `\n : '';\n\n const isExplodeParametersOnly =\n explodeParameters.length === parameters.length;\n\n const nomalParamsImplementation = `if (value !== undefined) {\n normalizedParams.append(key, value === null ? 'null' : value.toString())\n }`;\n\n const getUrlFnImplementation = `export const ${getUrlFnName} = (${getUrlFnProps}) => {\n${\n queryParams\n ? ` const normalizedParams = new URLSearchParams();\n\n Object.entries(params || {}).forEach(([key, value]) => {\n ${explodeArrayImplementation}\n ${!isExplodeParametersOnly ? nomalParamsImplementation : ''}\n });`\n : ''\n}\n\n ${queryParams ? `const stringifiedParams = normalizedParams.toString();` : ``}\n\n ${\n queryParams\n ? `return stringifiedParams.length > 0 ? \\`${route}${'?${stringifiedParams}'}\\` : \\`${route}\\``\n : `return \\`${route}\\``\n }\n}\\n`;\n\n const isContentTypeNdJson = (contentType: string) =>\n contentType === 'application/nd-json' ||\n contentType === 'application/x-ndjson';\n\n const isNdJson = response.contentTypes.some(isContentTypeNdJson);\n const responseTypeName = fetchResponseTypeName(\n override.fetch.includeHttpResponseReturnType,\n isNdJson ? 'Response' : response.definition.success,\n operationName,\n );\n\n const allResponses = [...response.types.success, ...response.types.errors];\n if (allResponses.length === 0) {\n allResponses.push({\n contentType: '',\n hasReadonlyProps: false,\n imports: [],\n isEnum: false,\n isRef: false,\n key: 'default',\n schemas: [],\n type: 'unknown',\n value: 'unknown',\n });\n }\n const nonDefaultStatuses = allResponses\n .filter((r) => r.key !== 'default')\n .map((r) => r.key);\n const responseDataTypes = allResponses\n .map(\n (r) => `export type ${responseTypeName}${pascal(r.key)} = {\n ${isContentTypeNdJson(r.contentType) ? 'stream: Response' : `data: ${r.value || 'unknown'}`}\n status: ${\n r.key === 'default'\n ? nonDefaultStatuses.length\n ? `Exclude<HTTPStatusCodes, ${nonDefaultStatuses.join(' | ')}>`\n : 'number'\n : r.key\n }\n}`,\n )\n .join('\\n\\n');\n\n const compositeName = `${responseTypeName}Composite`;\n const compositeResponse = `${compositeName} = ${allResponses.map((r) => `${responseTypeName}${pascal(r.key)}`).join(' | ')}`;\n\n const responseTypeImplementation = override.fetch\n .includeHttpResponseReturnType\n ? `${responseDataTypes}\n \nexport type ${compositeResponse};\n \nexport type ${responseTypeName} = ${compositeName} & {\n headers: Headers;\n}\\n\\n`\n : '';\n\n const getUrlFnProperties = props\n .filter(\n (prop) =>\n prop.type === GetterPropType.PARAM ||\n prop.type === GetterPropType.QUERY_PARAM ||\n prop.type === GetterPropType.NAMED_PATH_PARAMS,\n )\n .map((param) => {\n if (param.type === GetterPropType.NAMED_PATH_PARAMS) {\n return param.destructured;\n } else {\n return param.name;\n }\n })\n .join(',');\n\n const args = `${toObjectString(props, 'implementation')} ${isRequestOptions ? `options?: RequestInit` : ''}`;\n const returnType = `Promise<${responseTypeName}>`;\n\n const globalFetchOptions = isObject(override?.requestOptions)\n ? `${stringify(override?.requestOptions)?.slice(1, -1)?.trim()}`\n : '';\n const fetchMethodOption = `method: '${verb.toUpperCase()}'`;\n const ignoreContentTypes = ['multipart/form-data'];\n const fetchHeadersOption =\n body.contentType && !ignoreContentTypes.includes(body.contentType)\n ? `headers: { 'Content-Type': '${body.contentType}',${headers ? '...headers,' : ''} ...options?.headers }`\n : headers\n ? 'headers: {...headers, ...options?.headers}'\n : '';\n const requestBodyParams = generateBodyOptions(\n body,\n isFormData,\n isFormUrlEncoded,\n );\n const fetchBodyOption = requestBodyParams\n ? (isFormData && body.formData) || (isFormUrlEncoded && body.formUrlEncoded)\n ? `body: ${requestBodyParams}`\n : `body: JSON.stringify(${requestBodyParams})`\n : '';\n\n const fetchFnOptions = `${getUrlFnName}(${getUrlFnProperties}),\n {${globalFetchOptions ? '\\n' : ''} ${globalFetchOptions}\n ${isRequestOptions ? '...options,' : ''}\n ${fetchMethodOption}${fetchHeadersOption ? ',' : ''}\n ${fetchHeadersOption}${fetchBodyOption ? ',' : ''}\n ${fetchBodyOption}\n }\n`;\n const fetchResponseImplementation = isNdJson\n ? `const stream = await fetch(${fetchFnOptions})\n\n ${override.fetch.includeHttpResponseReturnType ? 'return { status: stream.status, stream, headers: stream.headers }' : `return stream`}\n `\n : `const res = await fetch(${fetchFnOptions})\n\n const body = [204, 205, 304].includes(res.status) ? null : await res.text()\n const data: ${responseTypeName}${override.fetch.includeHttpResponseReturnType ? `['data']` : ''} = body ? JSON.parse(body) : {}\n\n ${override.fetch.includeHttpResponseReturnType ? `return { data, status: res.status, headers: res.headers } as ${responseTypeName}` : 'return data'}\n`;\n const customFetchResponseImplementation = `return ${mutator?.name}<${responseTypeName}>(${fetchFnOptions});`;\n\n const bodyForm = generateFormDataAndUrlEncodedFunction({\n formData,\n formUrlEncoded,\n body,\n isFormData,\n isFormUrlEncoded,\n });\n\n const fetchImplementationBody = mutator\n ? customFetchResponseImplementation\n : fetchResponseImplementation;\n\n const fetchImplementation = `export const ${operationName} = async (${args}): ${returnType} => {\n ${bodyForm ? ` ${bodyForm}` : ''}\n ${fetchImplementationBody}}\n`;\n\n const implementation =\n `${responseTypeImplementation}` +\n `${getUrlFnImplementation}\\n` +\n `${fetchImplementation}\\n`;\n\n return implementation;\n};\n\nexport const fetchResponseTypeName = (\n includeHttpResponseReturnType: boolean,\n definitionSuccessResponse: string,\n operationName: string,\n) => {\n return includeHttpResponseReturnType\n ? `${operationName}Response`\n : definitionSuccessResponse;\n};\n\nexport const generateClient: ClientBuilder = (verbOptions, options) => {\n const imports = generateVerbImports(verbOptions);\n const functionImplementation = generateRequestFunction(verbOptions, options);\n\n return {\n implementation: `${functionImplementation}\\n`,\n imports,\n };\n};\n\nconst getHTTPStatusCodes = () => `\nexport type HTTPStatusCode1xx = 100 | 101 | 102 | 103;\nexport type HTTPStatusCode2xx = 200 | 201 | 202 | 203 | 204 | 205 | 206 | 207;\nexport type HTTPStatusCode3xx = 300 | 301 | 302 | 303 | 304 | 305 | 307 | 308;\nexport type HTTPStatusCode4xx = 400 | 401 | 402 | 403 | 404 | 405 | 406 | 407 | 408 | 409 | 410 | 411 | 412 | 413 | 414 | 415 | 416 | 417 | 418 | 419 | 420 | 421 | 422 | 423 | 424 | 426 | 428 | 429 | 431 | 451;\nexport type HTTPStatusCode5xx = 500 | 501 | 502 | 503 | 504 | 505 | 507 | 511;\nexport type HTTPStatusCodes = HTTPStatusCode1xx | HTTPStatusCode2xx | HTTPStatusCode3xx | HTTPStatusCode4xx | HTTPStatusCode5xx;\n\n`;\n\nexport const generateFetchHeader: ClientHeaderBuilder = ({\n clientImplementation,\n}) => {\n return clientImplementation.includes('<HTTPStatusCodes,')\n ? getHTTPStatusCodes()\n : '';\n};\n\nconst fetchClientBuilder: ClientGeneratorsBuilder = {\n client: generateClient,\n header: generateFetchHeader,\n dependencies: () => [],\n};\n\nexport const builder = () => () => fetchClientBuilder;\n\nexport default builder;\n","import {\n generateVerbImports,\n ClientBuilder,\n ClientExtraFilesBuilder,\n ClientGeneratorsBuilder,\n ClientHeaderBuilder,\n ContextSpecs,\n generateMutatorImports,\n GeneratorMutator,\n GeneratorVerbOptions,\n getFileInfo,\n jsDoc,\n NormalizedOutputOptions,\n upath,\n camel,\n pascal,\n getFullRoute,\n} from '@orval/core';\nimport { generateZod } from '@orval/zod';\nimport {\n generateRequestFunction as generateFetchRequestFunction,\n generateClient,\n generateFetchHeader,\n} from '@orval/fetch';\n\nimport { InfoObject } from 'openapi3-ts/oas30';\n\nconst getHeader = (\n option: false | ((info: InfoObject) => string | string[]),\n info: InfoObject,\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\nexport const getMcpHeader: ClientHeaderBuilder = ({\n verbOptions,\n output,\n clientImplementation,\n}) => {\n const targetInfo = getFileInfo(output.target);\n const schemaInfo = getFileInfo(output.schemas);\n\n const relativeSchemaImportPath = output.schemas\n ? upath.relativeSafe(targetInfo.dirname, schemaInfo.dirname)\n : './' + targetInfo.filename + '.schemas';\n\n const importSchemaNames = Object.values(verbOptions)\n .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.definition) {\n imports.push(`${pascalOperationName}Body`);\n }\n\n return imports;\n })\n .reduce((acc, name) => {\n if (!acc.find((i) => i === name)) {\n acc.push(name);\n }\n return acc;\n }, [] as string[]);\n\n const importSchemasImplementation = `import {\\n ${importSchemaNames.join(\n ',\\n ',\n )}\\n} from '${relativeSchemaImportPath}';\n`;\n\n const relativeFetchClientPath = './http-client';\n const importFetchClientNames = Object.values(verbOptions)\n .flatMap((verbOption) => verbOption.operationName)\n .reduce((acc, name) => {\n if (!acc.find((i) => i === name)) {\n acc.push(name);\n }\n\n return acc;\n }, [] as string[]);\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 = async (verbOptions, options) => {\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 = handlerArgsTypes.length\n ? `\nexport type ${handlerArgsName} = {\n${handlerArgsTypes.join('\\n')}\n}\n`\n : '';\n\n const fetchParams = [];\n if (verbOptions.params.length) {\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 ? `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 = async (\n verbOptions: Record<string, GeneratorVerbOptions>,\n output: NormalizedOutputOptions,\n context: ContextSpecs,\n) => {\n const info = context.specs[context.specKey].info;\n const { extension, dirname } = getFileInfo(output.target);\n const serverPath = upath.join(dirname, `server${extension}`);\n const header = getHeader(output.override.header, info);\n\n const toolImplementations = Object.values(verbOptions)\n .map((verbOption) => {\n const imputSchemaTypes = [];\n if (verbOption.params.length)\n imputSchemaTypes.push(\n ` pathParams: ${verbOption.operationName}Params`,\n );\n if (verbOption.queryParams)\n imputSchemaTypes.push(\n ` queryParams: ${verbOption.operationName}QueryParams`,\n );\n if (verbOption.body.definition)\n imputSchemaTypes.push(` bodyParams: ${verbOption.operationName}Body`);\n\n const imputSchemaImplementation = imputSchemaTypes.length\n ? ` {\n ${imputSchemaTypes.join(',\\n ')}\n },`\n : '';\n\n const toolImplementation = `\nserver.tool(\n '${verbOption.operationName}',\n '${verbOption.summary}',${imputSchemaImplementation ? `\\n${imputSchemaImplementation}` : ''}\n ${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 if (verbOption.headers)\n imports.push(` ${verbOption.operationName}Header`);\n if (verbOption.params.length)\n imports.push(` ${verbOption.operationName}Params`);\n if (verbOption.queryParams)\n imports.push(` ${verbOption.operationName}QueryParams`);\n if (verbOption.body.definition)\n imports.push(` ${verbOption.operationName}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: ContextSpecs,\n) => {\n const { extension, dirname, filename } = getFileInfo(output.target);\n\n const header = getHeader(\n output.override.header,\n context.specs[context.specKey].info,\n );\n\n const zods = await Promise.all(\n Object.values(verbOptions).map((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 = zods.reduce(\n (acc, z) => {\n (z.mutators ?? []).forEach((mutator) => {\n acc[mutator.name] = mutator;\n });\n return acc;\n },\n {} as Record<string, GeneratorMutator>,\n );\n\n const mutatorsImports = generateMutatorImports({\n mutators: Object.values(allMutators),\n });\n\n let content = `${header}import { z as zod } from 'zod';\\n${mutatorsImports}\\n`;\n\n const zodPath = upath.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 generateHttpClinetFiles = async (\n verbOptions: Record<string, GeneratorVerbOptions>,\n output: NormalizedOutputOptions,\n context: ContextSpecs,\n) => {\n const { extension, dirname, filename } = getFileInfo(output.target);\n\n const header = getHeader(\n output.override.header,\n context.specs[context.specKey].info,\n );\n\n const clients = await Promise.all(\n Object.values(verbOptions).map((verbOption) => {\n const fullRoute = getFullRoute(\n verbOption.route,\n context.specs[context.specKey].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 relativeSchemasPath = output.schemas\n ? upath.relativeSafe(dirname, getFileInfo(output.schemas).dirname)\n : './' + filename + '.schemas';\n const importNames = clients\n .flatMap((client) => client.imports)\n .reduce((acc, imp) => {\n if (!acc.find((i) => i === imp.name)) {\n acc.push(imp.name);\n }\n\n return acc;\n }, [] as string[]);\n const importImplementation = `import { ${importNames.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 = upath.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, zods, httpClients] = await Promise.all([\n generateServer(verbOptions, output, context),\n generateZodFiles(verbOptions, output, context),\n generateHttpClinetFiles(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":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,QAAAA,eAAA,CAAA;AAAA,IAAAC,UAAAD,cAAA;MAAA,SAAA,MAAAE;MAAA,SAAA,MAAAC;MAAA,uBAAA,MAAA;MAAA,gBAAA,MAAAC;MAAA,qBAAA,MAAAC;MAAA,yBAAA,MAAA;IAAA,CAAA;AAAA,IAAAC,QAAA,UAAAC,cAAAP,YAAA;AAAA,QAAAQ,eAA4C,QAAA,aAAA;AAC5C,QAAAA,gBAcO,QAAA,aAAA;AAOA,QAAM,0BAA0B,CACrC;MACE;MACA;MACA;MACA;MACA;MACA;MACA;MACA;MACA;MACA;MACA;IACF,GACA,EAAE,OAAO,SAAS,UAAU,MACzB;AArCL,UAAA,IAAA,IAAA;AAsCE,YAAM,oBAAmB,YAAA,OAAA,SAAA,SAAU,oBAAmB;AACtD,YAAM,cAAa,YAAA,OAAA,SAAA,SAAU,SAAS,cAAa;AACnD,YAAM,oBAAmB,YAAA,OAAA,SAAA,SAAU,oBAAmB;AAEtD,YAAM,gBAAA,GAAeC,cAAA,OAAM,OAAO,aAAa,MAAM;AACrD,YAAM,iBAAA,GAAgBA,cAAA;QACpB,MAAM;UACJ,CAAC,SACC,KAAK,SAASA,cAAA,eAAe,SAC7B,KAAK,SAASA,cAAA,eAAe,qBAC7B,KAAK,SAASA,cAAA,eAAe;QACjC;QACA;MACF;AAEA,YAAM,OAAO,QAAQ,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A,EAChD,QAAQ;AAAA,EACR,QAAQ;AAAA,EACR,YAAY;AACd;AAEO,IAAM,UAAU,MAAM,MAAM;AAEnC,IAAO,cAAQ;","names":["src_exports","__export","builder","src_default","generateClient","generateFetchHeader","module","__toCommonJS","import_core","import_core2"]}
|
package/package.json
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@orval/mcp",
|
|
3
|
+
"version": "7.9.0",
|
|
4
|
+
"license": "MIT",
|
|
5
|
+
"main": "./dist/index.js",
|
|
6
|
+
"types": "./dist/index.d.ts",
|
|
7
|
+
"files": [
|
|
8
|
+
"dist"
|
|
9
|
+
],
|
|
10
|
+
"scripts": {
|
|
11
|
+
"build": "tsup ./src/index.ts --target node12 --clean --dts --sourcemap",
|
|
12
|
+
"dev": "tsup ./src/index.ts --target node12 --clean --watch --sourcemap src",
|
|
13
|
+
"lint": "eslint src/**/*.ts"
|
|
14
|
+
},
|
|
15
|
+
"dependencies": {
|
|
16
|
+
"@orval/core": "7.9.0",
|
|
17
|
+
"@orval/zod": "7.9.0"
|
|
18
|
+
}
|
|
19
|
+
}
|