User-scope MCP server (`mcp add --scope user`) silently disappeared from `~/.claude.json` under heavy concurrent session load
What happened
I added an MCP server at user scope from a terminal session:
claude mcp add --scope user --transport sse linear https://mcp.linear.app/sse
It worked in that session. Some time later it was simply gone: the top-levelmcpServers block in ~/.claude.json was back to {}, with no error, no prompt,
and nothing in the logs. The mcp add command is still in my shell history, so I
know it ran — the server just isn't in the config anymore.
Environment
- Claude Code:
2.1.162 - macOS 15.2 (arm64)
- Concurrency: this is the key detail. I run a lot of Claude Code at once. As
I write this there are 16 main Claude Code CLI processes live (27 total
Claude-related processes counting helpers). That's driven by
TaskYou, which runs a fleet of background
Claude Code agents in parallel git worktrees (127 active task worktrees) on
the machine right now. So at almost any moment there are many processes
reading and writing ~/.claude.json simultaneously.
What I could observe
- The top-level
mcpServersin the live config is empty; the server is absent. - None of the rotating
~/.claude/backups/.claude.json.backup.*snapshots
contain the server either — so it looks like it never survived a save cycle long
enough to be captured, rather than being present-then-removed in a way the
backups would have caught.
- There are a handful of
~/.claude/backups/.claude.json.corrupted.*files from
earlier dates (one truncated to ~720 bytes), which suggests the config has
occasionally ended up in a bad state under this load — though I can't tie those
specific files to this particular loss.
Hypothesis / question
Given the concurrency, my guess is some kind of last-writer interaction: one process
adds the user-scope server, but another long-lived process — started earlier, with
an older in-memory view of the config — writes ~/.claude.json back out afterward
and the freshly added mcpServers entry doesn't make it into that write.
Does that sound plausible? Specifically:
- Under many concurrent writers, can a newly added top-level
mcpServersentry be
lost when another session persists config based on a snapshot taken before the
add?
- Is there anything a user can do to make a user-scope
mcp addmore likely to
survive (e.g. is it safe to add MCP servers while other sessions are running, or
should they be quiesced first)?
Related issues
- #43000 (open) — forced MCP re-auth with multiple terminals open. Same trigger
(many concurrent instances), different mechanism (OAuth token keyed by callback
URL/port). I hit that one constantly under the load described above, so the two are
likely siblings: concurrent instances stepping on shared MCP state in ~/.claude.json
/ credentials.
- #59368 (open) — locally added MCP servers silently overwritten with no merge.
Same "overwrite without merge" theme, but on Claude Desktop team cloud sync rather
than concurrent CLI sessions.
This issue has 1 comment on GitHub. Read the full discussion on GitHub ↗