Skip to content

refactor(mcp): let the SDK finish HTTP auth and SSE reconnect - #1462

Merged
TheGreatAxios merged 3 commits into
mainfrom
cl-10662-mcp-simplification-delete-auth-coordinator-lock-files
Oct 16, 2026
Merged

TheGreatAxios merged 3 commits into
mainfrom
cl-10662-mcp-simplification-delete-auth-coordinator-lock-files

Conversation

@TheGreatAxios

@TheGreatAxios TheGreatAxios commented Oct 16, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

  • An OAuthError thrown before redirect clears stored credentials and continues the same attempt. The probe client that calls redirectToAuthorization is the transport finishAuth uses, so the code exchange sends that attempt's resource metadata and scope. An already-open session drops the wiped mcp-session-id before the tool call retries.
  • Streamable HTTP reconnect uses the SDK 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.
  • Tool calls go through callResult only.

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.ts passes (79 tests).
  • bun run typecheck passes with dependencies installed. The earlier failure was a missing semver module in vendor/intx-types, not this change.

Fixes CL-10662

https://linear.app/abklabs/issue/CL-10662

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.
@linear-code

linear-code Bot commented Oct 16, 2026

Copy link
Copy Markdown

CL-10662

@corbits-triage

corbits-triage Bot commented Oct 16, 2026 •

Copy link
Copy Markdown
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.
@TheGreatAxios
TheGreatAxios merged commit 4d5c550 into main Oct 16, 2026
13 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant