@@ -39,6 +39,7 @@ const createTransport = async (query: express.Request["query"]) => {
39
39
const command = query . command as string ;
40
40
const args = ( query . args as string ) . split ( / \s + / ) ;
41
41
const env = query . env ? JSON . parse ( query . env as string ) : undefined ;
42
+
42
43
console . log (
43
44
`Stdio transport: command=${ command } , args=${ args } , env=${ JSON . stringify ( env ) } ` ,
44
45
) ;
@@ -48,14 +49,18 @@ const createTransport = async (query: express.Request["query"]) => {
48
49
env,
49
50
stderr : "pipe" ,
50
51
} ) ;
52
+
51
53
await transport . start ( ) ;
54
+
52
55
console . log ( "Spawned stdio transport" ) ;
53
56
return transport ;
54
57
} else if ( transportType === "sse" ) {
55
58
const url = query . url as string ;
56
59
console . log ( `SSE transport: url=${ url } ` ) ;
60
+
57
61
const transport = new SSEClientTransport ( new URL ( url ) ) ;
58
62
await transport . start ( ) ;
63
+
59
64
console . log ( "Connected to SSE transport" ) ;
60
65
return transport ;
61
66
} else {
@@ -99,6 +104,7 @@ app.get("/sse", async (req, res) => {
99
104
console . error ( error ) ;
100
105
} ,
101
106
} ) ;
107
+
102
108
console . log ( "Set up MCP proxy" ) ;
103
109
} catch ( error ) {
104
110
console . error ( "Error in /sse route:" , error ) ;
@@ -126,6 +132,7 @@ app.post("/message", async (req, res) => {
126
132
app . get ( "/config" , ( req , res ) => {
127
133
try {
128
134
const defaultEnvironment = getDefaultEnvironment ( ) ;
135
+
129
136
res . json ( {
130
137
defaultEnvironment,
131
138
defaultCommand : values . env ,
@@ -138,4 +145,4 @@ app.get("/config", (req, res) => {
138
145
} ) ;
139
146
140
147
const PORT = process . env . PORT || 3000 ;
141
- app . listen ( PORT , ( ) => { } ) ;
148
+ app . listen ( PORT , ( ) => { } ) ;
0 commit comments