Labsco
bnomei logo

WTP - Worktree Plus

from bnomei

Let agents manage Git worktrees via the wtp CLI.

๐Ÿ”ฅ๐Ÿ”ฅ๐Ÿ”ฅโœ“ VerifiedFreeQuick setup

wtp-mcp-rs

Crates.io Version CI Crates.io Downloads License Discord Buymecoffee

A Model Context Protocol (MCP) server for wtp (Worktree Plus), written in Rust. It lets AI assistants manage Git worktrees via the wtp CLI.

For:

  • Rust users who want cargo install and a native CLI.
  • npm users who want npm install -g with prebuilt platform binaries.
  • Git users who want safe, scriptable worktree automation.

Works in any Git repo. The wtp binary is required and must be on PATH (or set via --wtp-path / config).

Highlights

  • Safety defaults: Hooks and branch deletion are disabled by default and must be explicitly enabled.
  • Rich resources: Query worktree lists, resolved paths, grouped views, and repo overview.

Tools

  • list-worktrees - List all worktrees in the repository
  • add-worktree - Create a new worktree for an existing or new branch
  • remove-worktree - Remove a worktree (optionally with its branch)
  • merge-worktree - Return a git merge command for a worktree branch
  • init-config - Initialize wtp configuration in the repository
  • get-worktree-path - Get the absolute path to a worktree
  • shell-hook - Get shell hook script (bash/zsh/fish)
  • shell-init - Get shell initialization script (bash/zsh/fish)

Resources

The server exposes the following MCP resources:

URIDescription
wtp://worktreesList of all worktrees (raw)
wtp://worktrees/resolvedList of worktrees with resolved absolute paths
wtp://worktree/{name}Details for a specific worktree
wtp://overviewRepository overview with worktrees and security settings
wtp://worktrees/by-branch-prefixWorktrees grouped by branch prefix (feature/, bugfix/, etc.)

Skill

skills/git-worktree-plus-with-mcp/SKILL.md: Use this skill when the user wants to manage Git worktrees through the wtp MCP server (list, create, remove, resolve paths, init .wtp.yml, or prepare merge commands), especially when safety defaults around hooks and branch deletion matter.

Development

Running Tests

Unit tests (no wtp required):

Copy & paste โ€” that's it
cargo test --lib

Integration tests (requires wtp installed; tests skip if missing):

Copy & paste โ€” that's it
cargo test --test integration

License

MIT License - see LICENSE for details.