Skip to content

fix(mcp): protect ready callback recovery - #1464

Merged
kentcdodds merged 9 commits into
mainfrom
cursor/mcp-oauth-self-heal-for-domain-state-700e
Aug 16, 2026
Merged

kentcdodds merged 9 commits into
mainfrom
cursor/mcp-oauth-self-heal-for-domain-state-700e

Conversation

@kentcdodds

@kentcdodds kentcdodds commented Aug 16, 2026 •

Copy link
Copy Markdown
Member

Intent

Fix late Bugbot findings from #1462 without interrupting already-authorized remote MCP connections or promising a replacement authorization link when Kody could not identify a server.

Summary

  • Treat unusable callback replays as already complete when the saved server is ready or otherwise past OAuth, preserving its live connection and tokens.
  • Report connecting, connected, and discovering replay states as successful authorization instead of showing a reconnect error while the connection settles.
  • Distinguish recovery with a newly minted authorization link from recovery where the user must choose a server and click Reconnect.
  • Add regression coverage for past-OAuth callback replay and the unknown-server recovery redirect.

Testing

  • npx vitest run --project node-unit packages/worker/src/mcp-client/hub-oauth-recovery.node.test.ts packages/worker/src/mcp-client/oauth-callback-outcome.node.test.ts packages/worker/src/app/handlers/account-mcp-servers.node.test.ts (11 passed)
  • npm run typecheck
  • npm run format:check
  • npm run lint
  • Preview kody-pr-1464 at 9661e2db: signed in as the non-admin seed user, added the preview itself as an OAuth-protected MCP server, approved access, and confirmed it reached Connected with 2 tools.
  • Replayed the already-used authorization by navigating Back and approving the same state again; the server remained Connected with 2 tools and showed no internal state or reconnect error.

mcp_oauth_ready_callback_replay.mp4

System changes

System recap — extends existing primitives (medium risk)

Mode: recap · Base: main @ bfaf1ad8 · Head: 9661e2db

Classification: extends — tightens remote MCP callback recovery behavior and account UI messaging; no new primitive is added.

Primitives touched

Primitive Group Impact
mcp-client-servers assistant extends — callback replay preserves authenticated and settling connections
app-ui surfaces extends — distinguishes minted-link and manual-retry recovery copy

System map

Callback recovery checks the existing per-user MCP connection before deciding whether to restart OAuth, then selects UI copy that matches whether a new link exists.

Legend: green = composes (wiring only) · amber = extended by this PR · red = new primitive · gray = context (unchanged, included only when an edge crosses it).

flowchart LR
	appUi["app-ui<br/>Browser app (Remix 3)"]:::extended
	mcpClient["mcp-client-servers<br/>MCP client servers"]:::extended
	appUi -->|"required vs retry callback status"| mcpClient
	mcpClient -->|"preserve past-OAuth connection or restart pending OAuth"| mcpClient
	classDef touched fill:#1a7f37,color:#fff
	classDef extended fill:#9a6700,color:#fff
	classDef added fill:#cf222e,color:#fff
	classDef untouched fill:#57606a,color:#fff
Loading

Invariants

  • Per-user isolation remains unchanged.
  • Replayed callbacks never clear credentials from an already-authenticated or settling connection.
Open in Web Open in Cursor 

cursoragent and others added 8 commits August 16, 2026 04:08
Co-authored-by: Kent C. Dodds <me+github@kentcdodds.com>
Co-authored-by: Kent C. Dodds <me+github@kentcdodds.com>
Co-authored-by: Kent C. Dodds <me+github@kentcdodds.com>
Co-authored-by: Kent C. Dodds <me+github@kentcdodds.com>
…tps://github.com/kentcdodds/kody into cursor/mcp-oauth-self-heal-for-domain-state-700e

Co-authored-by: Kent C. Dodds <me+github@kentcdodds.com>
…-heal-for-domain-state-700e

Co-authored-by: Kent C. Dodds <me+github@kentcdodds.com>
Co-authored-by: Kent C. Dodds <me+github@kentcdodds.com>
@coderabbitai

coderabbitai Bot commented Aug 16, 2026 •

Copy link
Copy Markdown

Warning

Review limit reached

@cursor[bot], you've reached your PR review limit, so we couldn't start this review.

Next review available in: 30 minutes

Limit details: You’ve used all 2 included reviews currently available under your plan.

You've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository.

How can I continue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

To avoid repeated limits, reduce automatic review volume by pausing incremental auto-reviews earlier, using label-based review opt-in, excluding WIP or generated PR titles, or requesting reviews manually when the PR is ready. If your team needs uninterrupted high-volume reviews, an organization admin can enable usage-based reviews.

How do review limits work?

CodeRabbit enforces per-developer PR review limits for each organization. Most developers receive the normal plan review availability.

For paid Pro and Pro+ PR reviews, CodeRabbit uses adaptive limits for sustained high-volume activity. When a developer's recent PR review activity reaches the 95th percentile or higher among CodeRabbit users, additional reviews become available more gradually as earlier reviews age out of the rolling window.

Please refer docs for additional details.

Review details
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 5c1831a8-458a-4eca-8a29-a6f9e9a56124

📥 Commits

Reviewing files that changed from the base of the PR and between bfaf1ad and 9661e2d.

📒 Files selected for processing (5)
  • packages/worker/client/routes/account-mcp-servers.tsx
  • packages/worker/src/app/handlers/account-mcp-servers.node.test.ts
  • packages/worker/src/app/handlers/account-mcp-servers.ts
  • packages/worker/src/mcp-client/hub-oauth-recovery.node.test.ts
  • packages/worker/src/mcp-client/hub.ts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@kentcdodds
kentcdodds marked this pull request as ready for review August 16, 2026 05:10

@cursor cursor Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes using default effort and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit cf89e6c. Configure here.

Comment thread packages/worker/src/mcp-client/hub.ts Resolved
@github-actions

github-actions Bot commented Aug 16, 2026 •

Copy link
Copy Markdown
Contributor

🔎 Preview deployed: https://kody-pr-1464.kody-a99.workers.dev

Worker: kody-pr-1464
Runtime worker: kody-pr-1464-runtime (https://kody-pr-1464-runtime.kody-a99.workers.dev)
D1: kody-pr-1464-db
KV: kody-pr-1464-oauth-kv

Mocks:

Co-authored-by: Kent C. Dodds <me+github@kentcdodds.com>
@kentcdodds
kentcdodds merged commit cbea8ec into main Aug 16, 2026
11 checks passed
@kentcdodds
kentcdodds deleted the cursor/mcp-oauth-self-heal-for-domain-state-700e branch August 16, 2026 05:24
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.

2 participants