Repository navigation
feat(mcp): limit step-up re-authorization rounds (MCP spec 2026-07-28) - #2663
Open
mattzcarey wants to merge 3 commits into
Open
mattzcarey wants to merge 3 commits into
mattzcarey wants to merge 3 commits into
Conversation
🦋 Changeset detectedLatest commit: 6eba4f2 The changes in this PR will be included in the next version bump. This PR includes changesets to release 2 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
Contributor
|
✅ agents import sizes: no significant changes ( |
agents
@cloudflare/ai-chat
@cloudflare/codemode
hono-agents
@cloudflare/shell
@cloudflare/think
@cloudflare/voice
@cloudflare/worker-bundler
commit: |
mattzcarey
force-pushed
the
feat/mcp-step-up-retry-limit
branch
from
October 22, 2026 14:25
870fdba to
427a67d
Compare
mattzcarey
force-pushed
the
feat/mcp-step-up-retry-limit
branch
from
October 22, 2026 14:40
427a67d to
8f56c51
Compare
mattzcarey
added a commit
that referenced
this pull request
Oct 26, 2026
…authorization Opt DurableObjectOAuthClientProvider into the SDK's includePreviouslyGrantedScopes (typescript-sdk#2448, preview dfb8587). When a refresh is refused, the new authorization link also asks for the scope the dropped tokens held, so a write scope granted through step-up survives instead of sending the user back through step-up (#2663).
mattzcarey
force-pushed
the
feat/mcp-step-up-retry-limit
branch
from
October 27, 2026 12:06
cd5ce45 to
d5a9732
Compare
mattzcarey
force-pushed
the
feat/mcp-step-up-retry-limit
branch
from
October 27, 2026 13:04
d5a9732 to
0b90b04
Compare
mattzcarey
force-pushed
the
feat/mcp-step-up-retry-limit
branch
from
October 27, 2026 13:49
0b90b04 to
637d72c
Compare
mattzcarey
force-pushed
the
feat/mcp-step-up-retry-limit
branch
from
October 27, 2026 20:30
637d72c to
ea56f38
Compare
mattzcarey
force-pushed
the
feat/mcp-step-up-retry-limit
branch
from
October 27, 2026 22:41
ea56f38 to
3c908c1
Compare
- authorization rounds are counted per requested scope set; a round counts once its callback completed and the server asked for the same scopes - a fourth round within an hour records an authorization-exhausted failure instead of showing another link - auth/scope-retry-limit now passes; removed from both client baselines
… reconnect - each requested scope set keeps its own round budget, so challenges that alternate between scope sets cannot loop forever - connectToServer/establishConnection on a server with a recorded failure also clear an exhausted authorization budget
mattzcarey
force-pushed
the
feat/mcp-step-up-retry-limit
branch
from
October 28, 2026 10:05
3c908c1 to
6eba4f2
Compare
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.
Re-authorization now has a limit, as the MCP authorization spec requires. If the user has completed three authorizations for the same scopes within an hour and the server asks for them again, the client shows no fourth link. The server moves to
failedwith a recorded failure.auth/scope-retry-limitnow passes, so it comes off the 2026-07-28 baseline and the 2025-11-25 lane runs with no baseline at all.Stacked on #2662, and part of the same work on #2658. The 2026-07-28 spec says clients should retry step-up "no more than a few times and treat this as a permanent authorization failure". The SDK transport has a per-request step-up limit, but every OAuth round trip reconnects on a new transport and resets it. So a server that never gets the scope it asks for could send the user through OAuth forever, and the conformance referee saw four authorization requests where it allows three.
How rounds are counted, in
authorization-rounds.ts:scopeparameter, so challenges that alternate between two scope sets each use up their own budgetOnce the limit is hit,
callTool(),readResource()andgetPrompt()rethrow the SDK'sUnauthorizedErrorinstead ofMCPAuthorizationRequiredError.connectToServer()returnsfailedwith the reason.pnpm run check, the agents workers suite and all client conformance lanes pass. A new test runs three real step-up rounds against an authorization server that never grants the write scope, and checks that the fourth fails, stays failed after a wake, and shows a link again after an explicit reconnect.