File tree Expand file tree Collapse file tree 2 files changed +16
-3
lines changed
Expand file tree Collapse file tree 2 files changed +16
-3
lines changed Original file line number Diff line number Diff line change 88 Github ,
99 Eye ,
1010 EyeOff ,
11+ RotateCcw ,
1112 Settings ,
1213} from "lucide-react" ;
1314import { Button } from "@/components/ui/button" ;
@@ -375,8 +376,17 @@ const Sidebar = ({
375376
376377 < div className = "space-y-2" >
377378 < Button className = "w-full" onClick = { onConnect } >
378- < Play className = "w-4 h-4 mr-2" />
379- Connect
379+ { connectionStatus === "connected" ? (
380+ < >
381+ < RotateCcw className = "w-4 h-4 mr-2" />
382+ { transportType === "stdio" ? "Restart" : "Reconnect" }
383+ </ >
384+ ) : (
385+ < >
386+ < Play className = "w-4 h-4 mr-2" />
387+ Connect
388+ </ >
389+ ) }
380390 </ Button >
381391
382392 < div className = "flex items-center justify-center space-x-2 mb-4" >
Original file line number Diff line number Diff line change @@ -12,6 +12,7 @@ import {
1212 StdioClientTransport ,
1313 getDefaultEnvironment ,
1414} from "@modelcontextprotocol/sdk/client/stdio.js" ;
15+ import { Transport } from "@modelcontextprotocol/sdk/shared/transport.js" ;
1516import { SSEServerTransport } from "@modelcontextprotocol/sdk/server/sse.js" ;
1617import express from "express" ;
1718import { findActualExecutable } from "spawn-rx" ;
@@ -98,12 +99,14 @@ const createTransport = async (req: express.Request) => {
9899 }
99100} ;
100101
102+ let backingServerTransport : Transport | undefined ;
103+
101104app . get ( "/sse" , async ( req , res ) => {
102105 try {
103106 console . log ( "New SSE connection" ) ;
104107
105- let backingServerTransport ;
106108 try {
109+ await backingServerTransport ?. close ( ) ;
107110 backingServerTransport = await createTransport ( req ) ;
108111 } catch ( error ) {
109112 if ( error instanceof SseError && error . code === 401 ) {
You can’t perform that action at this time.
0 commit comments