Git工作树守护工具

MCP服务器强制执行每个分支一个工作树的Git工作流程,防止在主工作树中进行代码更改,确保所有开发都在专用工作树中进行。

  • by paolino
  • TypeScript
  • 本地部署
  • 更新于
在 GitHub 查看 paolino/mcp-worktree-guard

使用说明

mcp工作台防护装置

MCP服务器强制每个分支工作流使用git工作树。

防止主工作树中的代码更改,确保所有开发都在专用工作树中进行。

安装

添加到您的Claude Code MCP设置中(~/.claude/settings.json):

{
  "mcpServers": {
    "worktree-guard": {
      "command": "npx",
      "args": ["-y", "mcp-worktree-guard"]
    }
  }
}

或者从源代码构建:

git clone https://github.com/paolino/mcp-worktree-guard
cd mcp-worktree-guard
npm install && npm run build

然后配置:

{
  "mcpServers": {
    "worktree-guard": {
      "command": "node",
      "args": ["/path/to/mcp-worktree-guard/dist/src/index.js"]
    }
  }
}

工具

工具 目的
detect-worktree 检测路径是否为主/分支工作树或不是仓库
guard-file 检查是否允许修改文件
list-worktrees 列出存储库的所有工作树
create-worktree 为问题/特征分支创建新的工作台

许可证

麻省理工学院