-
Notifications
You must be signed in to change notification settings - Fork 201
add OAuth 2.1 authorization with JWT validation and RFC 9728 metadata #2438
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
base: main
Are you sure you want to change the base?
add OAuth 2.1 authorization with JWT validation and RFC 9728 metadata #2438
Conversation
Pass OAuth configuration to MCP server when enabled, fixing authentication middleware that was never being triggered due to missing config.
- Add authorization_server_url to MCPOAuthConfiguration - Implement /.well-known/oauth-protected-resource endpoint - Add server base_url configuration for OAuth discovery - Update auth middleware to include resource metadata URL in errors - Update JSON schema with new OAuth discovery fields This enables MCP clients to automatically discover OAuth endpoints and complete authentication flows per MCP specification.
- Add HTTPMiddleware to authenticate all MCP requests - Return 401 with WWW-Authenticate header per RFC 9728 - Update tests for new error messages
|
Important Review skippedDraft detected. Please check the settings in the CodeRabbit UI or the You can disable this status message by setting the Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Router image scan passed✅ No security vulnerabilities found in image: |
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #2438 +/- ##
===========================================
- Coverage 62.75% 31.82% -30.94%
===========================================
Files 296 213 -83
Lines 41353 23426 -17927
Branches 4244 0 -4244
===========================================
- Hits 25951 7455 -18496
+ Misses 15381 15043 -338
- Partials 21 928 +907
🚀 New features to boost your workflow:
|
9163735 to
84495cd
Compare
Implements OAuth 2.1 authorization for the MCP server with JWT validation and RFC 9728 Protected Resource Metadata support.
Problem
MCP server forwarded Authorization headers without validation:
Changes
Configuration Example