Skip to content

DX-114676: Unable to connect MCP server app (Trailing slash in OAuthMetadata's issuer causes issues with clients)#85

Merged
aniket-s-kulkarni merged 2 commits into
dremio:mainfrom
ktsunoda:DX-114676
Feb 23, 2026
Merged

DX-114676: Unable to connect MCP server app (Trailing slash in OAuthMetadata's issuer causes issues with clients)#85
aniket-s-kulkarni merged 2 commits into
dremio:mainfrom
ktsunoda:DX-114676

Conversation

@ktsunoda
Copy link
Copy Markdown
Contributor

@ktsunoda ktsunoda commented Feb 20, 2026

Issue

New MCP connections COULD fail with "MCP server does not implement OAuth" error.

Root cause: The MCP SDK's OAuthMetadata model uses AnyHttpUrl for the issuer field, which automatically adds a trailing slash during Pydantic serialization. This violates RFC 8414 Section 3.2, which requires the issuer field in OAuth metadata to exactly match the discovery URL (without trailing slash).

Example:

  • Discovery URL: https://login.dremio.cloud/.well-known/oauth-authorization-server
  • Issuer returned: https://login.dremio.cloud/ (with trailing slash)
  • RFC 8414 requirement: Issuer must be https://login.dremio.cloud (no trailing slash)

Modern OAuth clients (Claude Desktop after Feb 12, 2026) enforce strict RFC 8414 compliance and reject metadata with mismatched issuer URLs.

Fix

Create OAuthMetadataRFC8414 class that extends OAuthMetadata and uses Pydantic's @field_serializer decorator to strip the trailing slash from the issuer field during serialization. This is a clean, targeted fix that maintains RFC 8414 compliance without manual dict manipulation.

The class name clearly indicates RFC 8414 compliance, making it self-documenting for future developers.

Testing

Added test_oauth_discovery_rfc8414_compliance that validates the issuer field does not have a trailing slash, ensuring RFC 8414 compliance.

Test results:

  • ✅ Test PASSES with the fix
  • ❌ Test FAILS without the fix (confirms the bug exists)

Note
The issue may have been resolved on the ChatGPT side. That said, making our code RFC 8414 compliant even if the MCP SDK has this bug, is a good idea, so proactively making this update. We will remove this hack if modelcontextprotocol/python-sdk#1919 ever gets merged.

@CLAassistant
Copy link
Copy Markdown

CLAassistant commented Feb 20, 2026

CLA assistant check
All committers have signed the CLA.

@ktsunoda ktsunoda force-pushed the DX-114676 branch 4 times, most recently from 2ff9755 to c73302a Compare February 20, 2026 18:16
…error

New MCP connections to staging/qa fail with "MCP server does not implement OAuth"
error starting around Feb 12, 2026, while existing connections continue to work.

Root cause: The MCP SDK's OAuthMetadata model uses AnyHttpUrl for the issuer field,
which automatically adds a trailing slash during Pydantic serialization. This violates
RFC 8414 Section 3.2, which requires the issuer field in OAuth metadata to exactly
match the discovery URL (without trailing slash).

Example:
- Discovery URL: https://login.dremio.cloud/.well-known/oauth-authorization-server
- Issuer returned: https://login.dremio.cloud/ (with trailing slash)
- RFC 8414 requirement: Issuer must be https://login.dremio.cloud (no trailing slash)

Modern OAuth clients (Claude Desktop after Feb 12, 2026) enforce strict RFC 8414
compliance and reject metadata with mismatched issuer URLs.

Create OAuthMetadataRFC8414 class that extends OAuthMetadata and uses Pydantic's
@field_serializer decorator to strip the trailing slash from the issuer field
during serialization. This is a clean, targeted fix that maintains RFC 8414
compliance without manual dict manipulation.

Added test_oauth_discovery_rfc8414_compliance that validates the issuer field
does not have a trailing slash, ensuring RFC 8414 compliance.
maxlepikhin
maxlepikhin previously approved these changes Feb 23, 2026
Copy link
Copy Markdown
Contributor

@aniket-s-kulkarni aniket-s-kulkarni left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ktsunoda Two small changes .. looks good overall.

Comment thread tests/e2e/test_mcp_e2e.py Outdated
Comment thread tests/e2e/test_mcp_e2e.py Outdated
Remove unnecessary settings override that was not needed for the test.
The test only needs to verify the OAuth metadata endpoint returns
an issuer without a trailing slash.
@aniket-s-kulkarni aniket-s-kulkarni merged commit 584ca0f into dremio:main Feb 23, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

4 participants