Commit 584ca0f
authored
DX-114676: Unable to connect MCP server app (Trailing slash in OAuthMetadata's issuer causes issues with clients) (#85)
* Fix DX-114676: OAuth discovery fails with "does not implement OAuth" 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.
* Simplify test_oauth_discovery_rfc8414_compliance
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.1 parent f585af5 commit 584ca0f
2 files changed
Lines changed: 51 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
20 | 20 | | |
21 | 21 | | |
22 | 22 | | |
23 | | - | |
| 23 | + | |
24 | 24 | | |
25 | 25 | | |
26 | 26 | | |
27 | 27 | | |
28 | 28 | | |
29 | 29 | | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
30 | 42 | | |
31 | 43 | | |
32 | 44 | | |
| |||
180 | 192 | | |
181 | 193 | | |
182 | 194 | | |
183 | | - | |
| 195 | + | |
184 | 196 | | |
185 | 197 | | |
186 | 198 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
50 | 50 | | |
51 | 51 | | |
52 | 52 | | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
53 | 90 | | |
54 | 91 | | |
55 | 92 | | |
| |||
0 commit comments