claude-code
claude-code copied to clipboard
MCP Configuration Unexpectedly Deleted From File During Auto-Update
Bug Description Claude Code seems to frequently delete my MCP server configuration in ~/.claude.json, and I need to rebuild it from scratch. It's incredibly irritating, as I don't necessarily have offhand the information to recreate the servers, because I don't expect Claude Code to delete it! I suspect it's happening when there's an auto-update, but there isn't really indication of this... I do know that I will also get prompted with some basic setup info (color scheme, trust files, terminal-setup) and then I'll run /mcp and all of a sudden no servers are found.
Otherwise, awesome tool, love you all! ❤
Environment Info
- Platform: macos
- Terminal: Apple_Terminal
- Version: 1.0.17
- Feedback ID:
Errors
[{"error":"AxiosError: Request failed with status code 401\n at uH (file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:528:1070)\n at IncomingMessage.wA (file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:529:9969)\n at IncomingMessage.emit (node:events:519:35)\n at IncomingMessage.emit (node:domain:489:12)\n at endReadableNT (node:internal/streams/readable:1696:12)\n at process.processTicksAndRejections (node:internal/process/task_queues:90:21)\n at ec.request (file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:531:2081)\n at process.processTicksAndRejections (node:internal/process/task_queues:105:5)\n at async qV5 (file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:1945:600)\n at async Promise.all (index 0)\n at async file:///opt/homebrew/lib/node_modules/@anthropic-ai/claude-code/cli.js:1931:19563","timestamp":"2025-06-08T11:57:51.449Z"}]
(I think the errors are from the failure to submit a bug report through /bug but aren't related to this)
This happened to me running claude code cli in wsl. Figured I'd provide the additional info. Unbelievable coding agent!!!
Can confirm this has happened to me after an update this morning.
Happens to me too, we should be able to kick off @claude on this issue to help them fix it!
Hi, sorry to hear this. Did it just happen randomly during a session?
I'm having the same issue. To recreate: Start WSL CLI and set up MCP server. Then start new WSL session on another window/tab and it'll be gone.
Just had this happen to me too, I thought I was going crazy
I simply opened a new Claude Code session in another tab in WSL. Maybe some concurrency issues, older tab taking over, etc etc?
Related - https://github.com/issues/created?issue=anthropics%7Cclaude-code%7C1983
Same here!
I had imported the mcp from Claude desktop and fortunately it doesn't delete the config file there.
For anyone suffering this issue, here's at least a quick way to get your mcp working again (IF it's an mcp in claud desktop):
claude mcp remove mcp-name
claude mcp add-from-claude-desktop -s user
# then, pick the mcp from the list
Same here!
I had imported the mcp from Claude desktop and fortunately it doesn't delete the config file there.
For anyone suffering this issue, here's at least a quick way to get your mcp working again (IF it's an mcp in claud desktop):
claude mcp remove mcp-name claude mcp add-from-claude-desktop -s user # then, pick the mcp from the list
That's interesting; I assumed this was linux specific. Have done similar in the interim though (saved mcp json body to file and run a bash script to re-add it to config).
Can confirm.
Not only lost mcp server configurations but all project data saved inside ~/.claude.json on MacOS 15.5 running Claude Code under zsh+iterm. Claude Code is installed locally under ~/.claude/local. My ~/.claude/settings.json is just an empty obj.
After the problematic update, claude.json contained only:
{
"autoUpdaterStatus": "migrated"
}
I used a Time Machine backup to get the last working configuration replacing the above, ran claude update where latest version 1.0.25 was confirmed as already installed, started inside a project and it was "back to normal". File size is quite large though:
~|⇒ du -h .claude.json
656K .claude.json
~|⇒
OK this is killing me now. Very consistently when a new terminal is opened all existing terminals lose their mcps. Anyone have a workaround?
This happened to me today.
I can add back my old ~/.claude.json then run the claude executable and watch the file get deleted again.
But I did figure out why it’s happening.
If you have a JSON error in your config when you run claude, it immediately exits, and shows you this:
However, if you scroll up, you’ll see this:
This is moot at this point, because your config has already been deleted and claude already exited.
It took me about 5 times to realize this dialog was displaying above the prompt in my shell.
tldr, look for an error in your config file
mine was actually a commented out line, which is invalid JSON in most cases! I had forgotten that since vscode allows comments in JSON config files.
also could be root cause of #1983
When this happens, are you using multiple Claude Code sessions in different terminal tabs?
No. Give me a bit and I’ll post a screen recording.
@ashwin-ant probably should’ve shown the ps aux at the beginning instead of end, but just trust me, no other claude was running
the configuration error is really hard to notice! (and pointless since claude’s already dead at that point)
https://github.com/user-attachments/assets/09c64fff-9ab4-4476-95b4-0fa08243f13e
@mculp thank you, really appreciate the detailed bug report. We have a fix on the way, I'll update this issue once it's released.
Hey all, this should be fixed in version 1.0.31. Sorry for the delay here, please keep the feedback coming!
@ashwin-ant just happened to me during update to 1.0.34
Same here!
I had imported the mcp from Claude desktop and fortunately it doesn't delete the config file there.
For anyone suffering this issue, here's at least a quick way to get your mcp working again (IF it's an mcp in claud desktop):
claude mcp remove mcp-name claude mcp add-from-claude-desktop -s user # then, pick the mcp from the list
You saved my life, MCPs dissapeared after todays update too but luckily I also had them in claude desktop
Is this back? My mcps are wiping every terminal load again (was working fine past few days).
Is this back? My mcps are wiping every terminal load again (was working fine past few days).
Every new update claude code wipes all my MCP so im constantly having to have a backup on my claude desktop so I can re-add them
claude mcp add-from-claude-desktop -s user
# then, pick the mcp from the list
Is it strictly your MCP servers that get wiped, or is it also that you're getting logged out completely? We have a known issue with people getting fully logged out that sometimes occurs when you have multiple Claude sessions running. Is that what you're seeing @josephsimo?
Is it strictly your MCP servers that get wiped, or is it also that you're getting logged out completely? We have a known issue with people getting fully logged out that sometimes occurs when you have multiple Claude sessions running. Is that what you're seeing @josephsimo?
Everything is fine, then I see on x that there is a new update, I open terminal, type Claude and I'm logged out...I can see an update was made, I login again and all my mcps are gone, everything else including the .md is intact.
Has happened 3 times in a row now, new update, I'm logged out, login and MCPs are wiped.
Same here, happened multiple times already - after logging out my MCPs get wiped out. 1.0.43 (Claude Code)
This just started happening out of the blue for me yesterday on both macOS and Linux.
yea, my MCPs keep disappearing everytime i close and reopen WSL. It remembers my account and other settings tho! The .claude.json file still exists at the same location with the same file content (even including the MCP conf) but claude code doesnt load the MCPs.
Everyday my sub-agents get super confused when I tell them to use MCP. Turns out MCP’s been deleted 😂
My MCPs are getting cleared after several hours. I imported them from claude desktop.
This issue has been automatically locked since it was closed and has not had any activity for 7 days. If you're experiencing a similar issue, please file a new issue and reference this one if it's relevant.