From 353d6b549bfbb0c64f995350a95674b288c42075 Mon Sep 17 00:00:00 2001 From: Simon Knott Date: Thu, 27 Mar 2025 09:52:35 +0100 Subject: [PATCH 1/3] fix: clean up previous transport processes --- client/src/components/Sidebar.tsx | 14 ++++++++++++-- server/src/index.ts | 5 ++++- 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/client/src/components/Sidebar.tsx b/client/src/components/Sidebar.tsx index 4f60a77..6c9f137 100644 --- a/client/src/components/Sidebar.tsx +++ b/client/src/components/Sidebar.tsx @@ -8,6 +8,7 @@ import { Github, Eye, EyeOff, + RotateCcw, } from "lucide-react"; import { Button } from "@/components/ui/button"; import { Input } from "@/components/ui/input"; @@ -286,8 +287,17 @@ const Sidebar = ({
diff --git a/server/src/index.ts b/server/src/index.ts index 2a4fe65..d4bfc6a 100644 --- a/server/src/index.ts +++ b/server/src/index.ts @@ -12,6 +12,7 @@ import { StdioClientTransport, getDefaultEnvironment, } from "@modelcontextprotocol/sdk/client/stdio.js"; +import { Transport } from "@modelcontextprotocol/sdk/shared/transport.js"; import { SSEServerTransport } from "@modelcontextprotocol/sdk/server/sse.js"; import express from "express"; import { findActualExecutable } from "spawn-rx"; @@ -98,12 +99,14 @@ const createTransport = async (req: express.Request) => { } }; +let backingServerTransport: Transport | undefined; + app.get("/sse", async (req, res) => { try { console.log("New SSE connection"); - let backingServerTransport; try { + await backingServerTransport?.close(); backingServerTransport = await createTransport(req); } catch (error) { if (error instanceof SseError && error.code === 401) { From da0c855ef5eb88996adb09d25b244a1824c12f9c Mon Sep 17 00:00:00 2001 From: Simon Knott Date: Fri, 28 Mar 2025 09:45:17 +0100 Subject: [PATCH 2/3] adapt title --- client/src/components/Sidebar.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/client/src/components/Sidebar.tsx b/client/src/components/Sidebar.tsx index 6c9f137..6e59084 100644 --- a/client/src/components/Sidebar.tsx +++ b/client/src/components/Sidebar.tsx @@ -290,7 +290,7 @@ const Sidebar = ({ {connectionStatus === "connected" ? ( <> - Restart + {transportType === 'stdio' ? 'Restart' : 'Reconnect'} ) : ( <> From 538fc97289829804bdb9e0d0889de1e4f1f49b0c Mon Sep 17 00:00:00 2001 From: Simon Knott Date: Mon, 31 Mar 2025 18:10:16 +0200 Subject: [PATCH 3/3] fix prettier --- client/src/components/Sidebar.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/client/src/components/Sidebar.tsx b/client/src/components/Sidebar.tsx index 90471d5..33e88a7 100644 --- a/client/src/components/Sidebar.tsx +++ b/client/src/components/Sidebar.tsx @@ -379,7 +379,7 @@ const Sidebar = ({ {connectionStatus === "connected" ? ( <> - {transportType === 'stdio' ? 'Restart' : 'Reconnect'} + {transportType === "stdio" ? "Restart" : "Reconnect"} ) : ( <>