HTTP transport swallows non-2xx status codes causing client to hang
まだ誰も着手していません。
評価
調査の方向性
まず、src/mcp/client/streamable_http.py、特に post_writer と、src/mcp/client/sse.py、特に sse_reader のエラーハンドリングを追跡します。型付きエラーの設計について、関連する issue #1742 を確認します。非2xxレスポンスが例外として呼び出し元に到達し、HTTPステータスを保持し、401/403を区別し、呼び出し元が無期限に待ち続けることがなくなれば完了です。
索引モデルが issue の本文から書いたものです。
説明
Summary
When an MCP server returns non-2xx HTTP status codes (401/403/404/5xx), the Streamable HTTP and SSE transports do not reliably propagate the error to the caller. In the Streamable HTTP transport, post_writer catches exceptions and logs them, but the caller blocks indefinitely waiting for a response on the read stream. HTTP 404 responses are also converted to JSONRPCError(code=32600), losing the original HTTP status information.
Expected Behavior
- Non-2xx HTTP responses should be surfaced as exceptions to the caller, not silently logged
- The original HTTP status code should be preserved and accessible
- Auth-related errors (401/403) should be distinguishable from other failures
Current Behavior
post_writerin Streamable HTTP transport catches and logs errors without forwarding them through the read stream- Callers hang indefinitely waiting for a response
- HTTP 404 is converted to
JSONRPCError(code=32600), destroying HTTP-level context
Affected Code
src/mcp/client/streamable_http.py(post_writer)src/mcp/client/sse.py(sse_reader)
Related
- #1742 — broader typed error classes design
- 主要言語
- Python
- スター
- 24.3k
- フォーク
- 4k
- 平均マージ
- 1日 19分
- マージ済み PR(30日)
- 29
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
modelcontextprotocol/python-sdk のほかの issue
-
v1 v2
難易度 2/5 1〜3時間 初心者へのやさしさ 85/100
modelcontextprotocol/python-sdk#3546 · コメント 5 件 ·
-
v1 v2
難易度 2/5 1〜3時間 初心者へのやさしさ 76/100
modelcontextprotocol/python-sdk#3545 · コメント 1 件 ·
-
v1 v2
難易度 1/5 1時間未満 初心者へのやさしさ 91/100
modelcontextprotocol/python-sdk#3508 · コメント 2 件 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 64/100
modelcontextprotocol/python-sdk#3504 ·
-
v1 v2
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
modelcontextprotocol/python-sdk#3492 · コメント 1 件 ·
modelcontextprotocol/python-sdk の issue をすべて見る
似ている issue
-
fix: inaccuracy ⚠️
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
uabrc/uabrc.github.io#1255 · コメント 1 件 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 84/100
ethereum-optimism/factory#64 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 90/100
duckdb/duckdb-python#627 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
-
documentation
難易度 1/5 1時間未満 初心者へのやさしさ 78/100
Qiskit/qiskit-addon-sqd#376 ·