Repository navigation
feat(mcp): limit step-up re-authorization rounds (MCP spec 2026-07-28) - #2663
mattzcarey wants to merge 4 commits into
Conversation
|
|
✅ agents import sizes: no significant changes ( |
agents
@cloudflare/ai-chat
@cloudflare/codemode
hono-agents
@cloudflare/shell
@cloudflare/think
@cloudflare/voice
@cloudflare/worker-bundler
commit: |
870fdba to
427a67d
Compare
427a67d to
8f56c51
Compare
…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).
cd5ce45 to
d5a9732
Compare
d5a9732 to
0b90b04
Compare
0b90b04 to
637d72c
Compare
637d72c to
ea56f38
Compare
ea56f38 to
3c908c1
Compare
3c908c1 to
6eba4f2
Compare
6eba4f2 to
edd7d27
Compare
There was a problem hiding this comment.
Devin Review found 1 new potential issue.
⚠️ 1 issue in files not directly in the diff
⚠️ MCP authorization fix misses release
The agents step-up authorization fix has no changeset. The release workflow versions packages through changesets, so the fix receives no release bump.
- 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
edd7d27 to
265214c
Compare
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.