We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 9a844a9 commit c3b70b0Copy full SHA for c3b70b0
src/mcp/shared/session.py
@@ -418,6 +418,10 @@ async def _receive_loop(self) -> None:
418
# Without this handler, the exception would propagate up and
419
# crash the server's task group.
420
logging.debug("Read stream closed by client")
421
+ except Exception as e:
422
+ # Other exceptions are not expected and should be logged. We purposefully
423
+ # catch all exceptions here to avoid crashing the server.
424
+ logging.exception(f"Unhandled exception in receive loop: {e}")
425
finally:
426
# after the read stream is closed, we need to send errors
427
# to any pending requests
0 commit comments