FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

fix(client): catch httpx transport errors in streamable HTTP post_writer by devansh-dek · Pull Request #3025 · modelcontextprotocol/python-sdk · GitHub

fix(client): catch httpx transport errors in streamable HTTP post_writer - #3025

Open
devansh-dek wants to merge 1 commit into
modelcontextprotocol:mainfrom
devansh-dek:fix/915-streamable-http-unreachable-server
Open

fix(client): catch httpx transport errors in streamable HTTP post_writer#3025
devansh-dek wants to merge 1 commit into
modelcontextprotocol:mainfrom
devansh-dek:fix/915-streamable-http-unreachable-server

Conversation

devansh-dek commented Jun 30, 2026
edited
Loading

Copy link
Copy Markdown

Summary

  • Catch httpx.HTTPError inside streamable HTTP post_writer request tasks and reply with a JSON-RPC error on the read stream instead of letting the exception escape into the outer transport task group.
  • Fixes the uncatchable RuntimeError: Attempted to exit cancel scope in a different task than it was entered in when ClientSessionGroup.connect_to_server() targets an unreachable streamable HTTP server (Exception in ClientSessionGroup if streamable_http MCP server is not available #915).
  • Adds a regression test in tests/issues/test_915_streamable_http_unreachable.py.

Test plan

  • uv run pytest tests/issues/test_915_streamable_http_unreachable.py -v
  • uv run ruff check src/mcp/client/streamable_http.py tests/issues/test_915_streamable_http_unreachable.py

Fixes #915

When an unreachable streamable HTTP server causes httpx.HTTPError inside a
request task, complete the pending JSON-RPC waiter with an error response
instead of letting the exception crash the outer transport task group.

Fixes modelcontextprotocol#915

cubic-dev-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

No issues found across 2 files

Tip: cubic could auto-approve low-risk PRs like this, if it thinks it's safe to merge. Learn more

Re-trigger cubic

This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Exception in ClientSessionGroup if streamable_http MCP server is not available

1 participant


Back | FazBrowse Home | New Git URL