Skip to content

Make onboarding responsive to MCP connection state - #810

Merged
kody-bot merged 3 commits into
mainfrom
onboarding-connected-state
Jul 20, 2026
Merged

kody-bot merged 3 commits into
mainfrom
onboarding-connected-state

Conversation

@kentcdodds

@kentcdodds kentcdodds commented Jul 20, 2026 •

Copy link
Copy Markdown
Owner

Summary

  • Reorder onboarding into three numbered steps with the discovery prompt first: 1. discovery, 2. add Kody as an MCP server, 3. install a starter package.
  • Once an MCP client is connected, steps 1 and 2 collapse into native <details> cards ("Done — open to revisit") so only the starter packages remain expanded; while the page is open, it polls /onboarding.json every 5s (visible tab, logged in, not yet connected) so the UI reacts without a refresh.
  • Move the bring-your-own-keys explainer below the starter packages.
  • Remove the "Back to account · Secrets · Integrations" footer links (sign up / log in links remain for logged-out visitors).

Test plan

  • npm run typecheck, npm run lint, npm run format:check
  • Playwright: e2e/community-featured.spec.ts, e2e/invite-signup-verification.spec.ts
  • CI green

Made with Cursor

System recap — composes existing primitives (low risk)

Mode: recap · Base: main @ 24f871c6 · Head: 6361f328

Classification: composes — no primitives added or changed; this PR rearranges the onboarding UI and polls an existing JSON endpoint.

Primitives touched

Primitive Group Impact
app-ui surfaces composes — onboarding route layout + client-side polling, one file

System map

The onboarding page in the browser app polls the existing onboarding JSON endpoint to detect a new MCP OAuth grant and collapses completed steps in place.

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)"]:::touched
	oauthGrants["mcp-oauth<br/>Inbound MCP OAuth"]:::untouched
	appUi -->|"GET /onboarding.json every 5s until hasMcpClient"| oauthGrants
	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

Before / after

Onboarding section order (before) After
Discovery prompt (unnumbered) 1. Discovery prompt (collapses once connected)
1. Add Kody as an MCP server 2. Add Kody as an MCP server (collapses too)
BYOK explainer 3. Install a starter package
2. Install a starter package BYOK explainer
Back to account · Secrets · Integrations (removed; sign up / log in kept for logged out)

Summary by CodeRabbit

  • New Features
    • Onboarding now automatically checks for authorization updates and updates the UI as soon as an MCP client becomes available.
    • Onboarding steps 1–2 can collapse after connection (with an easy “Done — open to revisit” summary), with improved step ordering and content.
    • Bottom onboarding links now show sign up / log in only when not signed in.
  • Bug Fixes
    • Prevented unnecessary background polling when the page is hidden, the user is not logged in, navigating away, another poll is already running, or the component is no longer ready.

kentcdodds and others added 2 commits July 20, 2026 13:45
Reorder onboarding into three steps with discovery first, collapse the
first two steps into details cards once an MCP client is connected, move
the BYOK explainer below the starter packages, and drop the account
footer links.

Co-authored-by: Cursor <cursoragent@cursor.com>
The onboarding page only learned about a new MCP OAuth grant on load or
navigation, so users watching the page while their client connected
never saw the UI react. Poll the onboarding JSON endpoint every few
seconds (visible tab, logged in, not yet connected) and apply the
payload once a grant appears.

Co-authored-by: Cursor <cursoragent@cursor.com>
@coderabbitai

coderabbitai Bot commented Jul 20, 2026 •

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

The onboarding route polls for MCP authorization, applies refreshed onboarding state, renders completed steps as collapsible details, updates connected-state content, and shows sign-up or log-in links only for unauthenticated visitors.

Changes

Onboarding flow

Layer / File(s) Summary
MCP connection polling
packages/worker/client/routes/onboarding.tsx
The route polls the onboarding endpoint every five seconds and applies successful payloads while respecting visibility, authentication, connection, navigation, readiness, and abort conditions.
Connection-aware onboarding rendering
packages/worker/client/routes/onboarding.tsx
Steps 1 and 2 use collapsible details after connection, connected-state text and step ordering are updated, collapsed-step styling is added, and unauthenticated footer links replace logged-in account navigation.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Possibly related PRs

Sequence Diagram(s)

sequenceDiagram
  participant Visitor
  participant OnboardingRoute
  participant OnboardingEndpoint
  participant Document
  Visitor->>OnboardingRoute: Open onboarding page
  OnboardingRoute->>Document: Check visibility and current path
  OnboardingRoute->>OnboardingEndpoint: Poll onboarding payload
  OnboardingEndpoint-->>OnboardingRoute: Return MCP connection state
  OnboardingRoute->>OnboardingRoute: Apply payload and render steps
  OnboardingRoute-->>Visitor: Show connected or collapsible onboarding UI
Loading
🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately summarizes the main change: onboarding now adapts to MCP connection state.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch onboarding-connected-state

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.

@kody-bot
kody-bot marked this pull request as ready for review July 20, 2026 19:53
@github-actions

github-actions Bot commented Jul 20, 2026 •

Copy link
Copy Markdown
Contributor

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

Worker: kody-pr-810
D1: kody-pr-810-db
KV: kody-pr-810-oauth-kv

Mocks:

@kentcdodds

Copy link
Copy Markdown
Owner Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Jul 20, 2026 •

Copy link
Copy Markdown
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@packages/worker/client/routes/onboarding.tsx`:
- Around line 155-176: Update pollForMcpConnection and its interval setup to
track an in-flight request with an isPolling lock, skipping ticks while a fetch
is pending and always releasing the lock afterward. Retain the existing guards
and clear the polling interval immediately when a successful payload reports
hasMcpClient, while also preserving abort cleanup.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 44dbc95f-5008-4e43-9fd8-46e8fc075588

📥 Commits

Reviewing files that changed from the base of the PR and between 24f871c and 467b9db.

📒 Files selected for processing (1)
  • packages/worker/client/routes/onboarding.tsx

Comment thread packages/worker/client/routes/onboarding.tsx
Review feedback: track an in-flight flag so slow responses cannot
overlap, and clear the interval after a grant is detected instead of
ticking forever.

Co-authored-by: Cursor <cursoragent@cursor.com>

@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 6361f32. Configure here.

<span mix={css(collapsedStepHintCss)}>Done — open to revisit</span>
</summary>
{input.children}
</details>

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.

Discovery hash stays collapsed

Medium Severity

When hasMcpClient is true, the discovery step renders as a closed details element with id="discovery". Navigating to /onboarding#discovery (for example from the home page discovery link) scrolls to that element but leaves the prompt hidden until the user manually expands the card.

Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 6361f32. Configure here.

@kody-bot
kody-bot merged commit 044a22b into main Jul 20, 2026
5 of 7 checks passed
@kody-bot
kody-bot deleted the onboarding-connected-state branch July 20, 2026 20:39
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