File tree Expand file tree Collapse file tree 2 files changed +11
-1
lines changed
crates/chat-cli/src/mcp_client Expand file tree Collapse file tree 2 files changed +11
-1
lines changed Original file line number Diff line number Diff line change @@ -363,6 +363,16 @@ where
363
363
} ,
364
364
Err ( e) => {
365
365
tracing:: error!( "Background listening thread for client {}: {:?}" , server_name, e) ;
366
+ // If we don't have anything on the other end, we should just end the task
367
+ // now
368
+ if let TransportError :: RecvError ( tokio:: sync:: broadcast:: error:: RecvError :: Closed ) = e {
369
+ tracing:: error!(
370
+ "All senders dropped for transport layer for server {}: {:?}. This likely means the mcp server process is no longer running." ,
371
+ server_name,
372
+ e
373
+ ) ;
374
+ break ;
375
+ }
366
376
} ,
367
377
}
368
378
}
Original file line number Diff line number Diff line change @@ -51,7 +51,7 @@ impl JsonRpcStdioTransport {
51
51
// Messages are delimited by newlines and assumed to contain no embedded newlines
52
52
// See https://spec.modelcontextprotocol.io/specification/2024-11-05/basic/transports/#stdio
53
53
match buf_reader. read_until ( b'\n' , & mut buffer) . await {
54
- Ok ( 0 ) => continue ,
54
+ Ok ( 0 ) => break ,
55
55
Ok ( _) => match serde_json:: from_slice :: < JsonRpcMessage > ( buffer. as_slice ( ) ) {
56
56
Ok ( msg) => {
57
57
let _ = tx. send ( Ok ( msg) ) ;
You can’t perform that action at this time.
0 commit comments