Skip to content

Commit 2e939ba

Browse files
committed
add clear logging to server
1 parent d32e7b6 commit 2e939ba

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

server/src/index.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,20 +19,26 @@ let transports: SSEServerTransport[] = [];
1919
app.get("/sse", async (req, res) => {
2020
console.log("New SSE connection");
2121
const transportType = req.query.transportType as string;
22+
console.log(`Transport type: ${transportType}`);
2223

2324
let backingServerTransport;
2425
console.log("Query parameters:", req.query);
2526

2627
if (transportType === "stdio") {
2728
const command = decodeURIComponent(req.query.command as string);
2829
const args = decodeURIComponent(req.query.args as string).split(",");
30+
console.log(`Stdio transport: command=${command}, args=${args}`);
2931
backingServerTransport = new StdioClientTransport();
3032
await backingServerTransport.spawn({ command, args });
33+
console.log("Spawned stdio transport");
3134
} else if (transportType === "sse") {
3235
const url = decodeURIComponent(req.query.url as string);
36+
console.log(`SSE transport: url=${url}`);
3337
backingServerTransport = new SSEClientTransport();
3438
await backingServerTransport.connect(new URL(url));
39+
console.log("Connected to SSE transport");
3540
} else {
41+
console.error(`Invalid transport type: ${transportType}`);
3642
throw new Error("Invalid transport type specified");
3743
}
3844

@@ -48,6 +54,7 @@ app.get("/sse", async (req, res) => {
4854
console.error(error);
4955
},
5056
});
57+
console.log("Set up MCP proxy");
5158
});
5259

5360
app.post("/message", async (req, res) => {

0 commit comments

Comments
 (0)