Hacktoberfest 2026 : les issues que les mainteneurs ont marquées pour octobre, ouvertes et accessibles aux débutants. Parcourir les issues Hacktoberfest

Client transports/sessions swallow the original exception; applications cannot classify 401/403/429 transport failures

Ouverte
#3,569 0 commentaires 0 réactions 0 personnes assignées Voir sur GitHub

Personne n'a encore pris cette issue.

Évaluation

Difficulté
3/5
Temps estimé
1-2 jours
Accessibilité débutants
55/100
Type d'issue
Bug
Clarté
Clairement spécifiée
Activité
Active
Stack technique
python
Domaine
api, backend

Piste de recherche

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.

Rédigé par le modèle d'indexation à partir du texte de l'issue.

Description

Initial Checks
  • I confirm that I'm using the newest release of my line (verified on main and 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):

  1. SSE/streamable-HTTP transports forward the caught exception into the read stream (instead of only logger.exception), so the session sees it.
  2. Client/shared sessions deliver that raw exception to the pending request(s) — the default message handler re-raises Exception instances — so send_request callers receive the real httpx.HTTPStatusError and 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

Langage dominant
Python
Étoiles
24.3k
Forks
4k
Merge moyen
1 j 16 h
PR mergées (30 j)
25

Guide de contribution

Ouvrir le guide de contribution

Par où commencer

  1. Lisez l'issue en entier, puis le guide de contribution du projet.
  2. Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
  3. Forkez le dépôt et travaillez sur une branche.
  4. Ouvrez une pull request qui référence le numéro de l'issue.

Autres issues de modelcontextprotocol/python-sdk

Toutes les issues de modelcontextprotocol/python-sdk

Issues similaires

Plus d'issues Python

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.