Repository navigation
refactor(mcp): let the SDK finish HTTP auth and SSE reconnect - #1462
Merged
TheGreatAxios merged 3 commits intoOct 16, 2026
Merged
TheGreatAxios merged 3 commits into
TheGreatAxios merged 3 commits into
Conversation
Drop the extra probe on the ordinary path, finish auth on the transport that already dialed, and remove MCPClient.call. After an OAuth error that arrives before redirect, wipe credentials and dial once: a silent connect lets the real client retry, and a redirect prompts once.
Contributor
|
Triage: Pass No changes needed from you. A maintainer will review this pull request. |
finishAuth was running on the pre-failure HTTP transport after a probe client built the authorize URL, so the code exchange could use a different resource than the redirect. A wiped session is replaced before the retry.
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
OAuthErrorthrown before redirect clears stored credentials and continues the same attempt. The probe client that callsredirectToAuthorizationis the transportfinishAuthuses, so the code exchange sends that attempt's resource metadata and scope. An already-open session drops the wipedmcp-session-idbefore the tool call retries.reconnectionOptions(1s start, doubling, 30s cap, no jitter). Those options have no exhaustion callback, so a stream that stops retrying stays connected. Stdio death still redials through the existing owner loop.callResultonly.Verification
bun test src/mcp/client-auth-reauth-cap.test.ts src/mcp/client-auth-policy.test.ts src/mcp/oauth-provider.test.ts src/mcp/client-telemetry.test.ts src/mcp/client-redirect-policy.test.tspasses (79 tests).bun run typecheckpasses with dependencies installed. The earlier failure was a missingsemvermodule invendor/intx-types, not this change.Fixes CL-10662
https://linear.app/abklabs/issue/CL-10662