@forklaunch/core 0.11.3 → 0.11.5
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/lib/http/index.d.mts +2 -2
- package/lib/http/index.d.ts +2 -2
- package/lib/http/index.js +13 -12
- package/lib/http/index.js.map +1 -1
- package/lib/http/index.mjs +13 -12
- package/lib/http/index.mjs.map +1 -1
- package/package.json +8 -8
package/lib/http/index.mjs
CHANGED
@@ -2500,7 +2500,7 @@ var httpStatusCodes_default = HTTPStatuses;
|
|
2500
2500
|
// src/http/mcpGenerator/mcpGenerator.ts
|
2501
2501
|
import { isNever as isNever3, isRecord, safeStringify as safeStringify2 } from "@forklaunch/common";
|
2502
2502
|
import { string, ZodSchemaValidator } from "@forklaunch/validator/zod";
|
2503
|
-
import {
|
2503
|
+
import { FastMCP } from "fastmcp";
|
2504
2504
|
|
2505
2505
|
// src/http/router/unpackRouters.ts
|
2506
2506
|
import { toPrettyCamelCase as toPrettyCamelCase2 } from "@forklaunch/common";
|
@@ -2529,14 +2529,15 @@ function unpackRouters(routers, recursiveBasePath = [], recursiveSdkPath = []) {
|
|
2529
2529
|
}
|
2530
2530
|
|
2531
2531
|
// src/http/mcpGenerator/mcpGenerator.ts
|
2532
|
-
function generateMcpServer(schemaValidator, protocol, host, port, version, routers, contentTypeMap) {
|
2532
|
+
function generateMcpServer(schemaValidator, protocol, host, port, version, routers, options2, contentTypeMap) {
|
2533
2533
|
if (!(schemaValidator instanceof ZodSchemaValidator)) {
|
2534
2534
|
throw new Error(
|
2535
2535
|
"Schema validator must be an instance of ZodSchemaValidator"
|
2536
2536
|
);
|
2537
2537
|
}
|
2538
|
-
const mcpServer = new
|
2539
|
-
|
2538
|
+
const mcpServer = new FastMCP({
|
2539
|
+
...options2,
|
2540
|
+
name: options2?.name ?? "mcp-server",
|
2540
2541
|
version
|
2541
2542
|
});
|
2542
2543
|
unpackRouters(routers).forEach(({ fullPath, router }) => {
|
@@ -2548,7 +2549,7 @@ function generateMcpServer(schemaValidator, protocol, host, port, version, route
|
|
2548
2549
|
route.contractDetails.body
|
2549
2550
|
);
|
2550
2551
|
}
|
2551
|
-
const inputSchema = {
|
2552
|
+
const inputSchema = schemaValidator.schemify({
|
2552
2553
|
...discriminatedBody && "body" in route.contractDetails ? {
|
2553
2554
|
..."contentType" in route.contractDetails.body ? { contentType: route.contractDetails.body.contentType } : {},
|
2554
2555
|
body: schemaValidator.schemify(discriminatedBody.schema)
|
@@ -2565,12 +2566,12 @@ function generateMcpServer(schemaValidator, protocol, host, port, version, route
|
|
2565
2566
|
} : {}
|
2566
2567
|
})
|
2567
2568
|
} : {}
|
2568
|
-
};
|
2569
|
-
mcpServer.
|
2570
|
-
route.contractDetails.name,
|
2571
|
-
route.contractDetails.summary,
|
2572
|
-
inputSchema,
|
2573
|
-
async (args) => {
|
2569
|
+
});
|
2570
|
+
mcpServer.addTool({
|
2571
|
+
name: route.contractDetails.name,
|
2572
|
+
description: route.contractDetails.summary,
|
2573
|
+
parameters: inputSchema,
|
2574
|
+
execute: async (args) => {
|
2574
2575
|
const { contentType, body, params, query, headers } = args;
|
2575
2576
|
let url = `${protocol}://${host}:${port}${fullPath}${route.path}`;
|
2576
2577
|
if (params) {
|
@@ -2704,7 +2705,7 @@ function generateMcpServer(schemaValidator, protocol, host, port, version, route
|
|
2704
2705
|
};
|
2705
2706
|
}
|
2706
2707
|
}
|
2707
|
-
);
|
2708
|
+
});
|
2708
2709
|
});
|
2709
2710
|
});
|
2710
2711
|
return mcpServer;
|