Skip to content

feat: Make OAuth callback URIs configurable #585

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

mxcoppell
Copy link

@mxcoppell mxcoppell commented Jul 7, 2025

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
package.json Outdated
@@ -56,6 +56,7 @@
"zod": "^3.23.8"
},
"devDependencies": {
"@modelcontextprotocol/inspector": "^0.15.0",
Copy link
Member

Choose a reason for hiding this comment

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

Why does Inspector need to be added as a dev dependency here?

Copy link
Author

Choose a reason for hiding this comment

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

Removed.

The package was incorrectly listing itself as a dev dependency.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants