Skip to content

feat: Make OAuth callback URIs configurable - #585

Closed
mxcoppell wants to merge 4 commits into
modelcontextprotocol:v1/mainfrom
mxcoppell:feature/oauth-flow
Closed

mxcoppell wants to merge 4 commits into
modelcontextprotocol:v1/mainfrom
mxcoppell:feature/oauth-flow

Conversation

@mxcoppell

@mxcoppell mxcoppell commented Jul 7, 2025 •

Copy link
Copy Markdown

This pull request makes the MCP Inspector's OAuth 2.0 callback URIs configurable.

Previously, the callback URIs were hardcoded. This change allows them to be set dynamically, which is useful for environments where the Inspector is running behind a proxy or in a containerized setup with a different public-facing URL.

The implementation reads the callback URI from sessionStorage, which can be populated from environment variables on the server at startup. Specifically, the following keys are used:

  • OAUTH_MCP_INSPECTOR_CALLBACK for the standard OAuth flow.
  • OAUTH_MCP_INSPECTOR_DEBUG_CALLBACK for the OAuth debugging flow.

If these session storage items are not set, the Inspector falls back to the default URIs (/oauth/callback and /oauth/callback/debug).

@mxcoppell mxcoppell changed the title feat: Implement OAuth 2.0 PKCE flow for authentication feat: Make OAuth callback URIs configurable Jul 7, 2025
This makes the MCP Inspector's OAuth 2.0 callback URIs configurable via environment variables (OAUTH_MCP_INSPECTOR_CALLBACK, OAUTH_MCP_INSPECTOR_DEBUG_CALLBACK). This is useful for environments where the Inspector is running behind a proxy or in a containerized setup with a different public-facing URL. The server listens on the ports specified in these URLs and forwards OAuth2 authorization codes to the Inspector frontend.
@mxcoppell
mxcoppell force-pushed the feature/oauth-flow branch from a0beb17 to f2ed9c9 Compare July 7, 2025 01:24
Comment thread package.json Outdated
@olaservo olaservo added the auth Issues and PRs related to authorization label Aug 7, 2025
@cliffhall cliffhall added the v1 label Apr 16, 2026
@cliffhall
cliffhall changed the base branch from main to v1/main July 28, 2026 03:08
@cliffhall

Copy link
Copy Markdown
Member

Closing: reviewed and declined on security grounds.

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

This PR was included in a security review of the full v1 backlog before bulk-closing it (#1819). Unlike most of that backlog — which is closed simply because v1 is deprecated — this change was read closely and is being declined on its merits: as written, it would weaken a security control the Inspector's threat model depends on.

Specifically: redirectUrl is read from a server-influenced /config response and used to spawn additional callback listeners. (The lockfile also adds the package as a devDependency of itself.)

The Inspector's backend spawns local processes and proxies outbound requests on the developer's behalf, so it defends in layers: session-token auth, origin validation, loopback-only binding, and an SSRF block-list on the proxy. A change that removes or widens any one of those is a net loss even when it fixes a real usability problem — and several PRs in this group were framed as fixes or improvements, which is exactly why we're recording the decision explicitly rather than closing silently.

We're labeling this closed-v1-security-declined so the decision is queryable and doesn't get re-proposed against v2 later. This is not an accusation of bad intent — in most cases the security consequence was a side effect of an unrelated goal.

If the underlying need is real, we'd like to solve it in a way that preserves those controls. Please open an issue against v2 describing the problem you hit (not the patch), and we'll look at it. Note that we accept external contributions as issues rather than pull requests — see CONTRIBUTORS.md.

@cliffhall cliffhall closed this Jul 31, 2026
@cliffhall cliffhall added closed-v1-deprecated Closed: v1 is deprecated and accepting security fixes only closed-v1-security-declined Closed: reviewed and declined on security grounds; do not re-propose labels Jul 31, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

auth Issues and PRs related to authorization closed-v1-deprecated Closed: v1 is deprecated and accepting security fixes only closed-v1-security-declined Closed: reviewed and declined on security grounds; do not re-propose v1

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants