claude-code - 💡(How to fix) Fix [BUG] MCP server config changes in .mcp.json not picked up after restart — old config cached indefinitely (Windows) [1 comments, 2 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
anthropics/claude-code#47880Fetched 2026-04-15 06:39:40
View on GitHub
Comments
1
Participants
2
Timeline
4
Reactions
0
Timeline (top)
labeled ×3commented ×1

Error Message

Actual: Old config/cached error is returned indefinitely When ~/.claude/.mcp.json is modified and Claude Code is restarted, the updated MCP server configuration should be used. The new server command should be spawned and any previously cached server state or error should be cleared.

Error Messages/Logs

The new script is never executed — the old server config and its cached error are returned indefinitely

Root Cause

Add a Bitbucket MCP server to ~/.claude/.mcp.json with command: "npx" and credentials in the env block Restart Claude Code Call a Bitbucket MCP tool — it fails with "Authentication failed" because the env block credentials are not passed to the subprocess on Windows Change the server command to node pointing to a local script that hardcodes the credentials Restart Claude Code The new script is never executed — the old server config and its cached error are returned indefinitely Confirmed by writing a sentinel file at process startup that is never created when Claude Code spawns the server, but IS created when the script is run manually

Fix Action

Fix / Workaround

Workaround: None found. The env block in .mcp.json is also not passed to the subprocess on Windows, causing authentication failures even when the correct token is configured.

RAW_BUFFERClick to expand / collapse

Preflight Checklist

  • I have searched existing issues and this hasn't been reported yet
  • This is a single bug report (please file separate reports for different bugs)
  • I am using the latest version of Claude Code

What's Wrong?

Platform: Windows 11, Claude Code desktop app + VS Code extension

Bug: When the bitbucket MCP server config in ~/.claude/.mcp.json is changed (e.g. from npx to node), Claude Code continues using the old server config after restart. The new command is never spawned — confirmed by a sentinel file that the new process would write on startup, which is never created.

Steps to reproduce:

  1. Add an MCP server to ~/.claude/.mcp.json with command: "npx"
  2. Restart Claude Code — server starts, tools load
  3. Change the same server's command to node with a different script
  4. Restart Claude Code
  5. The new script is never executed — old server behaviour persists

Expected: New config is used after restart Actual: Old config/cached error is returned indefinitely

Workaround: None found. The env block in .mcp.json is also not passed to the subprocess on Windows, causing authentication failures even when the correct token is configured.

Additional context: Querying the API directly from a Bash tool subprocess works fine — the token is valid and the server works when invoked manually. The issue is specific to how Claude Code spawns and caches MCP server processes.

What Should Happen?

When ~/.claude/.mcp.json is modified and Claude Code is restarted, the updated MCP server configuration should be used. The new server command should be spawned and any previously cached server state or error should be cleared.

Error Messages/Logs

Steps to Reproduce

Add a Bitbucket MCP server to ~/.claude/.mcp.json with command: "npx" and credentials in the env block Restart Claude Code Call a Bitbucket MCP tool — it fails with "Authentication failed" because the env block credentials are not passed to the subprocess on Windows Change the server command to node pointing to a local script that hardcodes the credentials Restart Claude Code The new script is never executed — the old server config and its cached error are returned indefinitely Confirmed by writing a sentinel file at process startup that is never created when Claude Code spawns the server, but IS created when the script is run manually

Claude Model

Sonnet (default)

Is this a regression?

I don't know

Last Working Version

No response

Claude Code Version

Version 1.2278.0 (e5213f)

Platform

Anthropic API

Operating System

Windows

Terminal/Shell

Windows Terminal

Additional Information

No response

extent analysis

TL;DR

The issue can be potentially resolved by clearing the cached server state or error after modifying the MCP server configuration in ~/.claude/.mcp.json and restarting Claude Code.

Guidance

  • Verify that the ~/.claude/.mcp.json file is being read correctly by Claude Code after restart by checking for any file system or permissions issues.
  • Check if there are any environment variables or cache files that need to be cleared or updated when the MCP server configuration is changed.
  • Investigate if the issue is related to how Claude Code spawns and caches MCP server processes on Windows, and if there are any platform-specific workarounds.
  • Consider adding logging or debugging statements to the MCP server script to verify if it is being executed with the correct configuration and environment variables.

Example

No code snippet is provided as the issue is more related to configuration and caching.

Notes

The issue seems to be specific to the Windows platform and the Claude Code desktop app + VS Code extension. The fact that querying the API directly from a Bash tool subprocess works fine suggests that the issue is not with the API or the token, but rather with how Claude Code interacts with the MCP server process.

Recommendation

Apply a workaround to clear the cached server state or error after modifying the MCP server configuration, as the root cause of the issue is not entirely clear. This could involve manually deleting cache files or modifying the Claude Code configuration to disable caching.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING