Skip to content

Commit ed3dc52

Browse files
chore: minor changes
1 parent e69db07 commit ed3dc52

File tree

1 file changed

+10
-7
lines changed

1 file changed

+10
-7
lines changed

packages/core/src/muppet.ts

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ import {
88
SUPPORTED_PROTOCOL_VERSIONS,
99
} from "@modelcontextprotocol/sdk/types.js";
1010
import { Hono } from "hono";
11-
import { proxy } from "hono/proxy";
1211
import type { BlankEnv, BlankSchema, Env, Schema } from "hono/types";
1312
import type { Logger } from "pino";
1413
import type {
@@ -75,7 +74,7 @@ export async function muppet<
7574
},
7675
);
7776

78-
mcp.route("/tools", createToolsApp(serverConfiguration));
77+
mcp.route("/tools", createToolsApp(serverConfiguration, hono));
7978

8079
mcp.post("/notifications/initialized", (c) => {
8180
return c.body(null, 204);
@@ -242,7 +241,7 @@ export async function generateSpecs<
242241
return configuration;
243242
}
244243

245-
function createToolsApp(config: ServerConfiguration) {
244+
function createToolsApp(config: ServerConfiguration, hono: Hono) {
246245
const app = new Hono().use(async (_c, next) => {
247246
if (!(McpPrimitives.TOOLS in config)) {
248247
throw new Error("No tools available");
@@ -264,11 +263,15 @@ function createToolsApp(config: ServerConfiguration) {
264263

265264
const path = config.tools?.[params.name].path;
266265

267-
const res = await proxy(`http://muppet.mcp${path}`, {
268-
...c.req,
269-
}).then((res) => res.json());
266+
const res = await hono.fetch(
267+
new Request(`http://muppet.mcp${path}`, {
268+
...c.req.raw,
269+
}),
270+
);
271+
272+
const json = await res.json();
270273

271-
return c.json({ result: res });
274+
return c.json({ result: json });
272275
});
273276

274277
return app;

0 commit comments

Comments
 (0)