Skip to content
Source
Sign inSign up
pingdotgg/t3code

feat(settings): list the MCP servers Claude Code loads #5227

Closedjash90(GitHub profile, opens in a new tab)wants to merge 9 commits intomain fromrefs/pull/5227/headopened View on GitHub

What Changed

Adds Settings → MCP: a read-only listing of the MCP servers Claude Code loads, on every connected computer, so you can see them without opening a terminal or a config file.

  • apps/server/src/mcpServers/ reads Claude Code's own config — user scope and workspace local scope from .claude.json, plus approved .mcp.json project servers. Reading the files directly avoids claude mcp list, which health-checks every server over the network and is far too slow for a settings page. Nothing is ever written back.
  • GET /api/mcp-servers on the environment HTTP API, with the matching client-runtime accessor. Per-environment, so local, relay, and tunnel all work the same way.
  • The page groups by computer and then by provider instance, with transport and scope badges, the redacted command line or address, and a click-to-copy config path.

Two things the read is deliberate about:

  • complete is load-bearing. It goes false whenever a config exists but cannot be parsed, and whenever no workspace cwd was supplied — the local and project scopes are unreadable then, so the list is knowingly partial. A later caller that replaces the CLI's own resolution with --strict-mcp-config must refuse to act on an incomplete list, or it will silently drop working servers. An unreadable config is reported on its own channel rather than as a property of rows, because it usually yields no rows at all and the empty state would otherwise claim there are no servers.
  • Nothing secret crosses the wire. env is never serialised. Arguments and URLs go through a shape allowlist plus a credential-flag check — neither alone is enough: shape catches postgres://u:p@host/db and Authorization: Bearer … but would happily print a bare hunter2, while a flag blocklist catches --token secret but misses everything positional. Server names are stripped of control characters and length-bounded, since a U+202E override reorders how a row reads on screen.

Only Claude is covered. Codex needs a codex mcp list --json subprocess; Cursor, Grok, and OpenCode run over ACP, which can add a server to a session but never reports the ones the agent loads from its own config, so listing them would be misleading.

Why

This is a rebased, re-scoped port of #4634, which @juliusmarminge closed on 2026-07-30:

Several of these are real gaps we still want fixed; the base just moved out from under them. Once #2829 merges, please rebase onto main, port the change to the V2 equivalent, and reopen (or open a fresh PR).

#2829 is still open and currently conflicted, and the gap is still open too — #277. T3 Code injects itself into every session as an MCP server but gives users no view of the ones their own harness loads. So this targets today's main, and is packaged to survive the V2 migration rather than to dodge it:

  • Everything substantive lives in modules V2 keeps: apps/server/src/mcpServers/, packages/contracts/, packages/client-runtime/, apps/web/.
  • This PR does not touch ClaudeAdapter.ts or CodexAdapter.ts at all — the files V2 replaces. It is pure discovery plus a settings page; nothing in the session launch path changes.

Happy to re-cut against V2 the moment #2829 lands. Turning servers off is deliberately not in this PR — that is where the adapter changes live, and it is worth its own review.

Per-surface decisions

  • Entry points. Sidebar nav and the Settings search catalog. The section is anchored via searchableSetting, so a search hit scrolls to it. The command palette has no settings navigation today, so nothing to add there.
  • Providers. Claude only, for the reason above. Codex is a follow-up; ACP harnesses are not listable.
  • Clients. Web and desktop. Mobile has no Providers screen either, so MCP is out of scope there.
  • Connection modes. One collapsible group per environment, each issuing its own authenticated HTTP request; a response from a replaced connection is dropped rather than written over live data.
  • Reverse states. "Refresh all" re-reads from disk, so a config edited outside T3 Code shows up.
  • Docs. docs/user/mcp.md linked from docs/README.md, a docs/internals/providers.md section, and two glossary entries — docs/ had no mention of MCP before this.

Verification

vp test run on the touched files (83 passing across 14 files), vp lint and vp fmt on the changed scope, and typecheck on @t3tools/contracts, @t3tools/client-runtime, t3, and @t3tools/web. routeTree.gen.ts is generator output, not hand-edited.

Exercised against a real 25-server config in the desktop app, plus adversarial configs: __proto__/constructor as server names (no prototype pollution — Object.entries and a Map, never assignment), command as an array or number, null entries, unknown transports, 5000 levels of nesting, and a 12 MB config against the 8 MB read guard. All degrade rather than throw; the empty-state fix above came out of that pass.

UI Changes

Checklist

  • This PR is small and focused
  • I explained what changed and why
  • I included before/after screenshots for any UI changes
  • I included a video for animation/interaction changes — n/a, no motion

Claude Opus 5 (1M context), via Claude Code.


Note

Medium Risk New authenticated remote endpoint surfaces filesystem-derived MCP config metadata; redaction and incomplete-read handling must stay correct so secrets are not leaked and partial lists are not mistaken for empty configs. Session launch is unchanged.

Overview Adds Settings → MCP and a read-only GET /api/mcp-servers path so each connected environment can report which MCP servers Claude Code would load from its own config—without writing harness files or changing session launch.

Server: New mcpServers modules parse .claude.json (user + workspace local scopes) and approved .mcp.json project entries, mirroring Claude’s scope precedence and CLAUDE_CONFIG_DIR / symlink behavior. Reads return a complete flag and per-file unreadable signals when parsing fails or workspace scopes were skipped. Inventory rows redact stdio args and remote URLs, sanitize display names, and aggregate across enabled Claude provider instances.

Contracts & client: McpServerInventory types and client-runtime fetchEnvironmentMcpInventory call the authenticated environment HTTP API.

Web: /settings/mcp lists servers per environment with search, refresh, grouping, copyable config paths, and warnings when configs could not be fully read. Docs and nav/search entries are updated.

Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit 1598fd564ccd0c773a7b7f2afead98a1c032ef98. Bugbot is set up for automated code reviews on this repo. Configure [here](https://www.cursor.com/dashboard/bugbot).

Note

Add MCP servers settings page listing servers loaded by Claude Code

  • Adds a new /settings/mcp route and McpServersSettings component that lists MCP servers across all connected environments, with search and refresh support.
  • Introduces a GET /api/mcp-servers endpoint backed by discoverGlobalMcpInventory, which reads user, project, and local scope configs from Claude's .claude.json and .mcp.json files.
  • Servers are grouped by harness/provider instance, showing transport, scope, status, and a redacted detail string; config paths are copyable and shortened for display.
  • Unreadable or malformed config files are surfaced as warnings rather than silently dropped.
  • Risk: credential redaction in stdio command args relies on heuristic flag-name matching, so edge cases may leak or over-redact values.
Macroscope summarized 1598fd5.
    1. coderabbitai[bot](GitHub profile, opens in a new tab)commented

      Important

      Review skipped

      Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

      ⚙️ Run configuration

      Configuration used: Repository UI

      Review profile: CHILL

      Plan: Pro Plus

      Run ID: 050886b4-05b5-4882-b5f9-ca29b475efed

      You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

      Use the checkbox below for a quick retry:

      • 🔍 Trigger review

      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.
    2. github-actions[bot](GitHub profile, opens in a new tab) added labelsvouch:unvouched

    3. macroscopeapp[bot](GitHub profile, opens in a new tab)commented

      Approvability

      Verdict: Not approved

      Macroscope's review found this PR not approvable — New feature adding a Settings → MCP page with a new API endpoint, config file parsing, and credential redaction logic. The scope and new capability warrant human review.

      You can add or adjust custom eligibility rules. [Learn more](https://docs.macroscope.com/approvability#example-custom-eligibility-rules).
    4. Cursor Bugbot has reviewed your changes using high 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](https://www.cursor.com/dashboard/bugbot). Reviewed by [Cursor Bugbot](https://cursor.com/bugbot) for commit 5b900833bd7425a3b0d4c690ebabb1b6713cc1bc. Configure [here](https://www.cursor.com/dashboard/bugbot).
    5. Reviewed the new Settings → MCP UI (McpServersSettings.tsx, McpServersSettings.logic.ts, route + search registration) against the shared component system.

      Two findings, both in apps/web/src/components/settings/McpServersSettings.tsx: a local badge span that reconstructs the Badge primitive, and a raw <button> for the copy-path action that drops the interaction semantics Button owns (pointer cursor, focus-visible ring, coarse-pointer hit target). Everything else — SettingsPageContainer/SettingsSection composition, Input (nativeInput + type="search"), the Button header action, sidebar/search registration, and the full-width disclosure row (a semantic row, not a Button reconstruction) — matches existing settings conventions.

      Posted via Macroscope — UI Consistency
      @@ -0,0 +283,21 @@
      283+ ) : null}
      284+ </div>
      285+ {server.detail ? (
      286+ <p className="truncate text-muted-foreground/70 text-xs" title={server.detail}>
      287+ {server.detail}
      288+ </p>
      289+ ) : null}
      290+ </div>
      291+
      292+ {configPath ? (
      293+ <button
      294+ type="button"
      295+ className="shrink-0 text-muted-foreground/70 text-xs hover:text-foreground"
      296+ title={configPath}
      297+ onClick={() => onCopyConfigPath(configPath)}
      298+ >
      299+ <span className="inline-flex items-center gap-1">
      300+ <CopyIcon className="size-3" aria-hidden />
      301+ {formatMcpConfigPath(configPath)}
      302+ </span>
      303+ </button>
      macroscopeapp[bot](GitHub profile, opens in a new tab)commented

      This raw <button> recreates a ghost Button but without the behavior the primitive owns: cursor-pointer (Tailwind v4 gives buttons cursor: default, which is why buttonVariants sets it explicitly), the focus-visible ring, and the pointer-coarse 44px hit-target pseudo-element — so on touch this copy target is only ~16px tall. Consider using the already-imported Button and keeping only colour/spacing at the call site.

      Suggested change
      293- <button
      294- type="button"
      295- className="shrink-0 text-muted-foreground/70 text-xs hover:text-foreground"
      296- title={configPath}
      297- onClick={() => onCopyConfigPath(configPath)}
      298- >
      299- <span className="inline-flex items-center gap-1">
      300- <CopyIcon className="size-3" aria-hidden />
      301- {formatMcpConfigPath(configPath)}
      302- </span>
      303- </button>
      293+ <Button
      294+ variant="ghost"
      295+ size="xs"
      296+ className="shrink-0 gap-1 px-1 text-muted-foreground/70 text-xs hover:text-foreground"
      297+ title={configPath}
      298+ aria-label={`Copy config path ${configPath}`}
      299+ onClick={() => onCopyConfigPath(configPath)}
      300+ >
      301+ <CopyIcon className="size-3" aria-hidden />
      302+ {formatMcpConfigPath(configPath)}
      303+ </Button>
      Posted via Macroscope — UI Consistency
      @@ -0,0 +235,21 @@
      235+ server={server}
      236+ onCopyConfigPath={copyConfigPath}
      237+ />
      238+ ))}
      239+ </div>
      240+ ))}
      241+ </>
      242+ )}
      243+ </div>
      244+ )}
      245+ </div>
      246+ );
      247+}
      248+
      249+function RowBadge({ children }: { children: string }) {
      250+ return (
      251+ <span className="shrink-0 rounded border border-border/60 px-1 text-[10px] text-muted-foreground/80 uppercase">
      252+ {children}
      253+ </span>
      254+ );
      255+}
      macroscopeapp[bot](GitHub profile, opens in a new tab)commented

      RowBadge reconstructs the Badge primitive (border, radius, small caps chip) locally, while the rest of settings renders these chips through Badge (ProviderInstanceCard.tsx, SourceControlSettings.tsx, AddProviderInstanceDialog.tsx all use <Badge size="sm" …>). Reusing it keeps radius, height, and coarse-pointer/interactive handling on the shared contract, with only the muted/uppercase tone at the call site.

      +import { Badge } from "../ui/badge";
       
       function RowBadge({ children }: { children: string }) {
         return (
      -    <span className="shrink-0 rounded border border-border/60 px-1 text-[10px] text-muted-foreground/80 uppercase">
      -      {children}
      -    </span>
      +    <Badge variant="outline" size="sm" className="shrink-0 text-muted-foreground/80 uppercase">
      +      {children}
      +    </Badge>
         );
       }
      Posted via Macroscope — UI Consistency
    6. Note

      🤖 GPT-5.6 Sol responding on behalf of Theo

      We're closing this PR as we clean up the T3 Code backlog. Thank you for taking the time to put this together.

      This reimplements Claude Code's MCP configuration rules across 1,819 lines to show a read-only list in Settings. Claude can change those rules independently, which leaves T3 Code maintaining precedence, redaction, and incomplete-state behavior across the full stack.

      If you believe we closed this in error, please reopen the PR and leave a comment explaining what we missed.

Sign in to join this conversation.