add support for streamable http server
This commit is contained in:
@@ -14,6 +14,7 @@ import {
|
||||
} from "@modelcontextprotocol/sdk/client/stdio.js";
|
||||
import { Transport } from "@modelcontextprotocol/sdk/shared/transport.js";
|
||||
import { SSEServerTransport } from "@modelcontextprotocol/sdk/server/sse.js";
|
||||
import { StreamableHTTPClientTransport } from '@modelcontextprotocol/sdk/client/streamableHttp.js';
|
||||
import express from "express";
|
||||
import { findActualExecutable } from "spawn-rx";
|
||||
import mcpProxy from "./mcpProxy.js";
|
||||
@@ -94,6 +95,11 @@ const createTransport = async (req: express.Request): Promise<Transport> => {
|
||||
|
||||
console.log("Connected to SSE transport");
|
||||
return transport;
|
||||
} else if (transportType === "streamable-http") {
|
||||
const transport = new StreamableHTTPClientTransport(new URL(query.url as string));
|
||||
await transport.start();
|
||||
console.log("Connected to Streamable HTTP transport");
|
||||
return transport;
|
||||
} else {
|
||||
console.error(`Invalid transport type: ${transportType}`);
|
||||
throw new Error("Invalid transport type specified");
|
||||
|
||||
Reference in New Issue
Block a user