We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 62eb08e commit 7fe7ae6Copy full SHA for 7fe7ae6
1 file changed
src/mcp/client/streamable_http.py
@@ -466,11 +466,17 @@ async def post_writer(
466
read_stream_writer=read_stream_writer,
467
)
468
469
- async def handle_request_async():
470
- if is_resumption:
471
- await self._handle_resumption_request(ctx)
472
- else:
473
- await self._handle_post_request(ctx)
+ async def handle_request_async() -> None:
+ try:
+ if is_resumption:
+ await self._handle_resumption_request(ctx)
+ else:
474
+ await self._handle_post_request(ctx)
475
+ except anyio.get_cancelled_exc_class():
476
+ raise
477
+ except BaseException as exc:
478
+ with contextlib.suppress(Exception):
479
+ await read_stream_writer.send(exc)
480
481
# If this is a request, start a new task to handle it
482
if isinstance(message, JSONRPCRequest):
0 commit comments