Skip to content

Commit 638603c

Browse files
committed
add support for streamable http server
1 parent a3a1ad4 commit 638603c

File tree

4 files changed

+13
-6
lines changed

4 files changed

+13
-6
lines changed

client/src/App.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,9 +79,9 @@ const App = () => {
7979
const [sseUrl, setSseUrl] = useState<string>(() => {
8080
return localStorage.getItem("lastSseUrl") || "http://localhost:3001/sse";
8181
});
82-
const [transportType, setTransportType] = useState<"stdio" | "sse">(() => {
82+
const [transportType, setTransportType] = useState<"stdio" | "sse" | "streamable-http">(() => {
8383
return (
84-
(localStorage.getItem("lastTransportType") as "stdio" | "sse") || "stdio"
84+
(localStorage.getItem("lastTransportType") as "stdio" | "sse" | "streamable-http") || "stdio"
8585
);
8686
});
8787
const [logLevel, setLogLevel] = useState<LoggingLevel>("debug");

client/src/components/Sidebar.tsx

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,8 @@ import {
3939

4040
interface SidebarProps {
4141
connectionStatus: ConnectionStatus;
42-
transportType: "stdio" | "sse";
43-
setTransportType: (type: "stdio" | "sse") => void;
42+
transportType: "stdio" | "sse" | "streamable-http";
43+
setTransportType: (type: "stdio" | "sse" | "streamable-http") => void;
4444
command: string;
4545
setCommand: (command: string) => void;
4646
args: string;
@@ -111,7 +111,7 @@ const Sidebar = ({
111111
</label>
112112
<Select
113113
value={transportType}
114-
onValueChange={(value: "stdio" | "sse") =>
114+
onValueChange={(value: "stdio" | "sse" | "streamable-http") =>
115115
setTransportType(value)
116116
}
117117
>
@@ -121,6 +121,7 @@ const Sidebar = ({
121121
<SelectContent>
122122
<SelectItem value="stdio">STDIO</SelectItem>
123123
<SelectItem value="sse">SSE</SelectItem>
124+
<SelectItem value="streamable-http">Streamable HTTP</SelectItem>
124125
</SelectContent>
125126
</Select>
126127
</div>

client/src/lib/hooks/useConnection.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ import { getMCPServerRequestTimeout } from "@/utils/configUtils";
4242
import { InspectorConfig } from "../configurationTypes";
4343

4444
interface UseConnectionOptions {
45-
transportType: "stdio" | "sse";
45+
transportType: "stdio" | "sse" | "streamable-http";
4646
command: string;
4747
args: string;
4848
sseUrl: string;

server/src/index.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ import {
1414
} from "@modelcontextprotocol/sdk/client/stdio.js";
1515
import { Transport } from "@modelcontextprotocol/sdk/shared/transport.js";
1616
import { SSEServerTransport } from "@modelcontextprotocol/sdk/server/sse.js";
17+
import { StreamableHTTPClientTransport } from '@modelcontextprotocol/sdk/client/streamableHttp.js';
1718
import express from "express";
1819
import { findActualExecutable } from "spawn-rx";
1920
import mcpProxy from "./mcpProxy.js";
@@ -94,6 +95,11 @@ const createTransport = async (req: express.Request): Promise<Transport> => {
9495

9596
console.log("Connected to SSE transport");
9697
return transport;
98+
} else if (transportType === "streamable-http") {
99+
const transport = new StreamableHTTPClientTransport(new URL(query.url as string));
100+
await transport.start();
101+
console.log("Connected to Streamable HTTP transport");
102+
return transport;
97103
} else {
98104
console.error(`Invalid transport type: ${transportType}`);
99105
throw new Error("Invalid transport type specified");

0 commit comments

Comments
 (0)