Skip to content

fix: preserve OAuth resource metadata URL across redirects - #1429

Closed
jstar0 wants to merge 1 commit into
modelcontextprotocol:v1/mainfrom
jstar0:fix/oauth-resource-metadata-redirect
Closed

jstar0 wants to merge 1 commit into
modelcontextprotocol:v1/mainfrom
jstar0:fix/oauth-resource-metadata-redirect

Conversation

@jstar0

@jstar0 jstar0 commented Jun 4, 2026 •

Copy link
Copy Markdown

Summary

Inspector can receive an explicit protected-resource metadata URL from an MCP server's OAuth challenge, but that URL is currently lost across the browser redirect. This causes mounted MCP servers to fall back to inferred metadata locations even when the server advertised the exact location to use.

Type of Change

  • Bug fix (non-breaking change that fixes an issue)
  • Test updates

Changes Made

  • Preserve resource_metadata from OAuth challenges while an authorization flow is in progress.
  • Scope persisted metadata URLs by the complete configured MCP server URL and clear stale values before fresh connection attempts.
  • Restore the persisted URL during the OAuth callback authorization-code exchange.
  • Use proxy-forwarded upstream 401 challenge metadata during OAuth recovery, including 401 responses returned while an SSE transport is starting.
  • Probe the configured MCP endpoint first in the guided OAuth flow so an advertised 401 or 403 metadata URL can be used before inferred locations.
  • Add regression coverage for callback recovery, guided discovery, direct and proxy responses, proxy upstream 401 recovery, SSE startup 401 forwarding, cleanup, stale-state handling, and malformed challenges.

This builds on #924, which enabled transport-side challenge parsing. It is separate from #632's OAuth resource persistence, #1327's inferred subpath fallback, and #1342's callback proxy-fetch routing.

Related Issues

Fixes #576.

Testing

  • Added/updated automated tests

Verification

npm run prettier-check
npm run lint
npm test
npm run build
npm --workspace=client exec playwright test e2e -- --project=chromium --workers=1

Checklist

  • Code follows the style guidelines
  • Self-review completed
  • Code is commented where necessary
  • Documentation updated or not required

Breaking Changes

None.

@jstar0
jstar0 force-pushed the fix/oauth-resource-metadata-redirect branch from 91804a9 to b30a628 Compare July 18, 2026 01:22
@cliffhall
cliffhall changed the base branch from main to v1/main July 28, 2026 03:04
@cliffhall

cliffhall commented Jul 31, 2026 •

Copy link
Copy Markdown
Member

Closing: v1 is deprecated.

Thank you for this contribution, and apologies for the long wait for a response.

v1 will receive security fixes only. We reviewed every open v1 PR for security impact before closing — see the backlog triage in #1819 — and a small number were retained for a final 1.0.5 patch release. This one is a functionality, compatibility, or cleanup change rather than a vulnerability fix, so it is being closed unmerged. This is not a judgment on the quality of the work — it's a consequence of the branch it targets being frozen.

If the underlying problem still exists in v2, we'd genuinely like to know. Please open an issue describing it against v2. Note that we accept external contributions as issues rather than pull requests — maintainers handle design and implementation through a prompt-driven workflow. See CONTRIBUTORS.md.

Thanks again for taking the time to contribute to the Inspector.

@cliffhall cliffhall closed this Jul 31, 2026
@cliffhall cliffhall added the closed-v1-deprecated Closed: v1 is deprecated and accepting security fixes only label Jul 31, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

closed-v1-deprecated Closed: v1 is deprecated and accepting security fixes only

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Auth] OAuth flow does not support resourceMetadataUrl

2 participants