docs(client): clarify that custom JWT claims do not override standard claims#1915
Open
shaun0927 wants to merge 1 commit intomodelcontextprotocol:mainfrom
Open
docs(client): clarify that custom JWT claims do not override standard claims#1915shaun0927 wants to merge 1 commit intomodelcontextprotocol:mainfrom
shaun0927 wants to merge 1 commit intomodelcontextprotocol:mainfrom
Conversation
The client auth helpers advertise overlapping custom claims as taking precedence over reserved JWT claims, but the implementation re-applies the reserved claims through SignJWT setters. This change narrows the scope to documentation and a focused regression test so the published contract matches shipped behavior without expanding API surface or changing runtime semantics. Constraint: Upstream review guidance prefers small, spec-aware fixes backed by concrete evidence Rejected: Change runtime behavior so custom claims override reserved claims | would alter shipped semantics and widen scope beyond a docs fix Confidence: high Scope-risk: narrow Reversibility: clean Directive: Keep reserved JWT claims authoritative unless maintainers explicitly decide to change runtime behavior in a separate design discussion Tested: packages/client/authExtensions test suite; client package typecheck; client package lint/prettier Not-tested: full monorepo test matrix
|
@modelcontextprotocol/client
@modelcontextprotocol/server
@modelcontextprotocol/express
@modelcontextprotocol/fastify
@modelcontextprotocol/hono
@modelcontextprotocol/node
commit: |
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
PrivateKeyJwtProviderOptions.claimsadds custom claims but does not override reserved standard JWT claimsCloses #1914
Motivation and Context
packages/client/src/client/authExtensions.tscurrently says overlapping custom claims take precedence over the standard JWT claims.The implementation does include additional custom claims, but it then re-applies the reserved claims via
SignJWTsetters (setIssuer,setSubject,setAudience,setIssuedAt,setExpirationTime,setJti). In practice, overlapping custom values are not preserved.This PR keeps the runtime behavior unchanged and narrows the fix to docs + tests so the published contract matches the shipped behavior.
How Has This Been Tested?
corepack pnpm --filter @modelcontextprotocol/client test -- --run packages/client/test/client/authExtensions.test.tscorepack pnpm --filter @modelcontextprotocol/client typecheckcorepack pnpm --filter @modelcontextprotocol/client lintBreaking Changes
None.
Types of changes
Checklist