File tree Expand file tree Collapse file tree
crates/chat-cli/src/mcp_client Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -363,6 +363,16 @@ where
363363 } ,
364364 Err ( e) => {
365365 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+ }
366376 } ,
367377 }
368378 }
Original file line number Diff line number Diff line change @@ -51,7 +51,7 @@ impl JsonRpcStdioTransport {
5151 // Messages are delimited by newlines and assumed to contain no embedded newlines
5252 // See https://spec.modelcontextprotocol.io/specification/2024-11-05/basic/transports/#stdio
5353 match buf_reader. read_until ( b'\n' , & mut buffer) . await {
54- Ok ( 0 ) => continue ,
54+ Ok ( 0 ) => break ,
5555 Ok ( _) => match serde_json:: from_slice :: < JsonRpcMessage > ( buffer. as_slice ( ) ) {
5656 Ok ( msg) => {
5757 let _ = tx. send ( Ok ( msg) ) ;
You can’t perform that action at this time.
0 commit comments