We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent ef4e167 commit c4e95fcCopy full SHA for c4e95fc
1 file changed
src/mcp/client/streamable_http.py
@@ -399,10 +399,17 @@ async def post_writer(
399
)
400
401
async def handle_request_async():
402
- if is_resumption:
403
- await self._handle_resumption_request(ctx)
404
- else:
405
- await self._handle_post_request(ctx)
+ try:
+ if is_resumption:
+ await self._handle_resumption_request(ctx)
+ else:
406
+ await self._handle_post_request(ctx)
407
+ except Exception as e:
408
+ # Send exception to main session for proper error handling
409
410
+ await ctx.read_stream_writer.send(e)
411
412
+ logger.exception(f"Failed to send exception to read stream: {e}")
413
414
# If this is a request, start a new task to handle it
415
if isinstance(message.root, JSONRPCRequest):
0 commit comments