88 SUPPORTED_PROTOCOL_VERSIONS ,
99} from "@modelcontextprotocol/sdk/types.js" ;
1010import { Hono } from "hono" ;
11- import { proxy } from "hono/proxy" ;
1211import type { BlankEnv , BlankSchema , Env , Schema } from "hono/types" ;
1312import type { Logger } from "pino" ;
1413import 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