Feature Request: Share MCP authentication across git worktrees

Status Closed — not planned
Maintainer reply None cached
Activity 3 comments · opened Jan 17, 2026 · closed Feb 28, 2026

Problem

When using git worktrees for parallel development, MCP server authentication doesn't carry over between worktrees. Each worktree prompts for re-authentication even though:

  1. MCP OAuth credentials are stored at the user level (~/.claude/.credentials.json)
  2. The .mcp.json server definitions are identical (same repo, just different worktree paths)

Root Cause

Credentials in ~/.claude/.credentials.json are keyed by serverName|hash (e.g., linear|638130d5ab3558f4). This hash appears to incorporate the project path, so a worktree at ../wt-1/ generates a different hash than ./wt2-2/ and doesn't find existing credentials.

Use Case

Many teams use git worktrees to run multiple Claude Code sessions in parallel on different features. Having to re-authenticate 5-7 MCP servers in each new worktree creates significant friction.

Proposed Solutions

  1. Worktree detection: When Claude Code detects it's running in a git worktree, use the main repository's path for credential hash computation instead of the worktree path.
  1. Config option: Add a setting like mcpCredentialRoot that specifies which path to use for credential lookup, allowing users to point all worktrees to a shared credential scope.
  1. Content-based hashing: If the hash was based on .mcp.json contents + server URL (rather than file path), worktrees with identical configs would naturally share credentials.

Environment

  • macOS (though likely affects all platforms)
  • Using HTTP-based MCP servers (Linear, Honeycomb, Figma, Neon, Sentry, etc.)
  • Git worktrees created via git worktree add

Workaround

Currently, users must run /mcp and re-authenticate each server in every new worktree, which is tedious but functional.

View original on GitHub ↗

This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗