🔀

Git MCP Server

✓ 官方/认证

Anthropic (官方)

暴露本地 Git 仓库的 read-only 信息:日志、差异、分支、状态、stash

10.1k
GitHub Stars
stdio
安装方式
MIT
开源协议
7
可用工具

📖 详细介绍

Anthropic 官方 Git MCP Server,让 AI 助手能查询本地 Git 仓库的元数据,包括 commit 历史、分支、diff、stash 内容等。默认只读模式(可配置写入),是 AI 配对编程时理解代码变更历史的必备工具。

核心特性

完整 Git 历史查询
支持 diff 比对
可配置写入操作
Python 实现轻量高效
官方维护

🛠️ 可用工具 (7)

git_log()
git_diff()
git_show()
git_status()
git_branch_list()
git_blame()
git_stash_list()

🎯 适用场景

AI 解释代码变更
自动生成 commit message
代码审查辅助
分支管理
历史溯源

⚙️ 安装与配置

系统要求

  • Python 3.10+
  • Git 2.20+
  • uvx (推荐)

安装命令

uvx mcp-server-git --repository /path/to/git/repo

Claude Desktop 配置 (claude_desktop_config.json)

{
  "mcpServers": {
    "git-mcp-server": {
      "command": "uvx",
      "args": [
        "mcp-server-git",
        "--repository",
        "/path/to/git/repo"
      ]
    }
  }
}

🔗 相关链接

🧩 相关 MCP Servers

浏览更多 开发与代码 MCP

Git MCP Server开发与代码 分类下的 MCP server 之一