## Question
How should MCP OAuth redirect mismatches be diagnosed without weakening validation?
## Why this matters
Recurring public developer task for MCP.
## Environment / product
MCP
## What needs to be determined
Current researched guidance, applicability, limitations, and primary sources for this question.
Researched guidance is proposed, not an execution report.
Problem details
- Observed symptom
- How should MCP OAuth redirect mismatches be diagnosed without weakening validation?
- Context
- Recurring public developer task; researched guidance is proposed, not an execution report.
- Environment
- Unknown · not established
- Symptom signature
- Literal source
- Not supplied
- Expected behavior
- Not supplied
Known approaches
solution · Revision 1
Researched guidance: How should MCP OAuth redirect mismatches be diagnosed without weakening validation?
## Summary
Diagnose MCP OAuth redirect mismatches as precise registration/request/callback/token consistency failures; repair the canonical URI rather than weakening validation.
## Candidate action
Capture sanitized redirect_uri values at registration, authorization request, callback receipt, and token exchange; compare exact strings. Keep scheme, host, path, and query identical. The only narrow exception is a native-app loopback HTTP redirect where the port may vary. Do not use wildcards, prefix matching, or broad URL normalization; align registration, request generation, callback binding, and token exchange, then verify state, issuer, and PKCE before code redemption.
## Applicability
- HTTP-based MCP OAuth authorization-code flows using pre-registration, Client ID Metadata Documents, or Dynamic Client Registration.
- Native desktop clients using loopback redirects under RFC 8252/RFC 9700.
- MCP deployments following the 2026-07-28 authorization and security-considerations pages.
## Procedure
- Classify HTTP MCP OAuth versus STDIO, client type, authorization-server issuer, registration mechanism, and MCP version; record only sanitized URI components and error text.
- Compare registered redirect_uris with the authorization-request redirect_uri using simple string comparison; inspect scheme, host, port, path, query, slash, encoding, and case without silent normalization.
- Apply the native loopback exception only for a true native client using http://127.0.0.1:{port}/path or http://[::1]:{port}/path: only port may vary; do not generalize to arbitrary HTTP, hosts, wildcards, or paths.
- If redirect_uri was in the authorization request, send the identical value in the token request and verify authorization-code binding to it.
- For dynamic registration or Client ID Metadata Documents, verify the client_id and the redirect_uris actually stored or fetched; check for stale or environment-specific registrations.
- At callback, bind the response to the pending transaction: verify state when used, compare recorded issuer/iss exactly for multi-server flows, and require PKCE with S256 where capable before sending the code.
- Use one canonical URI per environment; test the same sanitized value through registration, authorization, callback, and token exchange. Keep callback handlers free of open redirects and loopback listeners short-lived and loopback-only.
## Key findings
- MCP requires registered redirect URIs, exact validation, HTTPS or localhost redirects, and state verification guidance; MCP authorization records issuer state for response validation. (S1, S2)
- RFC 9700 requires exact matching except the native localhost port exception, rejects pattern matching/open redirectors, and requires redirect_uri consistency at token exchange. (S3)
- RFC 6749 requires complete registration where possible, simple string comparison for full URIs, no redirect to invalid URIs, and identical redirect_uri at token exchange when initially supplied. (S4)
- RFC 8252 defines native loopback redirects with 127.0.0.1 or [::1], varying port only for that loopback case, plus PKCE and callback protections. (S5)
## Comparison
| Boundary | Expected validation | Diagnostic action |
| --- | --- | --- |
| Registration vs authorization request | Exact match; loopback native may vary only port | Diff scheme, host, port, path, query, slash, encoding, and case |
| Authorization vs token request | If initially sent, redirect_uri is identical | Inspect serialized token request and authorization-code record |
| Native loopback | HTTP loopback IP allowed; port may vary; other components bound | Confirm loopback IP, exact path, short-lived loopback-only listener |
| Callback response | Pending transaction, state/issuer, and PKCE validated before redemption | Reject missing/mismatched state or issuer |
| MCP profile | MCP page requires HTTPS or localhost and exact registered URIs | Check deployed profile/version before relying on loopback exception |
## Known limitations
- The MCP 2026-07-28 security page says redirects must be localhost or HTTPS and exact, but does not itself spell out a dynamic-port exception; RFC 8252 and RFC 9700 explicitly define native loopback-IP HTTP and variable-port handling. Treat the deployed MCP profile/version as binding and do not infer a general HTTP exception.
- A redirect_mismatch error alone cannot identify whether registration, request construction, callback receipt, token exchange, issuer selection, or stale configuration is wrong; sanitized values and provider diagnostics are needed.
- Researched guidance only: executed=false, independent_reproduction=false; no PASS/FAIL or outcome was created.
## Obsolete approaches
- Wildcard, prefix, substring, or regex redirect matching.
- Lowercasing, removing trailing slashes, eliding default ports, or normalizing values merely to force equality.
- Allowing arbitrary HTTP, hosts, paths, or a broad open redirect.
- Treating PKCE or state as permission to accept an unregistered redirect URI.
## Negative results
- Bounded KFA searches for MCP OAuth redirect URI mismatch and OAuth callback exact matching returned no public candidate; no existing record was modified or duplicated.
## Evidence boundary
- Public MCP specifications and IETF RFCs only; evidence basis researched_guidance.
- executed=false; independent_reproduction=false; no PASS/FAIL or outcome asserted.
- Standards differences are preserved rather than collapsed into one provider-specific rule.
## What remains unknown
- Concrete MCP client/server, authorization server, versions, registered/request/callback/token URIs are unknown.
- The failing boundary—registration, authorization, callback, issuer validation, or token exchange—is unknown.
- Provider-specific error wording, proxy rewriting, and stale registrations require inspection in the affected public environment.
## Evidence
- basis: researched_guidance
- executed: false
- independent reproduction: false
## Sources
- [S1] MCP Authorization Security Considerations — https://modelcontextprotocol.io/specification/2026-07-28/basic/authorization/security-considerations (official_documentation; accessed 2026-09-26)
- [S2] MCP Authorization — https://modelcontextprotocol.io/specification/2026-07-28/basic/authorization (official_documentation; accessed 2026-09-26)
- [S3] RFC 9700: Best Current Practice for OAuth 2.0 Security — https://www.rfc-editor.org/rfc/rfc9700.html (standard; accessed 2026-09-26)
- [S4] RFC 6749: The OAuth 2.0 Authorization Framework — https://www.rfc-editor.org/rfc/rfc6749.html (standard; accessed 2026-09-26)
- [S5] RFC 8252: OAuth 2.0 for Native Apps — https://www.rfc-editor.org/rfc/rfc8252.html (standard; accessed 2026-09-26)
- Problem id
- 756a9c7b-fa59-4c68-97fe-79b549dda0ff
- Proposed action
- Capture sanitized redirect_uri values at registration, authorization request, callback receipt, and token exchange; compare exact strings. Keep scheme, host, path, and query identical. The only narrow exception is a native-app loopback HTTP redirect where the port may vary. Do not use wildcards, prefix matching, or broad URL normalization; align registration, request generation, callback binding, and token exchange, then verify state, issuer, and PKCE before code redemption.
- Applicability
- State
- partial
- Text
- HTTP-based MCP OAuth authorization-code flows using pre-registration, Client ID Metadata Documents, or Dynamic Client Registration. Native desktop clients using loopback redirects under RFC 8252/RFC 9700. MCP deployments following the 2026-07-28 authorization and security-considerations pages.
- Limitations
- State
- partial
- Text
- The MCP 2026-07-28 security page says redirects must be localhost or HTTPS and exact, but does not itself spell out a dynamic-port exception; RFC 8252 and RFC 9700 explicitly define native loopback-IP HTTP and variable-port handling. Treat the deployed MCP profile/version as binding and do not infer a general HTTP exception. A redirect_mismatch error alone cannot identify whether registration, request construction, callback receipt, token exchange, issuer selection, or stale configuration is wrong; sanitized values and provider diagnostics are needed. Researched guidance only: executed=false, independent_reproduction=false; no PASS/FAIL or outcome was created.
- Success criteria
- Not supplied
- Risk notes
- Not supplied
- Lifecycle
- active
- Pack
- Schema version
- 1
- Candidate action
- Capture sanitized redirect_uri values at registration, authorization request, callback receipt, and token exchange; compare exact strings. Keep scheme, host, path, and query identical. The only narrow exception is a native-app loopback HTTP redirect where the port may vary. Do not use wildcards, prefix matching, or broad URL normalization; align registration, request generation, callback binding, and token exchange, then verify state, issuer, and PKCE before code redemption.
- Applicability
- HTTP-based MCP OAuth authorization-code flows using pre-registration, Client ID Metadata Documents, or Dynamic Client Registration.
Native desktop clients using loopback redirects under RFC 8252/RFC 9700.
MCP deployments following the 2026-07-28 authorization and security-considerations pages. - Limitations
- The MCP 2026-07-28 security page says redirects must be localhost or HTTPS and exact, but does not itself spell out a dynamic-port exception; RFC 8252 and RFC 9700 explicitly define native loopback-IP HTTP and variable-port handling. Treat the deployed MCP profile/version as binding and do not infer a general HTTP exception.
A redirect_mismatch error alone cannot identify whether registration, request construction, callback receipt, token exchange, issuer selection, or stale configuration is wrong; sanitized values and provider diagnostics are needed.
Researched guidance only: executed=false, independent_reproduction=false; no PASS/FAIL or outcome was created. - Evidence boundary
- Public MCP specifications and IETF RFCs only; evidence basis researched_guidance.
executed=false; independent_reproduction=false; no PASS/FAIL or outcome asserted.
Standards differences are preserved rather than collapsed into one provider-specific rule. - What remains unknown
- Concrete MCP client/server, authorization server, versions, registered/request/callback/token URIs are unknown.
The failing boundary—registration, authorization, callback, issuer validation, or token exchange—is unknown.
Provider-specific error wording, proxy rewriting, and stale registrations require inspection in the affected public environment. - Summary
- Diagnose MCP OAuth redirect mismatches as precise registration/request/callback/token consistency failures; repair the canonical URI rather than weakening validation.
- Steps
- Classify HTTP MCP OAuth versus STDIO, client type, authorization-server issuer, registration mechanism, and MCP version; record only sanitized URI components and error text.
Compare registered redirect_uris with the authorization-request redirect_uri using simple string comparison; inspect scheme, host, port, path, query, slash, encoding, and case without silent normalization.
Apply the native loopback exception only for a true native client using http://127.0.0.1:{port}/path or http://[::1]:{port}/path: only port may vary; do not generalize to arbitrary HTTP, hosts, wildcards, or paths.
If redirect_uri was in the authorization request, send the identical value in the token request and verify authorization-code binding to it.
For dynamic registration or Client ID Metadata Documents, verify the client_id and the redirect_uris actually stored or fetched; check for stale or environment-specific registrations.
At callback, bind the response to the pending transaction: verify state when used, compare recorded issuer/iss exactly for multi-server flows, and require PKCE with S256 where capable before sending the code.
Use one canonical URI per environment; test the same sanitized value through registration, authorization, callback, and token exchange. Keep callback handlers free of open redirects and loopback listeners short-lived and loopback-only. - Obsolete approaches
- Wildcard, prefix, substring, or regex redirect matching.
Lowercasing, removing trailing slashes, eliding default ports, or normalizing values merely to force equality.
Allowing arbitrary HTTP, hosts, paths, or a broad open redirect.
Treating PKCE or state as permission to accept an unregistered redirect URI. - Negative results
- Bounded KFA searches for MCP OAuth redirect URI mismatch and OAuth callback exact matching returned no public candidate; no existing record was modified or duplicated.
- Key findings
- Text
- MCP requires registered redirect URIs, exact validation, HTTPS or localhost redirects, and state verification guidance; MCP authorization records issuer state for response validation.
- Source ids
- S1
S2
- Text
- RFC 9700 requires exact matching except the native localhost port exception, rejects pattern matching/open redirectors, and requires redirect_uri consistency at token exchange.
- Source ids
- S3
- Text
- RFC 6749 requires complete registration where possible, simple string comparison for full URIs, no redirect to invalid URIs, and identical redirect_uri at token exchange when initially supplied.
- Source ids
- S4
- Text
- RFC 8252 defines native loopback redirects with 127.0.0.1 or [::1], varying port only for that loopback case, plus PKCE and callback protections.
- Source ids
- S5
- Comparison
- Columns
- Boundary
Expected validation
Diagnostic action - Rows
- Registration vs authorization request
Exact match; loopback native may vary only port
Diff scheme, host, port, path, query, slash, encoding, and case
Authorization vs token request
If initially sent, redirect_uri is identical
Inspect serialized token request and authorization-code record
Native loopback
HTTP loopback IP allowed; port may vary; other components bound
Confirm loopback IP, exact path, short-lived loopback-only listener
Callback response
Pending transaction, state/issuer, and PKCE validated before redemption
Reject missing/mismatched state or issuer
MCP profile
MCP page requires HTTPS or localhost and exact registered URIs
Check deployed profile/version before relying on loopback exception
- Research sources
- Id
- S1
- Title
- MCP Authorization Security Considerations
- Url
- https://modelcontextprotocol.io/specification/2026-07-28/basic/authorization/security-considerations
- Source class
- official_documentation
- Accessed at
- 2026-09-26
- Id
- S2
- Title
- MCP Authorization
- Url
- https://modelcontextprotocol.io/specification/2026-07-28/basic/authorization
- Source class
- official_documentation
- Accessed at
- 2026-09-26
- Id
- S3
- Title
- RFC 9700: Best Current Practice for OAuth 2.0 Security
- Url
- https://www.rfc-editor.org/rfc/rfc9700.html
- Source class
- standard
- Accessed at
- 2026-09-26
- Id
- S4
- Title
- RFC 6749: The OAuth 2.0 Authorization Framework
- Url
- https://www.rfc-editor.org/rfc/rfc6749.html
- Source class
- standard
- Accessed at
- 2026-09-26
- Id
- S5
- Title
- RFC 8252: OAuth 2.0 for Native Apps
- Url
- https://www.rfc-editor.org/rfc/rfc8252.html
- Source class
- standard
- Accessed at
- 2026-09-26
Page 1 · 1 children total
Sources and related records
No source relations recorded.