Skip to content

Conversation

@bborn
Copy link
Owner

@bborn bborn commented Jan 24, 2026

Summary

  • Add symlinkMCPConfig function to symlink project-level .mcp.json files to worktrees, ensuring Claude Code has access to the same MCP servers
  • Add symlinkMCPConfig calls to all worktree setup code paths
  • Fix missing symlinkClaudeConfig call in "already checked out" code path that was preventing .claude directory from being symlinked in certain worktree reuse scenarios
  • Add comprehensive tests for symlinkMCPConfig function

Problem

There were two issues with how worktree Claude configuration was handled:

  1. Missing .mcp.json support: Claude Code supports project-level .mcp.json files for MCP server configuration, but these weren't being symlinked to worktrees. This meant Claude running in a worktree wouldn't have access to project-level MCP servers.

  2. Missing symlinkClaudeConfig in one code path: When a worktree was reused after an "already checked out" error, the .claude directory symlink wasn't being created, potentially causing permission/settings inconsistencies.

Changes

  • Added new symlinkMCPConfig function that symlinks .mcp.json from project root to worktree (only if it exists)
  • Added symlinkMCPConfig calls to all 4 worktree setup code paths
  • Added missing symlinkClaudeConfig call in the "already checked out" code path
  • Added comprehensive unit tests for symlinkMCPConfig

Test plan

  • All existing tests pass
  • New TestSymlinkMCPConfig tests pass (5 test cases covering various scenarios)
  • Build compiles successfully

🤖 Generated with Claude Code

bborn and others added 2 commits January 24, 2026 08:34
Prevent project-level MCP config symlinks from being committed.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
If a project tracks .mcp.json in git, the worktree already has the file
from checkout and we shouldn't replace it with a symlink. This prevents
accidental type changes that could be committed.

Also reverts the .gitignore change since it's no longer needed - the code
now correctly handles both tracked and untracked scenarios.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@bborn bborn force-pushed the task/593-make-sure-project-repo-claude-mcpsetting branch from c2ed4bf to e438a51 Compare January 24, 2026 14:34
@bborn bborn merged commit ac84269 into main Jan 24, 2026
3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants