added streamable-http as a valid connection type in the constructTransport case statement

This commit is contained in:
Maxx Rodriguez 2025-05-24 10:10:37 -07:00
parent 5503beb8b3
commit fcc90c9947

View file

@ -4,6 +4,7 @@ import { Transport } from "@modelcontextprotocol/sdk/shared/transport.js";
import { SSEClientTransport } from "@modelcontextprotocol/sdk/client/sse.js";
import { StdioClientTransport } from "@modelcontextprotocol/sdk/client/stdio.js";
import { WebSocketClientTransport } from "@modelcontextprotocol/sdk/client/websocket.js";
import { StreamableHTTPClientTransport } from "@modelcontextprotocol/sdk/client/streamableHttp.js";
import {
MCPConnectionStatus,
@ -307,6 +308,10 @@ class MCPConnection {
},
requestInit: { headers: options.transport.requestOptions?.headers },
});
case "streamable-http":
return new StreamableHTTPClientTransport(new URL(options.transport.url), {
requestInit: { headers: options.transport.requestOptions?.headers },
});
default:
throw new Error(
`Unsupported transport type: ${(options.transport as any).type}`,