@@ -58,7 +58,7 @@ def send_notification(method, params = nil, session_id: nil)
5858 begin
5959 send_to_stream ( session [ :stream ] , notification )
6060 true
61- rescue IOError , Errno ::EPIPE => e
61+ rescue IOError , Errno ::EPIPE , Errno :: ECONNRESET => e
6262 MCP . configuration . exception_reporter . call (
6363 e ,
6464 { session_id : session_id , error : "Failed to send notification" } ,
@@ -77,7 +77,7 @@ def send_notification(method, params = nil, session_id: nil)
7777 begin
7878 send_to_stream ( session [ :stream ] , notification )
7979 sent_count += 1
80- rescue IOError , Errno ::EPIPE => e
80+ rescue IOError , Errno ::EPIPE , Errno :: ECONNRESET => e
8181 MCP . configuration . exception_reporter . call (
8282 e ,
8383 { session_id : sid , error : "Failed to send notification" } ,
@@ -289,7 +289,7 @@ def send_response_to_stream(stream, response, session_id)
289289 message = JSON . parse ( response )
290290 send_to_stream ( stream , message )
291291 [ 200 , { "Content-Type" => "application/json" } , [ { accepted : true } . to_json ] ]
292- rescue IOError , Errno ::EPIPE => e
292+ rescue IOError , Errno ::EPIPE , Errno :: ECONNRESET => e
293293 MCP . configuration . exception_reporter . call (
294294 e ,
295295 { session_id : session_id , error : "Stream closed during response" } ,
@@ -366,7 +366,7 @@ def send_keepalive_ping(session_id)
366366 send_ping_to_stream ( @sessions [ session_id ] [ :stream ] )
367367 end
368368 end
369- rescue IOError , Errno ::EPIPE => e
369+ rescue IOError , Errno ::EPIPE , Errno :: ECONNRESET => e
370370 MCP . configuration . exception_reporter . call (
371371 e ,
372372 { session_id : session_id , error : "Stream closed" } ,
0 commit comments