Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Response parsing errors after OAuth flow #1173

Copy link
Copy link
@clareliguori

Description

@clareliguori
Issue body actions

Initial Checks

Description

The changes in #1061 overwrite the incoming request object to async_auth_flow with the request returned by self._create_oauth_metadata_request(url).

                    discovery_urls = self._get_discovery_urls()
                    for url in discovery_urls:
                        request = self._create_oauth_metadata_request(url)
                        response = yield request

After the auth flow occurs and the (overwritten) request is made, the client tries to parse the result. But the result is OAuth metadata, not a JSONRPC response as expected.

Example errors:

2025-07-18 15:56:35,124 - ERROR - Error parsing JSON response
Traceback (most recent call last):
  File "/src/python/.venv/lib/python3.11/site-packages/mcp/client/streamable_http.py", line 302, in _handle_json_response
    message = JSONRPCMessage.model_validate_json(content)
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/src/python/.venv/lib/python3.11/site-packages/pydantic/main.py", line 746, in model_validate_json
    return cls.__pydantic_validator__.validate_json(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
pydantic_core._pydantic_core.ValidationError: 11 validation errors for JSONRPCMessage
JSONRPCRequest.method
  Field required [type=missing, input_value={'authorization_endpoint'...code', 'refresh_token']}, input_type=dict]
    For further information visit https://errors.pydantic.dev/2.11/v/missing

Example Code

Python & MCP Python SDK

MCP 1.12.0
Reactions are currently unavailable

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      Morty Proxy This is a proxified and sanitized view of the page, visit original site.