worktree-tools-mcp
Click on "Install Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@worktree-tools-mcpCreate a worktree for ticket CO-1234 called payment integration"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
Worktree Tools MCP Server
MCP server for automated git worktree management with Claude. Enables Claude to create, manage, and clean up git worktrees automatically.
Features
Automatic username detection - From GitHub CLI or git config
Full worktree management - Create, list, cleanup worktrees
Dependency installation - Auto-detects and runs pnpm/npm/yarn
.env file copying - Automatically copies environment files
GitHub integration - Create PRs directly from worktrees
Status checking - Check if worktrees are clean and ready for PR
Related MCP server: MCP Git/PR Assist
Installation
Option 1: npm (Global)
npm install -g worktree-tools-mcpOption 2: Install from GitHub
npm install -g git+https://github.com/georgeasoto/worktree-tools-mcp.gitOption 3: npx (No Installation)
Use directly with npx:
npx -y git+https://github.com/georgeasoto/worktree-tools-mcp.gitOption 4: Local Development
git clone https://github.com/georgeasoto/worktree-tools-mcp.git
cd worktree-tools-mcp
npm install
npm run build
npm linkConfiguration for Claude Code
Add to your Claude Code configuration file (typically ~/.config/Claude/claude_desktop_config.json or similar):
Option 1: Using npx (Recommended - Always up to date)
{
"mcpServers": {
"worktree-tools": {
"command": "npx",
"args": ["-y", "git+https://github.com/georgeasoto/worktree-tools-mcp.git"]
}
}
}Option 2: If installed globally
{
"mcpServers": {
"worktree-tools": {
"command": "worktree-tools-mcp"
}
}
}Option 3: Local development
{
"mcpServers": {
"worktree-tools": {
"command": "node",
"args": ["/Users/YOUR_USERNAME/worktree-tools-mcp/dist/index.js"]
}
}
}After adding the configuration, restart Claude Code to enable the MCP server.
Available Tools
create_worktree
Create a new git worktree with automatic setup.
Parameters:
ticket(required): Ticket number (e.g., "CO-4493", "PROJ-123")branchName(required): Branch name (spaces converted to hyphens)cwd(optional): Working directory (defaults to current)openIde(optional): Open in IDE after creation ("cursor", "vscode", "auto")
Example:
{
"ticket": "CO-4493",
"branchName": "billing feature"
}What it does:
Auto-detects username from GitHub CLI or git config
Creates worktree at
../<repo-name>-worktrees/username/TICKET/branch-nameCreates branch:
username/TICKET/branch-nameFetches latest changes from origin/master
Auto-detects and installs dependencies (pnpm/npm/yarn)
Copies all .env files from main repo
list_worktrees
List all worktrees with status information.
Parameters:
cwd(optional): Working directory
Returns:
Array of worktrees with branch, path, and status
Status includes: clean/dirty, commits ahead/behind
cleanup_worktree
Remove a worktree and optionally delete its branch.
Parameters:
worktreePath(required): Path to worktree to removedeleteBranch(optional): Also delete the local branch (default: false)cwd(optional): Working directory
What it does:
Removes the worktree directory
Optionally deletes the local branch
Cleans up empty parent directories
worktree_status
Get the status of a worktree.
Parameters:
worktreePath(required): Path to worktree to check
Returns:
Clean/dirty status
Commits ahead/behind master
Ready for PR status
Human-readable message
create_pr
Create a GitHub pull request from a worktree.
Parameters:
worktreePath(required): Path to worktreetitle(optional): PR title (auto-generated from commits if not provided)body(optional): PR body (auto-generated if not provided)draft(optional): Create as draft PR (default: false)
Requirements:
GitHub CLI must be authenticated (
gh auth login)Or set
GITHUB_TOKENenvironment variable
Returns:
PR URL
PR number
PR title
Usage Examples with Claude
Once configured, Claude can automatically manage worktrees:
Example 1: Create a new worktree
User: "Create a worktree for ticket CO-1234 called payment integration"
Claude: [calls create_worktree tool]
Claude: "I've created a new worktree at ~/repos/myproject-worktrees/username/CO-1234/payment-integration
with dependencies installed and .env files copied. The worktree is ready to use."Example 2: List all worktrees
User: "Show me all my active worktrees"
Claude: [calls list_worktrees tool]
Claude: "You have 3 active worktrees:
1. CO-1234/payment-integration - 5 commits ahead, clean
2. CO-5678/user-dashboard - 2 commits ahead, uncommitted changes
3. CO-9012/api-refactor - up to date"Example 3: Create PR from worktree
User: "Create a PR for my payment integration work"
Claude: [calls create_pr tool]
Claude: "I've created PR #123: 'Add payment integration'
URL: https://github.com/org/repo/pull/123"Example 4: Clean up worktree
User: "Clean up the payment integration worktree"
Claude: [calls cleanup_worktree tool with deleteBranch: true]
Claude: "I've removed the worktree and deleted the local branch."Username Detection
Usernames are automatically detected with this priority:
Manual override - From
.worktree-configfile in repo rootGitHub CLI - Uses
gh api user --jq .loginGit config - Converts
user.nameto username format (lowercase, hyphens)
If detection fails, you'll get a clear error message with instructions.
Directory Structure
Worktrees are organized as:
~/repos/
├── myproject/ (main repository)
└── myproject-worktrees/ (all worktrees)
└── username/
├── CO-1234/
│ └── payment-integration/
└── CO-5678/
└── user-dashboard/Development
# Install dependencies
npm install
# Run in development mode
npm run dev
# Build
npm run build
# Test the MCP server
npm run build && node dist/index.jsCompanion Bash Scripts
This MCP server complements the worktree-tools bash scripts (located at ~/.checkout-scripts/ or ~/.worktree-tools/). You can use both:
Bash scripts - For manual CLI usage
MCP server - For Claude automation
Both implement the same logic and can be used interchangeably. The bash scripts provide a zero-dependency CLI interface, while the MCP server enables Claude to automate worktree operations.
Requirements
Node.js 18+
Git
Optional: GitHub CLI (
gh) for better username detection and PR creationOptional:
pnpm,npm, oryarnfor dependency installation
License
MIT
Available Tools
5 toolscleanup_worktreeA
Remove a git worktree and optionally delete its branch. Automatically cleans up empty parent directories.
| Name | Required | Description | Default |
|---|---|---|---|
| cwd | No | Optional: Working directory (defaults to current directory) | |
| deleteBranch | No | Optional: Also delete the local branch (default: false) | |
| worktreePath | Yes | Path to the worktree to remove |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
No annotations provided, so description carries full burden. It discloses the removal action, optional branch deletion, and automatic cleanup of parent directories. Could mention error behavior or idempotency.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
Two concise sentences, no wasted words. Front-loaded with the primary action, followed by a key behavioral detail.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
Covers the main behavior and additional cleanup, but lacks details on error cases, return value, or preconditions. With no output schema, description could be slightly more complete.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
100% schema coverage provides basic parameter meanings. Description adds value by explaining the optional deleteBranch behavior and the automatic cleanup, going beyond the schema.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
Clearly states the verb (remove), resource (git worktree), and adds optional branch deletion and automatic cleanup of empty parent directories. Distinguishes from sibling tools like create_worktree and list_worktrees.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
No explicit guidance on when to use this tool versus alternatives or any prerequisites. The description only states what it does, not when it should be used.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
create_prA
Create a GitHub pull request from the current worktree. Auto-generates title and body from commits if not provided. Requires GitHub authentication (GITHUB_TOKEN env var or gh CLI).
| Name | Required | Description | Default |
|---|---|---|---|
| body | No | Optional: PR body (auto-generated from commits if not provided) | |
| draft | No | Optional: Create as draft PR (default: false) | |
| title | No | Optional: PR title (auto-generated from commits if not provided) | |
| worktreePath | Yes | Path to the worktree |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
Since no annotations are provided, the description carries full burden. It discloses auto-generation of title/body from commits and auth requirements. However, it does not mention whether the branch is pushed automatically, what happens on success/failure, or if any user confirmation is needed. This leaves some behavioral gaps.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
Two sentences with no unnecessary words. The first sentence states the core purpose, the second adds key behavioral and prerequisite details. Efficiently front-loaded.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
The description covers purpose and a key prerequisite, but lacks information on return value (e.g., does it return a PR URL?), error handling, and whether the branch is pushed. Given no output schema, the description should provide more context on what to expect after invocation.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Schema description coverage is 100%, so the schema already documents each parameter. The description repeats that title and body can be auto-generated, but adds no new meaning beyond the schema. The phrase 'from the current worktree' could be clearer in relation to the worktreePath parameter.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description clearly states the verb ('Create') and resource ('GitHub pull request from the current worktree'). It differentiates from sibling worktree management tools by focusing on PR creation and mentions auto-generation of title and body, which specifies its unique behavior.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The description explicitly states a prerequisite: 'Requires GitHub authentication (GITHUB_TOKEN env var or gh CLI)'. It provides clear context that this tool is for creating PRs from worktrees, but does not specify when not to use it or list alternative tools for similar tasks.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
create_worktreeA
Create a new git worktree with automatic setup. Auto-detects username from GitHub/git, installs dependencies, and copies .env files. Worktrees are created at ../-worktrees/username/TICKET/branch-name
| Name | Required | Description | Default |
|---|---|---|---|
| cwd | No | Optional: Working directory (defaults to current directory) | |
| ticket | Yes | Ticket number (e.g., CO-4493, PROJ-123) | |
| openIde | No | Optional: Open worktree in IDE after creation | |
| branchName | Yes | Branch name (spaces will be converted to hyphens, e.g., "billing feature" -> "billing-feature") |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
No annotations are provided, so the description must disclose behavioral traits. It mentions auto-detection, dependency installation, and .env copying, but does not cover prerequisites (e.g., existing git repo), error handling, or potential side effects.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is three sentences, front-loads the main action, and contains no redundant information. Every sentence adds value.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
Given 4 parameters, no output schema, and no nested objects, the description covers the tool's purpose, behavior, and output path. It lacks details on error conditions or prerequisites, but is otherwise complete for a creation tool.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Schema coverage is 100%, so the baseline is 3. The description adds context about automated setup beyond parameter descriptions, but does not significantly enhance parameter-level understanding beyond what the schema already provides.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description clearly states the tool creates a git worktree with automatic setup, including auto-detection of username, dependency installation, and .env copying. It distinguishes from siblings like list_worktrees or cleanup_worktree by focusing on creation.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The description implies usage for creating worktrees but does not explicitly state when to use this tool versus alternatives like create_pr or list_worktrees. No when-not-to-use or exclusion criteria are provided.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
list_worktreesA
List all git worktrees with their status information. Shows branch name, path, uncommitted changes, and commits ahead/behind master.
| Name | Required | Description | Default |
|---|---|---|---|
| cwd | No | Optional: Working directory (defaults to current directory) |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
No annotations provided, so description carries full burden. It lists output fields but does not mention read-only nature, prerequisites (e.g., being in a git repo), or potential errors. Adequate but could be more explicit.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
Two sentences front-loading purpose and then details. No extraneous words; every sentence provides value.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
Given one optional parameter and no output schema, the description is fairly complete. It explains the tool's output and behavior. Could mention requirement for git repository, but not essential.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Schema covers cwd parameter with description 'Optional: Working directory (defaults to current directory)'. Description adds no extra parameter meaning. Schema coverage is 100%, so baseline score is 3.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
Clearly states verb 'List' and resource 'git worktrees', specifies output fields (branch, path, uncommitted changes, commits ahead/behind master), and distinguishes from sibling tools like cleanup_worktree and create_worktree.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
Describes what the tool does but lacks explicit guidance on when to use vs alternatives like worktree_status or when not to use it. Usage is implied but not explicit.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
worktree_statusA
Get the status of a worktree. Shows if working directory is clean, commits ahead/behind master, and if ready for PR.
| Name | Required | Description | Default |
|---|---|---|---|
| worktreePath | Yes | Path to the worktree to check |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
With no annotations provided, the description carries the full burden. It describes the output content but does not disclose potential side effects, authentication needs, error handling, or return format. Adequate but not detailed.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is two sentences, front-loaded with the main action, and every word adds value. No unnecessary information.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
Given the tool's simplicity (single parameter, no output schema), the description covers the essential purpose and output. Minor omission: no mention of error conditions or return format, but still largely complete.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Schema coverage is 100% with one parameter fully described. The description adds no extra meaning beyond the schema; baseline 3 is appropriate.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description clearly states the tool's purpose with a specific verb ('Get') and resource ('status of a worktree'). It elaborates on what the status includes (clean, ahead/behind master, ready for PR), distinguishing it from siblings like list_worktrees or create_worktree.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The description implies when to use (checking worktree status) but does not explicitly state when not to use it or provide alternatives. No guidance on prerequisites or exclusions.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections. Dates show when Glama detected each change.
5 tool updates
v1.0.0- First observed
cleanup_worktree - First observed
create_pr - First observed
create_worktree - First observed
list_worktrees - First observed
worktree_status
TDQS
Each tool has a distinct purpose (create, list, status, cleanup, PR creation) with no overlap. Agents can clearly differentiate them.
Most tools follow verb_noun pattern (create_worktree, list_worktrees, cleanup_worktree), but worktree_status deviates with noun_noun, causing minor inconsistency.
5 tools is well-scoped for a worktree management server, covering creation, listing, status, cleanup, and PR creation without excess or deficiency.
Core worktree lifecycle is covered (create, list, status, delete via cleanup), but missing a tool to update/sync an existing worktree, leaving a minor gap.
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Related MCP Connectors
Connect AI assistants to GitHub - manage repos, issues, PRs, and workflows through natural language.
Source-checked CLI guides and model-aware planning for Claude Code, Codex, and Grok Build.
Persistent memory for Claude Code and Cursor. Stop re-explaining your project every session.
Cross-agent artifact workspace with provenance across Claude Code, Codex, Cursor, LangGraph.
Related MCP Servers
- FlicenseNot gradedqualityDmaintenanceAutomates git worktree management with iTerm2 integration for Claude Code, allowing users to create, manage, and close git worktrees in isolated environments with automatic tab handling.12-
- -licenseNot gradedqualityNot gradedmaintenanceEnables Git and GitHub pull request operations through Claude AI, including repository management, branch operations, commits, and PR creation/commenting. Streamlines development workflows by providing Git commands and GitHub API integration through natural language interactions.-
- FlicenseNot gradedqualityDmaintenanceEnables to interact with GitHub repositories directly from Claude, supporting actions like viewing repos, checking status, committing and pushing changes, and managing pull requests.-
- FlicenseAqualityBmaintenanceAutomates GitHub workflows (branch creation, testing, commit/push, PR) through natural language instructions in Claude Code.8-
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/georgeasoto/worktree-tools-mcp'
If you have feedback or need assistance with the MCP directory API, please join our Discord server