@@ -19,20 +19,26 @@ let transports: SSEServerTransport[] = [];
19
19
app . get ( "/sse" , async ( req , res ) => {
20
20
console . log ( "New SSE connection" ) ;
21
21
const transportType = req . query . transportType as string ;
22
+ console . log ( `Transport type: ${ transportType } ` ) ;
22
23
23
24
let backingServerTransport ;
24
25
console . log ( "Query parameters:" , req . query ) ;
25
26
26
27
if ( transportType === "stdio" ) {
27
28
const command = decodeURIComponent ( req . query . command as string ) ;
28
29
const args = decodeURIComponent ( req . query . args as string ) . split ( "," ) ;
30
+ console . log ( `Stdio transport: command=${ command } , args=${ args } ` ) ;
29
31
backingServerTransport = new StdioClientTransport ( ) ;
30
32
await backingServerTransport . spawn ( { command, args } ) ;
33
+ console . log ( "Spawned stdio transport" ) ;
31
34
} else if ( transportType === "sse" ) {
32
35
const url = decodeURIComponent ( req . query . url as string ) ;
36
+ console . log ( `SSE transport: url=${ url } ` ) ;
33
37
backingServerTransport = new SSEClientTransport ( ) ;
34
38
await backingServerTransport . connect ( new URL ( url ) ) ;
39
+ console . log ( "Connected to SSE transport" ) ;
35
40
} else {
41
+ console . error ( `Invalid transport type: ${ transportType } ` ) ;
36
42
throw new Error ( "Invalid transport type specified" ) ;
37
43
}
38
44
@@ -48,6 +54,7 @@ app.get("/sse", async (req, res) => {
48
54
console . error ( error ) ;
49
55
} ,
50
56
} ) ;
57
+ console . log ( "Set up MCP proxy" ) ;
51
58
} ) ;
52
59
53
60
app . post ( "/message" , async ( req , res ) => {
0 commit comments