fix(client): accumulate scopes across 401/403 auth challenges by stakeswky · Pull Request #1618 · modelcontextprotocol/typescript-sdk · GitHub
Skip to content

fix(client): accumulate scopes across 401/403 auth challenges#1618

Closed
stakeswky wants to merge 1 commit into
modelcontextprotocol:mainfrom
stakeswky:fix/issue-1582-scope-union
Closed

fix(client): accumulate scopes across 401/403 auth challenges#1618
stakeswky wants to merge 1 commit into
modelcontextprotocol:mainfrom
stakeswky:fix/issue-1582-scope-union

Conversation

@stakeswky

@stakeswky stakeswky commented Mar 3, 2026

Copy link
Copy Markdown
Contributor

Summary

  • fix StreamableHTTPClientTransport scope handling to merge (union) scopes from new WWW-Authenticate challenges instead of overwriting existing scope
  • apply this for both 401 auth challenges and 403 insufficient_scope upscoping
  • add/adjust tests to verify progressive scope accumulation behavior

Why

Servers with per-operation scopes may return only the scope needed for the current resource (RFC 6750). Overwriting client scope causes previously granted scopes to be dropped and can lead to re-authorization loops.

Fixes #1582.

@stakeswky stakeswky requested a review from a team as a code owner March 3, 2026 10:03
@changeset-bot

changeset-bot Bot commented Mar 3, 2026

Copy link
Copy Markdown

@pkg-pr-new

pkg-pr-new Bot commented Mar 3, 2026

Copy link
Copy Markdown

Open in StackBlitz

@modelcontextprotocol/client

npm i https://pkg.pr.new/modelcontextprotocol/typescript-sdk/@modelcontextprotocol/client@1618

@modelcontextprotocol/server

npm i https://pkg.pr.new/modelcontextprotocol/typescript-sdk/@modelcontextprotocol/server@1618

@modelcontextprotocol/express

npm i https://pkg.pr.new/modelcontextprotocol/typescript-sdk/@modelcontextprotocol/express@1618

@modelcontextprotocol/hono

npm i https://pkg.pr.new/modelcontextprotocol/typescript-sdk/@modelcontextprotocol/hono@1618

@modelcontextprotocol/node

npm i https://pkg.pr.new/modelcontextprotocol/typescript-sdk/@modelcontextprotocol/node@1618

commit: 62d946a

@pcarleton

Copy link
Copy Markdown
Member

hi thanks for this, going to close this in favor of #1604

@pcarleton pcarleton closed this Mar 4, 2026
@pcarleton

Copy link
Copy Markdown
Member

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Scope overwrite in 403 upscoping prevents progressive authorization for servers with per-operation scopes

2 participants