Implement SEP-990 Enterprise Managed OAuth#1593
Open
sagar-okta wants to merge 3 commits intomodelcontextprotocol:mainfrom
Open
Implement SEP-990 Enterprise Managed OAuth#1593sagar-okta wants to merge 3 commits intomodelcontextprotocol:mainfrom
sagar-okta wants to merge 3 commits intomodelcontextprotocol:mainfrom
Conversation
|
@modelcontextprotocol/client
@modelcontextprotocol/server
@modelcontextprotocol/express
@modelcontextprotocol/hono
@modelcontextprotocol/node
commit: |
9 tasks
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.
This PR implements SEP-990 Enterprise Managed Authorization using a provider-based approach with RFC 8693 Token Exchange and RFC 7523 JWT Bearer flows. This enables secure cross-app authentication for MCP clients in enterprise environments where users authenticate with an enterprise IdP.
Related: #1090
Motivation and Context
Enterprise environments often require OAuth flows where users authenticate with a centralized identity provider (IdP), and applications need to securely access protected resources on behalf of those users without storing credentials. SEP-990 addresses this by implementing:
This change is needed to support enterprise customers who need to integrate MCP clients into their existing OAuth infrastructure securely, following the same provider pattern as
ClientCredentialsProviderandPrivateKeyJwtProvider.Implementation Approach
Following PR review feedback, this implementation uses a provider-based approach instead of middleware:
Layer 2 - Utility Functions (
crossAppAccess.ts):requestJwtAuthorizationGrant()- RFC 8693 token exchange at IdPdiscoverAndRequestJwtAuthGrant()- Discovery + token exchangeexchangeJwtAuthGrant()- RFC 7523 JWT bearer grant at MCP serverLayer 3 - Provider Class (
authExtensions.ts):CrossAppAccessProvider- ImplementsOAuthClientProviderinterfaceCore Integration (
auth.ts):OAuthClientProviderinterface with optional URL storage methodsauth()to save discovered URLs for providers that need themHow Has This Been Tested?
Added comprehensive test coverage (40 tests total):
crossAppAccess.test.ts(12 tests):authExtensions.test.ts(16 new tests):Updated client.md:
Breaking Changes
No breaking changes - This is an additive feature:
CrossAppAccessProviderclass (does not modify existing providers)OAuthClientProviderinterface (backward compatible)Types of changes
Checklist
Additional Context
Implementation Details:
New Files:
crossAppAccess.ts(230 lines) - Layer 2 utilities for token exchangecrossAppAccess.test.ts(12 test cases)Modified Files:
authExtensions.ts- AddedCrossAppAccessProviderclass (~80 lines)auth.ts- EnhancedOAuthClientProviderinterface with optional URL storage methodsmiddleware.ts- Removed oldwithCrossAppAccessmiddlewareindex.ts- Added export for crossAppAccess moduleauthExtensions.test.ts- Added 16 provider testsKey Features:
ClientCredentialsProvider,PrivateKeyJwtProvider)Dependencies:
qsdependency for proper OAuth parameter encoding