updates for sdk update

This commit is contained in:
Ashwin Bhat
2024-10-16 16:14:33 -07:00
parent 23ca80ed66
commit c6a11422f4
3 changed files with 12 additions and 11 deletions

View File

@@ -25,15 +25,15 @@ const createTransport = async (query: express.Request["query"]) => {
const command = query.command as string;
const args = (query.args as string).split(",");
console.log(`Stdio transport: command=${command}, args=${args}`);
const transport = new StdioClientTransport();
await transport.spawn({ command, args });
const transport = new StdioClientTransport({ command, args });
await transport.start();
console.log("Spawned stdio transport");
return transport;
} else if (transportType === "sse") {
const url = query.url as string;
console.log(`SSE transport: url=${url}`);
const transport = new SSEClientTransport();
await transport.connect(new URL(url));
const transport = new SSEClientTransport(new URL(url));
await transport.start();
console.log("Connected to SSE transport");
return transport;
} else {
@@ -49,13 +49,13 @@ app.get("/sse", async (req, res) => {
console.log("Connected MCP client to backing server transport");
const webAppTransport = new SSEServerTransport("/message");
const webAppTransport = new SSEServerTransport("/message", res);
console.log("Created web app transport");
webAppTransports.push(webAppTransport);
console.log("Created web app transport");
await webAppTransport.connectSSE(req, res);
await webAppTransport.start();
mcpProxy({
transportToClient: webAppTransport,