@@ -39,6 +39,7 @@ const createTransport = async (query: express.Request["query"]) => {
3939 const command = query . command as string ;
4040 const args = ( query . args as string ) . split ( / \s + / ) ;
4141 const env = query . env ? JSON . parse ( query . env as string ) : undefined ;
42+
4243 console . log (
4344 `Stdio transport: command=${ command } , args=${ args } , env=${ JSON . stringify ( env ) } ` ,
4445 ) ;
@@ -48,14 +49,18 @@ const createTransport = async (query: express.Request["query"]) => {
4849 env,
4950 stderr : "pipe" ,
5051 } ) ;
52+
5153 await transport . start ( ) ;
54+
5255 console . log ( "Spawned stdio transport" ) ;
5356 return transport ;
5457 } else if ( transportType === "sse" ) {
5558 const url = query . url as string ;
5659 console . log ( `SSE transport: url=${ url } ` ) ;
60+
5761 const transport = new SSEClientTransport ( new URL ( url ) ) ;
5862 await transport . start ( ) ;
63+
5964 console . log ( "Connected to SSE transport" ) ;
6065 return transport ;
6166 } else {
@@ -99,6 +104,7 @@ app.get("/sse", async (req, res) => {
99104 console . error ( error ) ;
100105 } ,
101106 } ) ;
107+
102108 console . log ( "Set up MCP proxy" ) ;
103109 } catch ( error ) {
104110 console . error ( "Error in /sse route:" , error ) ;
@@ -126,6 +132,7 @@ app.post("/message", async (req, res) => {
126132app . get ( "/config" , ( req , res ) => {
127133 try {
128134 const defaultEnvironment = getDefaultEnvironment ( ) ;
135+
129136 res . json ( {
130137 defaultEnvironment,
131138 defaultCommand : values . env ,
@@ -138,4 +145,4 @@ app.get("/config", (req, res) => {
138145} ) ;
139146
140147const PORT = process . env . PORT || 3000 ;
141- app . listen ( PORT , ( ) => { } ) ;
148+ app . listen ( PORT , ( ) => { } ) ;
0 commit comments