Skip to content

git-automated-worktree skill does not copy .mcp.json to new worktrees #1

@WesleyMFrederick

Description

@WesleyMFrederick

Problem

The git-automated-worktree skill creates worktrees via setup-worktree.sh. After worktree creation, MCP servers (DeepWiki, Perplexity, etc.) are unavailable because .mcp.json is missing from the new worktree.

Root Cause

setup-worktree.sh has phases for submodule sync (4.5), dependency install (5), and test validation (7) — but no phase for copying gitignored workspace config files like .mcp.json. Since .mcp.json is gitignored (contains API keys), git worktree add does not include it in the checkout.

Solution

Add a new phase between Phase 4.5 (submodule) and Phase 5 (environment setup) that copies .mcp.json from the source repo root ($PROJECT_ROOT) to the worktree root ($WORKTREE_PATH), if it exists.

Files

  • .claude/scripts/setup-worktree.sh — add copy phase after line 107 (after submodule phase)
  • .claude/skills/git-automated-worktree/SKILL.md — document that .mcp.json is copied

Constraints

  • Do NOT commit .mcp.json to git (contains API keys)
  • Copy only if source file exists (not all repos have .mcp.json)
  • Use cp not symlink — worktrees may diverge in MCP config
  • New phase should follow existing naming convention (e.g., "Phase 4.6: Workspace Config")

Success Criteria

  • After setup-worktree.sh completes, .mcp.json exists in the new worktree if it existed in the source repo
  • If source repo has no .mcp.json, no error is thrown and script continues
  • MCP tools are available in Claude Code sessions started from the worktree
  • .mcp.json remains gitignored

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions