feat: add scope option to ClientCredentialsProvider, PrivateKeyJwtProvider, and StaticPrivateKeyJwtProvider#1670
Open
Vadaski wants to merge 2 commits intomodelcontextprotocol:mainfrom
Conversation
…vider, and StaticPrivateKeyJwtProvider (modelcontextprotocol#1430) Addresses issue modelcontextprotocol#1430: machine-to-machine OAuth providers had no way to configure the OAuth scope for their token requests. Changes: - Added optional `scope?: string` field to `ClientCredentialsProviderOptions`, `PrivateKeyJwtProviderOptions`, and `StaticPrivateKeyJwtProviderOptions` - When `scope` is provided, sets `clientMetadata.scope` in the constructor so that `fetchToken()` forwards it to `prepareTokenRequest()` and the scope is included in the token request body - No behaviour change when `scope` is omitted (fully backwards compatible) Tests: added 3 new tests (one per provider) in authExtensions.test.ts verifying that the configured scope reaches the token endpoint. Closes modelcontextprotocol#1430 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
|
@modelcontextprotocol/client
@modelcontextprotocol/server
@modelcontextprotocol/express
@modelcontextprotocol/hono
@modelcontextprotocol/node
commit: |
…lcontextprotocol#1430) if (options.scope) silently ignored scope: "" — fix to !== undefined so an empty string scope is handled correctly. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.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.
Closes #1430. Adds optional scope field to machine-to-machine OAuth provider options. When provided, sets clientMetadata.scope so fetchToken forwards it to prepareTokenRequest. Fully backwards compatible. Added 3 new tests.