fix(chat): list the MCP servers Claude loads in the /mcp picker
Refs #10144.
What
In a Claude chat, /mcp did not list servers added with claude mcp add in a workspace. The chat agent did load them; only the picker was wrong. Claude Code keeps local scope under the repository's main checkout, and the picker looked under the worktree path.
The picker now resolves the project the way the CLI does:
- real path, repository root, and the main checkout (or bare repository) of a linked worktree
.mcp.jsonfrom every parent directory- servers rejected in user, project or local
settings.jsonshow as disabled - a name in several scopes is listed once: local, then project, then user
Walkthrough with before/after screenshots and the edge-case table: https://app.superset.sh/page/10144-mcp-misses-servers-added-with-claude-mcp-add-wt7ex0
Verified
- Compared the picker with what the Agent SDK loads over 21 scratch setups: 3 matched on main, 21 match here.
- Dev desktop app over CDP: the picker and a new chat's agent agree for a local, a project and a rejected server.
bun test src/trpc/router/agent-toolinginpackages/host-servicepasses; typecheck and lint are clean.
Not done
- A chat whose agent config sets its own
CLAUDE_CONFIG_DIR: the picker only gets the preset, so it can read a different.claude.jsonfrom the agent. - claude.ai connectors and Claude Code plugin servers are not listed.
- Codex lookup is unchanged.
- The issue text blames
settingSources: []. That is the legacyclaude-codeharness; new chats run over ACP with--setting-sources=user,project,local.
This change was written and tested by an agent and has not had a human review yet.
Summary by cubic
Fixes the /mcp picker in Claude chats so it lists the MCP servers Claude actually loads in a git worktree.
Previously, the picker looked up Claude's local scope under the workspace path, but Claude Code keys it by repository root. In a linked worktree the picker missed servers added with claude mcp add, and read per-project disabled lists from the wrong entry.
- Resolves the project like the CLI does: real path, repository root, and the main checkout or bare repository of a linked worktree.
- Reads
.mcp.jsonfrom every parent directory, matching the CLI's loader. - Marks servers rejected via
disabledMcpjsonServersin user, project, or localsettings.jsonas disabled. - Lists a name once, preferring local scope, then project, then user.