Skip to content

feat(config): Claude Code adapter (~/.claude.json) [D1]#117

Merged
m1ngshum merged 1 commit into
mainfrom
feat/claude-code-adapter
Jul 3, 2026
Merged

feat(config): Claude Code adapter (~/.claude.json) [D1]#117
m1ngshum merged 1 commit into
mainfrom
feat/claude-code-adapter

Conversation

@m1ngshum

@m1ngshum m1ngshum commented Jul 3, 2026

Copy link
Copy Markdown
Member

What

mcpm now manages MCP servers for Claude Code — the single most widely-used MCP host — as a first-class client (--client claude-code), reading and writing the user-global mcpServers map in ~/.claude.json.

This is Wave 1's #1 adoption lever from docs/ROADMAP-ADOPTION.md: until now mcpm couldn't manage the most common host, so a huge share of MCP users had no reason to reach for it.

How

~/.claude.json uses the same top-level mcpServers root key as every other client, so ClaudeCodeAdapter is a rootKey-only BaseAdapter subclass — no new I/O logic, it inherits the atomic write + .bak backup + symlink guards. Registration:

  • CLIENT_IDS tuple + getConfigPath case (~/.claude.json, home-relative on all platforms) — src/config/paths.ts
  • src/config/adapters/claude-code.ts (new), factory case, barrel export
  • the two Record<ClientId, string> label maps (doctor, guard/cli) — surfaced by the exhaustiveness tripwire
  • the hardcoded CLIENT_IDS duplicate in completions.ts

detect / install / remove / audit / sync --check / up / guard all pick it up automatically via the factory.

Scope

User-global only. Per-project servers (projects[<path>].mcpServers) are intentionally out of scope — that nested shape doesn't fit the single-rootKey model and is a separate feature. Writes preserve every unrelated key in the file (projects, oauthAccount, numStartups, …).

Distinct from the existing claude-desktop client (different app, different file). Zero new deps.

Tests

  • clientId + ~/.claude.json path (darwin/linux/win32 — home-relative, not under APPDATA, unlike claude-desktop)
  • the sibling-key-preservation invariant that matters most for this file
  • Verified end-to-end against the built CLI: doctor detects it ("config found, 1 server"), disable writes the flag, and projects/oauthAccount/numStartups all survive the write.

Full suite green (the 2 pre-existing darwin-local fails — secrets-migrate-count, chalk-TTY — are unrelated and pass on ubuntu CI).

mcpm now manages MCP servers for Claude Code — the most widely-used MCP host —
as a first-class client (`--client claude-code`), reading/writing the
user-global `mcpServers` map in ~/.claude.json.

Because ~/.claude.json uses the same top-level `mcpServers` root key as every
other client, ClaudeCodeAdapter is a rootKey-only BaseAdapter subclass — no new
I/O logic. Registration is the CLIENT_IDS tuple + factory + barrel + the two
Record<ClientId> label maps (doctor, guard/cli) + the completions duplicate;
detection/install/remove/audit/sync/up/guard all pick it up via the factory.

Scope: user-global only. Per-project servers (projects[<path>].mcpServers) are
intentionally out of scope — that nested shape doesn't fit the single-rootKey
model and is a separate feature. Writes preserve every unrelated key in the file
(projects, oauthAccount, numStartups, …) via the existing atomic
read-modify-write + .bak backup.

Distinct from claude-desktop (different app, different file). Zero new deps.

Tests: clientId + ~/.claude.json path (all platforms, home-relative not appData)
+ the sibling-key-preservation invariant. Verified end-to-end against the built
CLI: doctor detects it, disable writes the flag, all unrelated keys survive.
@m1ngshum m1ngshum merged commit 293c36e into main Jul 3, 2026
8 checks passed
@m1ngshum m1ngshum deleted the feat/claude-code-adapter branch July 3, 2026 03:11
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