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 8
8
Github ,
9
9
Eye ,
10
10
EyeOff ,
11
+ RotateCcw ,
11
12
Settings ,
12
13
} from "lucide-react" ;
13
14
import { Button } from "@/components/ui/button" ;
@@ -375,8 +376,17 @@ const Sidebar = ({
375
376
376
377
< div className = "space-y-2" >
377
378
< 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
+ ) }
380
390
</ Button >
381
391
382
392
< 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 {
12
12
StdioClientTransport ,
13
13
getDefaultEnvironment ,
14
14
} from "@modelcontextprotocol/sdk/client/stdio.js" ;
15
+ import { Transport } from "@modelcontextprotocol/sdk/shared/transport.js" ;
15
16
import { SSEServerTransport } from "@modelcontextprotocol/sdk/server/sse.js" ;
16
17
import express from "express" ;
17
18
import { findActualExecutable } from "spawn-rx" ;
@@ -98,12 +99,14 @@ const createTransport = async (req: express.Request) => {
98
99
}
99
100
} ;
100
101
102
+ let backingServerTransport : Transport | undefined ;
103
+
101
104
app . get ( "/sse" , async ( req , res ) => {
102
105
try {
103
106
console . log ( "New SSE connection" ) ;
104
107
105
- let backingServerTransport ;
106
108
try {
109
+ await backingServerTransport ?. close ( ) ;
107
110
backingServerTransport = await createTransport ( req ) ;
108
111
} catch ( error ) {
109
112
if ( error instanceof SseError && error . code === 401 ) {
You can’t perform that action at this time.
0 commit comments