modelcontextprotocol / modelcontextprotocol/python-sdk
OAuthClientProvider._handle_token_response expect json
Dieses Issue hat noch niemand übernommen.
- Vorherrschende Sprache
- Python
- Sterne
- 24.3k
- Forks
- 4k
- Ø Merge
- 1 T. 1 Std.
- Gemergte PRs (30 T.)
- 31
Beschreibung
Initial Checks
- I confirm that I'm using the latest version of MCP Python SDK
- I confirm that I searched for my issue in https://github.com/modelcontextprotocol/python-sdk/issues before opening this issue
Description
https://github.com/modelcontextprotocol/python-sdk/blob/673423da0d6511127608df3d75360e47e99cb1f1/src/mcp/client/auth.py#L437
OAuthClientProvider._handle_token_response expects JSON, but doesn't specify this in the headers. If the server responds in a different format, an exception will be raised.
For example, https://docs.github.com/en/apps/oauth-apps/building-oauth-apps/authorizing-oauth-apps#2-users-are-redirected-back-to-your-site-by-github
access_token endpoint by default returns form-data and requires the Accept: application/json header to return json.
Example Code
Python & MCP Python SDK
python 3.11.9
mcp=1.16.0
Beitragsleitfaden
Erste Schritte
- Lies das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreib ins Issue, dass du es übernimmst — das erspart doppelte Arbeit.
- Forke das Repository und arbeite in einem Branch.
- Öffne einen Pull Request, der die Issue-Nummer nennt.
Rechercherichtung
Beginne in src/mcp/client/auth.py bei der Referenz _handle_token_response etwa in Zeile 437 und lies anschließend die verlinkte GitHub OAuth-Dokumentation zum Format der access-token-Antwort. Prüfe, wie der Provider die Serverantwort verarbeitet, und bestätige den Abschluss, indem du verifizierst, dass die dokumentierte form-data-Antwort keine Ausnahme mehr auslöst, während JSON-Antworten weiterhin unterstützt werden.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Bewertung
- Tech-Stack
- python
- Bereich
- authentication
- Issue-Typ
- Bug
- Schwierigkeit
- 2/5
- Geschätzter Aufwand
- 1-3 Stunden
- Aktivitätsstatus
- Veraltet
- Klarheit
- Klar beschrieben
- Anfängerfreundlichkeit
- 58/100