Skip to content

feat(mcp): check Orca's servers and sign in to them from the /mcp tray before the first message - #51236

Merged
AmoabaKelvin merged 4 commits into
mainfrom
mcp-connect-timing
Nov 27, 2026
Merged

AmoabaKelvin merged 4 commits into
mainfrom
mcp-connect-timing

Conversation

@AmoabaKelvin

@AmoabaKelvin AmoabaKelvin commented Nov 27, 2026 •

Copy link
Copy Markdown
Collaborator

ELI5

Before a chat's first message, /mcp already lists the chat's MCP servers, but every Orca server just waits to connect. Now Orca checks its own servers while the tray is open, so a broken one says why ("Command not found", "Can't reach"). A signed-out server has a Sign in button that works before the chat starts.

Files Added Deleted Net
Test 0 0 0 0
Prod 26 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​477 $\color{#cf222e}{\Huge{\mathbf{−}}}$​115 $\color{#1a7f37}{\Huge{\mathbf{+}}}$​362

What Changed

  • The agent still starts on the first message. Opening a chat starts no agent and no servers.
  • The host's at-rest answer gives each Orca server row an optional orca field: its id in the host list, its URL (null for a command), and whether Orca signs in to it.
  • Sign in at rest. A signed-out server that Orca signs in to gets a Sign in button. It opens Orca's own sign-in: the "Finish in your browser" dialog on desktop, the paste-back sheet on the phone. When it finishes, the tray reads again.
  • Real states at rest. While the tray is open and the chat hasn't started, the tray runs the check the MCP servers settings page already runs (mcpServers.problems, no model turn), on just the servers that chat lists.
    • Rows show "Command not found on " or "Can't reach " on desktop. The phone shows the same reasons in one line: "Command not found" or "Can't reach " (two new English strings; other locales fall back until the next translation pass).
    • A healthy server keeps showing that it connects on send.
    • Orca's own sign-in state wins over the check's for servers Orca signs in to.
    • Only Claude Code and Codex chats take the check's sign-in result, because the check runs as one of those CLIs.
    • The check stops when the tray closes or the agent starts. After the first message, rows switch to live status as before.
  • mcpServers.problems takes optional ids (check only these servers) and requestId. mcpServers.cancelProblems takes an optional requestId, so closing one tray no longer ends another tray's or Settings' check in the same window.
  • A check cancelled while its launch was being prepared no longer opens the Claude CLI.

Why

Kelvin chose this over starting agents early (research in the fleet's connect-timing report). Opening a chat starts no agent, and tools that hold one agent plus its MCP servers per chat don't start them at open either. Starting them would cost one agent and every stdio server for each opened chat, held for 30 minutes. The gap users hit is servers that look fine but won't start, and Orca servers they can't sign in to until after a message. Orca can answer both on its own, without the agent.

Linked Issue

N/A: part of the MCP servers in Orca work (follow-up to #50908).

Visual Proof

Desktop: hidden dev build with ORCA_MCP_SERVERS=1, a fresh Claude chat at rest, four host-list servers: one needs sign-in, one is healthy, one command that doesn't exist, one unreachable URL. The phone shots render the real phone tray in a phone-width web harness with the same rows.

Desktop

Dark Light
Mock (d14) (screenshot removed: contained real product data) (screenshot removed: contained real product data)
Before: Claude at rest (screenshot removed: contained real product data) (screenshot removed: contained real product data)
After: Claude at rest (screenshot removed: contained real product data) (screenshot removed: contained real product data)
After: Sign in from the tray (screenshot removed: contained real product data) (screenshot removed: contained real product data)

Phone

Dark Light
Mock (screenshot removed: contained real product data) (screenshot removed: contained real product data)
Before: Claude at rest (screenshot removed: contained real product data) (screenshot removed: contained real product data)
After: Claude at rest (screenshot removed: contained real product data) (screenshot removed: contained real product data)
After: Codex at rest (screenshot removed: contained real product data) (screenshot removed: contained real product data)
After: Sign in (paste-back sheet) (screenshot removed: contained real product data) (screenshot removed: contained real product data)

Testing

  • macOS, hidden dev build with ORCA_MCP_SERVERS=1:

    • Fresh Claude, Codex and OpenCode chats at rest: within about 4 s, the command row read "Command not found on Local Mac" and the unreachable row read "Can't reach 127.0.0.1:9". The healthy row stayed as is.
    • Sign in on the signed-out row opened Orca's "Finish in your browser" dialog for that server. shell.openExternal was stubbed in the dev main process, so no real browser opened; it received the server's authorize URL.
    • A server switched off for Claude: while the Claude chat's check ran, the check's CLI got only the chat's command server, never that one (read from the process list).
    • After one real message, the Claude tray switched to live status.
  • Gate off equals main: the same profile relaunched without ORCA_MCP_SERVERS showed only "Connect when you send your next message" in a fresh Claude chat. In code, the orca field is set only in withKnownSessionMcpServers, which the agentSession.mcp handler calls only when isMcpServersFeatureEnabled(). The trays start a check only for rows with that field.

  • pnpm check:changed passes. mcp-host-list-health-checks and bot-tools-codex tests pass.

  • I manually tested these changes locally

  • Automated tests added/updated, or explained why not below

  • Every added test fails without this change and avoids the test anti-patterns

No test added: this is UI and RPC wiring, proven live above.

Performance

Only with ORCA_MCP_SERVERS=1, and only while an at-rest chat's /mcp tray is open with Orca servers listed. Each opening runs one check of just that chat's servers: one short-lived agent CLI plus those servers, no model turn. Trays asking at the same moment share one run, and the check stops when the tray closes or the agent starts. Nothing runs on a timer, and a closed tray does no work. The phone reads the host name only while its sign-in sheet is open, from the cached host list.

Risk

Level: Low. Everything new sits behind ORCA_MCP_SERVERS. Only mcp-turn-on (#48972, held) turns it on.

  • Riskiest part: the check starts the chat's command servers for a few seconds when the tray opens at rest, the same as opening the MCP servers settings page.
  • Mixed versions: older clients ignore orca. Older hosts don't send it, so new clients never send ids or requestId to them. An old cancelProblems call keeps its window-wide meaning.
  • Back out with a plain revert.

AI Disclosure

Review

  • src/main/mcp-servers/session-mcp-at-rest.ts adds the orca field.
  • src/main/runtime/rpc/methods/mcp-servers.ts adds the scoped check and per-request cancel.
  • withOrcaMcpProblems in agent-session-mcp-server-presentation.ts maps check results onto rows.

Agent skill upstream boundary

  • Not applicable, or this change copies or mechanically translates no upstream skill-installer source, tests, fixtures, registry entries, path tables, comments, or documentation.

Notes

Ensure no issues in: Security, Cross-platform support (Linux, Windows, Mac), Remote SSH, Mobile, general backwards compatibility, performance

  • Host-side, so remote hosts and phones get the same rows. ids and requestId are limited to [A-Za-z0-9_-].
  • Follow-ups, not in this PR:
    • The check runs from the host-list folder, so a command with a workspace-relative path can read as not found at rest. The settings page has the same limit.
    • The phone tray's check hook repeats the phone MCP page's.
    • A cancel that lands during Claude SDK setup can still start the CLI briefly; it is closed straight away.

Checklist

  • This PR is small and focused
  • I explained what changed and why (ELI5, the user-facing before/after, the mechanism, and why over the alternatives)
  • I stated the risk: what could break, for whom, and how to back it out
  • Before/after screenshots or videos attached for UI changes, or N/A with reason
  • Self-reviewed for correctness, security, and performance
  • Cross-platform, SSH/remote, and path/shortcut impact considered (or N/A)
  • pnpm lint, pnpm typecheck, pnpm test, and pnpm build pass (or CI will cover; local preferred)

@coderabbitai

coderabbitai Bot commented Nov 27, 2026 •

Copy link
Copy Markdown
Contributor

Explain Change →

Walkthrough

Adds Orca metadata to MCP server rows and supports scoped problem checks with request-specific cancellation. Desktop and mobile MCP trays apply returned problems and expose Orca sign-in actions. The changes also add Orca-specific status text, pass agent and host details to the panels, and provide shared mobile host-name and status-mark components.

Merge Risk: Low · up to 96ae6 · assessed changes only

Path filters excluded changed files. This rating applies only to the assessed changes.

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed The title names the main change: adding Orca MCP server checks and sign-in to the /mcp tray before a chat's first message. The changeset adds the host-side orca metadata, the scoped problem check, p…
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 The description is thorough and covers nearly every template section. It has an ELI5, a detailed What Changed list, a Why section that explains the alternative of starting agents early, and a Linked I…
Full details: Title check

Explanation

The title names the main change: adding Orca MCP server checks and sign-in to the /mcp tray before a chat's first message. The changeset adds the host-side orca metadata, the scoped problem check, per-request cancellation, the sign-in action in the tray, and the status text for command-not-found and unreachable servers. The title matches the primary change and uses conventional commit form. It is a long single line, but it stays on topic.

Full details: Description check

Explanation

The description is thorough and covers nearly every template section. It has an ELI5, a detailed What Changed list, a Why section that explains the alternative of starting agents early, and a Linked Issue that says N/A and points to follow-up #50908. Visual Proof includes before/after tables for desktop and phone. Testing lists manual steps on macOS with specific results, and the Performance section is filled in. Risk gives a Low level and a revert plan. The AI Disclosure section is empty, and the Review section is a short list rather than a full review. The Linked Issue is N/A, which the template says should not happen for outside contributors. The author may be a maintainer, which would make this acceptable. Overall the description is mostly complete.

  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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

@coderabbitai coderabbitai 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.

Actionable comments posted: 5

Review info

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: d1963826-0793-4a10-8cb2-6557c90d6b22
Commits

Reviewing files that changed from the base of the PR and between 6b68f10 and 590f1dd.

Files ignored due to path filters: 1

  • src/shared/rpc-contract/rpc-params-catalog.generated.ts is excluded by !**/*.generated.*
Files selected for processing: 24

  • mobile/src/mcp-servers/MobileMcpServersScreen.tsx
  • mobile/src/mcp-servers/MobileMcpSignInSheet.tsx
  • mobile/src/mcp-servers/use-mcp-host-name.ts
  • mobile/src/session/native-chat/mcp/MobileNativeChatMcpPanel.tsx
  • mobile/src/session/native-chat/mcp/MobileNativeChatMcpTray.tsx
  • mobile/src/session/native-chat/mcp/mobile-native-chat-mcp-server-copy.ts
  • mobile/src/session/native-chat/mcp/mobile-native-chat-mcp-status-mark.tsx
  • mobile/src/session/native-chat/mcp/use-mobile-structured-mcp-panel.ts
  • src/main/bots/bot-tools-claude-check.ts
  • src/main/bots/bot-tools-host.ts
  • src/main/mcp-servers/session-mcp-at-rest.ts
  • src/main/runtime/rpc/methods/mcp-servers.ts
  • src/renderer/src/components/native-chat/composer/submit/native-chat-structured-composer-transport.ts
  • src/renderer/src/components/native-chat/composer/submit/use-native-chat-structured-composer-transport.ts
  • src/renderer/src/components/native-chat/mcp/NativeChatMcpServerRow.tsx
  • src/renderer/src/components/native-chat/mcp/NativeChatMcpTray.tsx
  • src/renderer/src/components/native-chat/mcp/native-chat-mcp-server-text.ts
  • src/renderer/src/components/native-chat/mcp/use-orca-mcp-problems.ts
  • src/renderer/src/components/native-chat/pane/actions/NativeChatStructuredComposerTabStrips.tsx
  • src/renderer/src/components/settings/mcp-servers/mcp-server-words.ts
  • src/renderer/src/runtime/mcp-servers/mcp-servers-client.ts
  • src/shared/agent-session/options/protocol/agent-session-mcp.ts
  • src/shared/agent-session/view/agent-session-mcp-server-presentation.ts
  • src/shared/rpc-contract/mcp-servers-params.ts

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 0 remain after this review.

Comment on lines +62 to +63
useEffect(() => {
if (!client || !ids) {

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.

Minor · Functional Correctness · Quick win

Clear completed problems when the check changes.

If a completed check marks server A as failed, a later ID-set change retains that verdict. If the replacement check rejects, the empty catch leaves the old map active. The tray then shows A as failed instead of using the host-listed status promised by Line 80.

Clear the previous results when a new check starts, or store results with their client, agent and ID key. Keep the live guard for obsolete pending replies.

Comment on lines +68 to +72
const params = {
...(agent === 'claude' || agent === 'codex' ? { agent } : {}),
ids: ids.split(','),
requestId
}

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.

Major · Functional Correctness · Quick win

Preserve the literal type of params.agent.

The conditional spread widens params.agent to string | undefined. The request accepts only "claude" | "codex" | undefined. Mobile Checks reports TS2345 at Line 74, which blocks the mobile typecheck workflow.

Give params the RPC input type, or explicitly type the optional agent as the literal union. Keep the agent omitted for other chats.

Sources: Linters/SAST tools, Pipeline failures

Comment on lines +89 to +93
const problems = useOrcaMcpProblems(
target,
agent,
managed ? uncheckedOrcaMcpServerIds(panel.servers) : ''
)

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.

Minor · Functional Correctness · Quick win

Refresh problem checks when /mcp refreshes the tray.

If a server fails its check, then becomes reachable, running /mcp again leaves the old failure visible. opens refreshes the panel, but the raw server remains not-started. Its IDs therefore stay unchanged, and useOrcaMcpProblems does not run again.

Pass the opening/refresh generation to the problem hook and include it in the effect dependencies.

ids: string
): Readonly<Record<string, BotToolProblem>> {
const host = useStableMcpTarget(target)
const [problems, setProblems] = useState(NONE)

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.

Minor · Functional Correctness · Quick win

Invalidate problem results when the check scope changes.

If server A fails a check, then the user disables and enables A, this hook retains A's earlier failure. If A becomes reachable while disabled, the old failure still overrides the new not-started row. If the new check rejects, that stale failure remains indefinitely.

Clear or scope problems when host, agent, or ids changes. Preserve the live guard for late responses.

const notTheirs = server.orca?.signsIn || (agent !== 'claude' && agent !== 'codex')
return !problem || problem.kind === 'unconfirmed' || (problem.kind === 'sign-in' && notTheirs)
? server
: { ...server, status: problem.kind === 'sign-in' ? 'needs-auth' : 'failed' }

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.

Minor · Functional Correctness · Quick win

Preserve the check's failure detail.

If Claude managed settings refuse MCP servers, the check returns kind: 'failed' with an explanation. This projection discards that explanation and leaves error null. Desktop rows then report “Command not found” or “Can’t reach,” although neither cause was established.

Accept optional detail in the problem type and copy it to error for failed results. Keep the existing fallback when no detail is available.

@coderabbitai coderabbitai 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.

Actionable comments posted: 1

Review info

Run configuration

  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Repository UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: c7cd764c-021a-4f7c-95fd-a50b7e7e1a96
Commits

Reviewing files that changed from the base of the PR and between 590f1dd and 96ae68f.

Files selected for processing: 3

  • mobile/src/i18n/locales/en.json
  • mobile/src/session/native-chat/mcp/MobileNativeChatMcpTray.tsx
  • mobile/src/session/native-chat/mcp/mobile-native-chat-mcp-server-copy.ts

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 1 remain after this review.

Comment on lines +51 to +52
return server.orca.url === null
? t('chat.mcp.status.commandNotFound', 'Command not found')

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.

Minor · Functional Correctness · Quick win

Don't present a generic failed check result as "Command not found".

The Orca check reports failed without a cause. withOrcaMcpProblems keeps that status but does not add error. For a command-backed server, orca.url is null, so this branch shows "Command not found". That text can appear when the command exists and fails during MCP startup. The same branch also receives other failed results, such as a managed-settings refusal or an "Off" state, because it does not read the reason.

Show the text that matches only what the check established. Either pass the failure reason to the row, or use the generic failure text for failed Orca rows. Only show "Command not found" when the check reports a missing executable.

@AmoabaKelvin
AmoabaKelvin merged commit 2a929a3 into main Nov 27, 2026
59 checks passed
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.

1 participant