[BUG] User-level MCP servers don't load in worktree sessions

Status Open
Maintainer reply None cached
Activity 11 comments · opened Apr 14, 2026

Description

MCP servers configured in ~/.claude/settings.json (user-level) do not load when Claude Code is running inside a git worktree (e.g., claude -w <worktree>). The servers start fine when tested manually and work in regular (non-worktree) sessions.

Steps to Reproduce

  1. Add an MCP server to ~/.claude/settings.json:
{
  "mcpServers": {
    "rescuetime": {
      "command": "fastmcp",
      "args": ["run", "/path/to/server.py"],
      "env": { "API_KEY": "..." }
    }
  }
}
  1. Start a regular Claude Code session in a repo -- MCP tools appear in deferred tools list. Works.
  2. Start a worktree session: claude -w my-worktree (or enter an existing worktree)
  3. MCP tools do NOT appear. ToolSearch returns no matches for the server name.
  4. The server binary runs fine when tested manually from the worktree directory (fastmcp run server.py starts without error).

Expected Behavior

User-level MCP servers from ~/.claude/settings.json should load regardless of whether the session is in a worktree or the main working tree.

Actual Behavior

MCP servers silently fail to connect in worktree sessions. No error is shown. The tools simply don't appear.

Environment

  • Claude Code version: latest (April 2026)
  • macOS (Darwin 25.4.0, arm64)
  • Git worktrees created via claude -w or manually via git worktree add
  • FastMCP 3.2.3 (also reproduced with a uv run based community MCP server)

Additional Context

This is related to a known pattern where worktree sessions also silently skip UserPromptSubmit hooks. It appears worktree sessions may not fully inherit user-level configuration. Project-level settings (.claude/settings.local.json) ARE read, but user-level MCP servers are not connected.

Workaround: duplicate the MCP config into the project-level .claude/settings.local.json, but this is fragile and requires manual sync.

View original on GitHub ↗

7 Comments

github-actions[bot] · 4 months ago

Found 1 possible duplicate issue:

  1. https://github.com/anthropics/claude-code/issues/38914

This issue will be automatically closed as a duplicate in 3 days.

  • If your issue is a duplicate, please close it and 👍 the existing issue instead
  • To prevent auto-closure, add a comment or 👎 this comment

🤖 Generated with Claude Code

adelaidasofia · 4 months ago

Not a duplicate. #38914 is about user-level permissions not inheriting in worktree sessions; this issue is about user-level MCP servers silently failing to connect. Same root cause (worktree config inheritance), but different subsystem and different fix surface. Linking as related.

chris-castillo-dev · 3 months ago

Is this still not fixed? Worktrees are incredibly important and not being able to use MCPs within Worktrees is crippling to the harness' functionality.

dominickbrasileiro · 2 months ago

+1 on this, I'm likely having the same issue with the laravel-boost MCP.

works without a -w <worktree> flag:

  ❯ /mcp                                                                                                                                                                                                                                                                                                                                                                                                                                     
  
  Laravel-boost MCP Server
  
  Status:           ✔ connected

doesn't work with a -w <worktree> flag:
``
❯ /mcp
⎿ Failed to reconnect to laravel-boost: -32000
``

bobweishar · 2 months ago

+1 this is super disruptive

chris-castillo-dev · 1 month ago
Is this still not fixed? Worktrees are incredibly important and not being able to use MCPs within Worktrees is crippling to the harness' functionality.

3 months and no update to this issue? Has this even been confirmed as a bug and added to an action list?

avdi · 1 month ago

I think I'm hitting this too, incredibly annoying.

Showing cached comments. Read the full discussion on GitHub ↗