feat: add OAuth 2.0 client certificate authentication (private_key_jwt)#1169
Open
harishkaushal30 wants to merge 1 commit intomodelcontextprotocol:mainfrom
Open
feat: add OAuth 2.0 client certificate authentication (private_key_jwt)#1169harishkaushal30 wants to merge 1 commit intomodelcontextprotocol:mainfrom
harishkaushal30 wants to merge 1 commit intomodelcontextprotocol:mainfrom
Conversation
Add support for OAuth 2.0 certificate-based authentication using the private_key_jwt method (RFC 7523) as an alternative to client secret. Server changes: - Add POST /oauth/token/certificate endpoint for JWT client assertion signing and token exchange (server-side, private keys never touch browser) - Add GET /oauth/discover endpoint for CORS-free OAuth endpoint discovery via protected resource metadata and OIDC configuration - JWT includes x5t (thumbprint) and x5c (certificate chain) claims for SNI support Client changes: - Add Secret/Certificate toggle in OAuth authentication section - Add auto-discover/manual toggle for OAuth endpoint configuration - Auto-discovery fetches .well-known/oauth-protected-resource from MCP server and resolves endpoints via OIDC .well-known/openid-configuration - Certificate auth bypasses SDK auth provider to avoid resource parameter conflicts with Azure AD and CORS issues with remote servers - Add OAuthClientAuthMethod type and session storage constants - Wire cert config through App.tsx state, Sidebar, useConnection, OAuthCallback, AuthDebugger, and oauth-state-machine Tests: - Add 10 new Sidebar tests for certificate auth UI behavior - Update existing Sidebar test defaultProps with cert auth fields - All 497 tests pass (28 suites) Documentation: - Update README.md Authentication section with Bearer Token, OAuth with Client Secret, and OAuth with Client Certificate subsections Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Add support for OAuth 2.0 certificate-based authentication using the \private_key_jwt\ method (RFC 7523) as an alternative to client secret. This enables MCP servers protected by OAuth providers that require certificate auth (e.g., Azure AD/Entra ID with SNI).
Changes
Server
Client
esource\ parameter conflict (\AADSTS9010010). Auth is handled via \handleAuthError\ using the proxy discovery endpoint.
Tests
Documentation
Compatibility
Works with any OAuth 2.0 provider supporting \private_key_jwt\ client authentication:
How to test