You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
feat(mcp): per-host MCP server list with the mcpServers RPC, behind ORCA_MCP_SERVERS - #48631
Each computer Orca runs agents on gets its own list of MCP servers. A client can add a server, sign in to it once, choose which agents and workspaces get it, and remove it. All of this stays hidden behind a switch that's off by default. No screens yet; later PRs add them and deliver the servers to sessions.
Files
Added
Deleted
Net
Test
2
$\color{#1a7f37}{\Huge{\mathbf{+}}}$136
$\color{#cf222e}{\Huge{\mathbf{−}}}$1
$\color{#1a7f37}{\Huge{\mathbf{+}}}$135
Prod
38
$\color{#1a7f37}{\Huge{\mathbf{+}}}$1181
$\color{#cf222e}{\Huge{\mathbf{−}}}$55
$\color{#1a7f37}{\Huge{\mathbf{+}}}$1126
What Changed
Host list. A bot-tools-shaped file at <userData>/mcp-servers/.orca/bot-tools.json. It reuses the bot-tools file I/O, version and epoch, folder-keyed sealed credentials, and Orca's own OAuth sign-in exactly as they are. Each server's id, agentsOff, workspaces {later, on, off} and sharedProcess ride on the entry's extra keys, which bot-tools writes already keep. Workspace keys are a repo id or folder:<id>, never a worktree id. The consent for agents that read only their own MCP file (agentFiles) is a top-level key.
mcpServers.* RPC. Params are zod schemas in src/shared/rpc-contract/mcp-servers-params.ts, and the catalog is regenerated.
Working now: list, add (paste a URL or command, or editor config), details, update, remove, problems, cancelProblems, signIn.start/wait/finish/cancel, signOut, setAgentEnabled, setWorkspaces, setSharedProcess, agentFiles.allow.
Typed mcp_servers_not_yet until their PRs land: discover, move, copy, sessions.stale, sessions.restart.
Sign-in. Reuses the bots' owned sign-in attempts. Desktop on the same computer uses routed, phones use paste-back. add, and update to a new headerless URL, run the same OAuth discovery as bot tools, so a server that needs a sign-in gets Orca's.
problems. Reuses the bots' Claude Code / Codex CLI check over the host list. Until the relay-principals PR adds host grants, its relay grant uses a reserved owner (mcp-host-list). botOf() never returns a bot for that owner.
mcpServersChanged client event. Emitted after every change and when a host-list sign-in changes state (the sign-in change bus now carries its folder). It reaches local windows (notifier → preload → window event), paired desktops (renderer whitelist → window event) and phones (shared client event).
Phone allowlist. Every mcpServers.* method is routed to the execution host.
Capability mcp-servers.v1. Advertised only while the switch is on.
The switch.isMcpServersFeatureEnabled() returns true only when the host's own env has ORCA_MCP_SERVERS=1. It is read on every call, so a dev build, orca serve or orcad each decides for itself. Turn it on locally with ORCA_MCP_SERVERS=1 pnpm dev, or set it on a serve's environment.
Why
Orca has no MCP server list of its own; only bot folders have one. Every later PR in the MCP servers work (chat and terminal delivery, desktop and phone screens, import from agents, shared processes, plugins) builds on this list and this contract.
Reusing the bot-tools file format in its own folder keeps credentials, the seal, OAuth and the relay keyed by a folder path exactly as they are today. The alternative was refactoring every credential key from a folder to an opaque scope. That would have touched the seal binding and every bot's saved values.
Linked Issue
N/A. Internal feature work (MCP servers in Orca, first of about ten PRs); there is no issue to link.
Visual Proof
N/A. No UI in this PR; the desktop and phone screens come in later PRs.
Testing
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
macOS, against a hidden orca serve built from this branch, driven over RPC with a loopback MCP app that is also its own OAuth server:
Switch on. The capability is advertised. I ran add (command and OAuth URL), a refused taken name, list, paste-back sign-in (signed-in), signOut (signed-out, and mcp_server_no_sign_in on a command server), setAgentEnabled, setWorkspaces (a worktree key is refused), setSharedProcess (refused for HTTP), update of a command server to an OAuth URL (gets Orca's sign-in), a stale editor save (mcp_server_stale), remove, and remove again (mcp_server_gone). A real phone-protocol client (E2EE, clientKind: mobile) paired to the same serve called mcpServers.list through the phone allowlist. It heard one mcpServersChanged per change, including the sign-in completing.
Switch off (gate-off equals main). A fresh serve without the env var advertises no mcp-servers.v1, refuses mcpServers.list and mcpServers.add with mcp_servers_off, and creates no mcp-servers folder. Nothing outside mcpServers.* reads the list, and no session or agent file is touched by this PR.
Tests kept to persistence and security boundaries:
mcp-host-list.test.ts: a server's id, agents and workspaces, plus the agent-file consent, survive edits, a rename and a plain bot-tools write. Header values stay sealed. A switch flipped while the editor is open doesn't make its save stale. A hand-edited entry gets an id once, and an entry whose workspaces can't be read is on nowhere, never everywhere.
bot-tool-relay.test.ts: the host list's relay token reaches its tools but never names a bot.
The existing bot-tools file, OAuth, credentials and relay tests pass unchanged.
Performance
None, because it all runs only when a client calls mcpServers.*, and every method refuses at once while the switch is off. One listener is added to the existing sign-in change bus; it compares a folder path per sign-in change.
Risk
Level: Low
Riskiest part: the shared bot-tools write path. changeBotToolServers now goes through changeBotToolEntries, and extra keys can be set per entry. With no extras given, it carries them over by name and rename exactly as before; the existing bot-tools tests cover that.
Other shared-code changes:botToolsHome is split into toolsHomeFor (same object for bots). readBotToolDetails is split into botToolDetailsOf. The sign-in change listener now receives the folder; the bots' listener ignores it.
Reused synchronous I/O: the new host-list files read the same synchronous credential store bots use, so they get main-blocking-helper baseline rows with notes.
Mixed versions: older clients ignore the new event type, and older hosts don't advertise the capability.
Back out: a plain revert. With the switch off no state is written.
AI Disclosure
Review
Look closest at src/main/bots/bot-tools-file.ts (the shared write path) and src/main/mcp-servers/mcp-host-list.ts.
Known gap for the phone PR: a phone that reaches a remote host through the Mac relay doesn't get that host's mcpServersChanged. The same is true of every execution-host event today, such as botsChanged.
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
Security: the relay token boundary is kept. Header values are sealed as for bot tools. The phone never sends a URL for the host to fetch, only the returned query.
Cross-platform: paths go through node:path.
Remote: the list lives on and is served by the execution host.
Mobile: allowlisted, and gated by the capability.
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)
The changes add host MCP server storage, settings, sign-in support, and RPC methods. Shared contracts define server data and request validation. Bot-tool file updates preserve unknown per-server keys. Runtime and renderer event paths propagate MCP server list changes.
Merge Risk: Low · up to d9868 · assessed changes only
Path filters excluded changed files. This rating applies only to the assessed changes.
Pre-merge checks: 4
Check name
Status
Explanation
Title check
The title names the main change: a per-host MCP server list exposed through the mcpServers RPC, gated behind the ORCA_MCP_SERVERS switch. The changeset adds the host list storage, the RPC methods, sig…
Description check
The description follows the repository template and fills in most sections: ELI5, What Changed, Why, Testing with manual macOS results, Performance, Risk with level Low and a back-out plan, and Notes.…
Linked Issues check
Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check
Check skipped because no linked issues were found for this pull request.
Full details: Title check
Explanation
The title names the main change: a per-host MCP server list exposed through the mcpServers RPC, gated behind the ORCA_MCP_SERVERS switch. The changeset adds the host list storage, the RPC methods, sign-in helpers, and the feature gate, so the title matches the primary change. It is 84 characters, slightly long but still readable and specific.
Full details: Description check
Explanation
The description follows the repository template and fills in most sections: ELI5, What Changed, Why, Testing with manual macOS results, Performance, Risk with level Low and a back-out plan, and Notes. Gaps: the Linked Issue section says N/A with a reason, which the template does not allow for outside contributors, though the author marks the PR as internal. The Visual Proof N/A has a reason. The AI Disclosure section is empty, and the Review section lists files without a required item. The final checklist item for lint, typecheck, test, and build is unchecked with no note on CI status. The Review section's and Testing's automated test claims are reasonable. 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.
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 4 remain after this review.
The reason will be displayed to describe this comment to others. Learn more.
Minor · Functional Correctness · Quick win
Use a new credential when replacing OAuth with headers.
If an OAuth-backed server is saved with an explicit header, resolveBotToolInput returns headers without the OAuth credential ID. However, writeServers reuses the previous credential ID. changeBotToolCredentials then throws toolSignInManaged because that ID still contains OAuth data.
This blocks an HTTP configuration accepted by McpServerUpdate. Allocate a new header credential for this transition. Keep the existing credential ID for header-to-header edits so existing relay addresses continue to work.
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
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.
ELI5
Each computer Orca runs agents on gets its own list of MCP servers. A client can add a server, sign in to it once, choose which agents and workspaces get it, and remove it. All of this stays hidden behind a switch that's off by default. No screens yet; later PRs add them and deliver the servers to sessions.
What Changed
<userData>/mcp-servers/.orca/bot-tools.json. It reuses the bot-tools file I/O, version and epoch, folder-keyed sealed credentials, and Orca's own OAuth sign-in exactly as they are. Each server'sid,agentsOff,workspaces {later, on, off}andsharedProcessride on the entry's extra keys, which bot-tools writes already keep. Workspace keys are a repo id orfolder:<id>, never a worktree id. The consent for agents that read only their own MCP file (agentFiles) is a top-level key.mcpServers.*RPC. Params are zod schemas insrc/shared/rpc-contract/mcp-servers-params.ts, and the catalog is regenerated.list,add(paste a URL or command, or editor config),details,update,remove,problems,cancelProblems,signIn.start/wait/finish/cancel,signOut,setAgentEnabled,setWorkspaces,setSharedProcess,agentFiles.allow.mcp_servers_not_yetuntil their PRs land:discover,move,copy,sessions.stale,sessions.restart.mcp_servers_off,mcp_server_gone,mcp_server_name_taken,mcp_server_stale,mcp_server_no_sign_in,mcp_server_not_command.routed, phones use paste-back.add, andupdateto a new headerless URL, run the same OAuth discovery as bot tools, so a server that needs a sign-in gets Orca's.problems. Reuses the bots' Claude Code / Codex CLI check over the host list. Until the relay-principals PR adds host grants, its relay grant uses a reserved owner (mcp-host-list).botOf()never returns a bot for that owner.mcpServersChangedclient event. Emitted after every change and when a host-list sign-in changes state (the sign-in change bus now carries its folder). It reaches local windows (notifier → preload → window event), paired desktops (renderer whitelist → window event) and phones (shared client event).mcpServers.*method is routed to the execution host.mcp-servers.v1. Advertised only while the switch is on.The switch.
isMcpServersFeatureEnabled()returns true only when the host's own env hasORCA_MCP_SERVERS=1. It is read on every call, so a dev build,orca serveor orcad each decides for itself. Turn it on locally withORCA_MCP_SERVERS=1 pnpm dev, or set it on a serve's environment.Why
Orca has no MCP server list of its own; only bot folders have one. Every later PR in the MCP servers work (chat and terminal delivery, desktop and phone screens, import from agents, shared processes, plugins) builds on this list and this contract.
Reusing the bot-tools file format in its own folder keeps credentials, the seal, OAuth and the relay keyed by a folder path exactly as they are today. The alternative was refactoring every credential key from a folder to an opaque scope. That would have touched the seal binding and every bot's saved values.
Linked Issue
N/A. Internal feature work (MCP servers in Orca, first of about ten PRs); there is no issue to link.
Visual Proof
N/A. No UI in this PR; the desktop and phone screens come in later PRs.
Testing
macOS, against a hidden
orca servebuilt from this branch, driven over RPC with a loopback MCP app that is also its own OAuth server:mcp_server_no_sign_inon a command server),setAgentEnabled,setWorkspaces(a worktree key is refused),setSharedProcess(refused for HTTP), update of a command server to an OAuth URL (gets Orca's sign-in), a stale editor save (mcp_server_stale), remove, and remove again (mcp_server_gone). A real phone-protocol client (E2EE,clientKind: mobile) paired to the same serve calledmcpServers.listthrough the phone allowlist. It heard onemcpServersChangedper change, including the sign-in completing.mcp-servers.v1, refusesmcpServers.listandmcpServers.addwithmcp_servers_off, and creates nomcp-serversfolder. Nothing outsidemcpServers.*reads the list, and no session or agent file is touched by this PR.Tests kept to persistence and security boundaries:
mcp-host-list.test.ts: a server's id, agents and workspaces, plus the agent-file consent, survive edits, a rename and a plain bot-tools write. Header values stay sealed. A switch flipped while the editor is open doesn't make its save stale. A hand-edited entry gets an id once, and an entry whose workspaces can't be read is on nowhere, never everywhere.bot-tool-relay.test.ts: the host list's relay token reaches its tools but never names a bot.Performance
None, because it all runs only when a client calls
mcpServers.*, and every method refuses at once while the switch is off. One listener is added to the existing sign-in change bus; it compares a folder path per sign-in change.Risk
Level: Low
changeBotToolServersnow goes throughchangeBotToolEntries, and extra keys can be set per entry. With no extras given, it carries them over by name and rename exactly as before; the existing bot-tools tests cover that.botToolsHomeis split intotoolsHomeFor(same object for bots).readBotToolDetailsis split intobotToolDetailsOf. The sign-in change listener now receives the folder; the bots' listener ignores it.main-blocking-helperbaseline rows with notes.AI Disclosure
Review
Look closest at
src/main/bots/bot-tools-file.ts(the shared write path) andsrc/main/mcp-servers/mcp-host-list.ts.Known gap for the phone PR: a phone that reaches a remote host through the Mac relay doesn't get that host's
mcpServersChanged. The same is true of every execution-host event today, such asbotsChanged.Agent skill upstream boundary
Notes
node:path.Checklist
N/Awith reasonpnpm lint,pnpm typecheck,pnpm test, andpnpm buildpass (or CI will cover; local preferred)