-
Notifications
You must be signed in to change notification settings - Fork 5.8k
fix(mcp): Upgrade SDK and add redirectUri config for OAuth callback #5940
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
fix(mcp): Upgrade SDK and add redirectUri config for OAuth callback #5940
Conversation
|
Future Enhancement Note: Dynamic port allocation (binding to port |
3eef5d6 to
01fb104
Compare
Update MCP SDK to get latest OAuth improvements including better public client support. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <[email protected]>
Add support for OAuth public clients (no client secret) with configurable redirect URI. This enables MCP servers that don't support dynamic client registration to work with pre-registered public OAuth clients. Changes: - Add redirectUri option to McpOAuthConfig for flexible callback configuration - Add parseRedirectUri() helper to extract port/path from URI string - Update oauth-callback server to accept redirectUri parameter - Support public clients via token_endpoint_auth_method: "none" - Update config schema and CLI debug command The redirectUri approach is cleaner than separate port/path options and matches standard OAuth library patterns, making debugging easier. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <[email protected]>
Add test coverage for McpOAuthCallback.ensureRunning() including: - Default port/path behavior - Custom redirectUri parsing - Server restart on config change - Idempotent behavior - Start/stop lifecycle 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <[email protected]>
ed54e4f to
914d122
Compare
- Remove redundant tests (duplicate default/isRunning checks) - Add dedicated parseRedirectUri unit tests for port/path parsing - Test edge cases: http/https defaults, invalid URIs 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <[email protected]>
|
Any blockers on this? I'm currently instructing the agent to use github CLI but it kinda drain tokens |
|
closing this to address the two issues separately:
|
Closes #5766
Summary
redirectUrifor OAuth callback (simpler than separate port/path)Problem
Wrong authorization URL: MCP SDK 1.15.1 incorrectly constructs the authorization URL by appending
/authorizeto the issuer URL instead of usingauthorization_endpointfrom OAuth metadata.No callback config: Users cannot configure the OAuth callback URL to match what's registered on their OAuth server.
Solution
Upgrade MCP SDK to 1.25.1 which correctly reads
authorization_endpointfrom OAuth discovery metadata.Add
redirectUriconfig option: A single URI string that specifies the full callback URL. This is cleaner than separate port/path options and matches standard OAuth library patterns.User Configuration
If
redirectUriis not specified, the defaulthttp://127.0.0.1:19876/mcp/oauth/callbackis used.Why
redirectUriinstead ofcallbackPort/callbackPath?Test plan
ensureRunningbehavior with custom URIs🤖 Generated with Claude Code