git-worktree-mcp

Mandalorian007/git-worktree-mcp

3.1

If you are the rightful owner of git-worktree-mcp and would like to certify it and/or have it hosted online, please leave a comment on the right or send an email to henry@mcphub.com.

The Git Worktree MCP Server is designed to manage git worktrees through AI assistants, enabling the creation of isolated feature environments with automatic configuration copying.

Git Worktree MCP Server

Manage git worktrees through AI assistants. Create isolated feature environments with automatic config copying.

Features

  • create_feature_worktree - Create isolated worktree with feature branch
  • list_worktrees - Show all active worktrees
  • cleanup_worktree - Safe removal with uncommitted change checks
  • get_worktree_status - Check branch status and changes

Setup

  1. Add to Claude Desktop config:
{
  "mcpServers": {
    "git-worktree": {
      "command": "npx",
      "args": ["github:Mandalorian007/git-worktree-mcp"]
    }
  }
}
  1. Ask Claude to:
  • "Create a worktree for user-auth feature"
  • "List my worktrees"
  • "Clean up the user-auth worktree"
  • "Check worktree status"

Claude Code Workflow

Perfect for switching between features while using Claude Code CLI:

# Create worktree via MCP
# Navigate to new worktree directory
cd .worktree/user-auth

# Start Claude Code in the worktree directory
export $(cat .env | xargs) && claude

Each worktree gets its own .env, .claude/, and config files automatically. Launch Claude Code from within the worktree directory to work on that specific feature in isolation.

What it does

  • Creates .worktree/feature-name with feature/feature-name branch
  • Copies .env*, .mcp.json, .claude/, .vscode/ files automatically
  • Safe cleanup with uncommitted change detection

Requirements

  • Node.js 18+
  • Git repository