Client transports/sessions swallow the original exception; applications cannot classify 401/403/429 transport failures
Dieses Issue hat noch niemand übernommen.
Bewertung
- Schwierigkeit
- 3/5
- Geschätzter Aufwand
- 1-2 Tage
- Anfängerfreundlichkeit
- 55/100
Rechercherichtung
Look at the client transport and session code handling HTTP requests, likely in modules like mcp/client/transports or mcp/client/session. The issue mentions SSE/streamable-HTTP transports and httpx.HTTPStatusError. Start by finding where exceptions are caught and logged, and where the stream is closed. The goal is to modify the error propagation so the original exception reaches send_request callers. Testing will involve simulating transport failures (401, 403, 429) to verify the exception is correctly delivered.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Beschreibung
Initial Checks
- I confirm that I'm using the newest release of my line (verified on
mainand 2.2.0) - I confirm that I searched for my issue in the issues before opening this one (searched "exception pending request", "error classification", "McpError generic")
Release line
v2 (v1 shares the code)
Description
When a transport request fails mid-flight (HTTP 401/403/429, connection reset, etc.), the client transports log the exception and close the stream, and pending send_request callers get a generic closed-stream error. The original exception — with its status code — never reaches the application, so a host cannot distinguish "token expired, re-authorize" from "rate limited, back off" from "server gone".
Proposal, in two parts (we run both in production and can PR them):
- SSE/streamable-HTTP transports forward the caught exception into the read stream (instead of only
logger.exception), so the session sees it. - Client/shared sessions deliver that raw exception to the pending request(s) — the default message handler re-raises
Exceptioninstances — sosend_requestcallers receive the realhttpx.HTTPStatusErrorand can classify it.
One caveat worth discussing: httpx exceptions stringify with the request URL, which can carry credentials in query strings; our transport-side change logs only the exception type name and leaves scrubbing to the application that receives the raw exception.
Happy to be assigned and open the PR(s).
🤖 Generated with Claude Code
- Vorherrschende Sprache
- Python
- Sterne
- 24.3k
- Forks
- 4k
- Ø Merge
- 1 T. 16 Std.
- Gemergte PRs (30 T.)
- 25
Beitragsleitfaden
Erste Schritte
- Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
- Forken Sie das Repository und arbeiten Sie in einem Branch.
- Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.
Mehr aus modelcontextprotocol/python-sdk
-
v1 v2
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 70/100
modelcontextprotocol/python-sdk#3578 · 1 Kommentar ·
-
v1 v2
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 65/100
modelcontextprotocol/python-sdk#3573 · 2 Kommentare ·
-
v2
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 75/100
modelcontextprotocol/python-sdk#3566 ·
-
v1 v2
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 85/100
modelcontextprotocol/python-sdk#3546 · 5 Kommentare ·
-
v1 v2
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 76/100
modelcontextprotocol/python-sdk#3545 · 2 Kommentare ·
Alle Issues in modelcontextprotocol/python-sdk
Ähnliche Issues
-
bug
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 75/100
stephrobert/dsoxlab#238 ·
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 75/100
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 75/100
sublimehq/package_control#1780 ·
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 65/100
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 70/100
nwg-piotr/nwg-displays#145 ·