mcp-git-tools
mcp-git-tools
面向 AI 代理的 Git 仓库分析工具,通过 MCP(Model Context Protocol)提供服务。使用原生 git 命令分析本地仓库——无需 GitHub API。
工具
工具 | 描述 |
| 获取提交历史,支持按作者、日期范围和文件路径筛选 |
| 显示提交、分支或标签之间的差异,并附带变更摘要 |
| 显示文件中每一行的最后修改者及提交信息 |
| 仓库统计:提交数、贡献者、随时间变化的活动、变更最多的文件 |
| 列出分支,包含最后提交信息、领先/落后计数、已合并/未合并状态 |
Related MCP server: mcp-git
前置要求
Node.js >= 18
已安装 Git 且可在 PATH 中使用
安装
npm install
npm run build配置
添加到你的 MCP 客户端配置中:
{
"mcpServers": {
"git-tools": {
"command": "node",
"args": ["D:/products/mcp-servers/mcp-git-tools/dist/index.js"]
}
}
}工具详情
git_log
获取最近的提交历史,支持可选筛选条件。
参数:
repoPath(必填)— Git 仓库的绝对路径count— 要返回的提交数量(默认:20)author— 按作者姓名或邮箱筛选since/until— 日期范围筛选path— 筛选涉及特定文件或目录的提交
git_diff
比较两个引用并获取结构化的变更摘要。
参数:
repoPath(必填)— Git 仓库的绝对路径from— 起始引用(默认:HEAD~1)to— 结束引用(默认:HEAD)path— 将差异限制在特定文件或目录summaryOnly— 仅返回统计信息,不包含完整差异文本
git_blame
查看文件逐行的作者归属。
参数:
repoPath(必填)— Git 仓库的绝对路径filePath(必填)— 相对于仓库根目录的文件路径startLine/endLine— 对特定行范围进行 blameref— 在特定提交处进行 blame
git_stats
获取仓库活动的高层概览。
参数:
repoPath(必填)— Git 仓库的绝对路径topAuthors— 要列出的主要贡献者数量(默认:10)topFiles— 要列出的变更最多的文件数量(默认:10)
git_branch
列出并分析分支。
参数:
repoPath(必填)— Git 仓库的绝对路径baseBranch— 用于比较的分支(默认:main 或 master)includeRemote— 包含远程跟踪分支mergedOnly/unmergedOnly— 按合并状态筛选
许可证
MIT
This server cannot be deployed
Maintenance
Related MCP Connectors
Code intelligence for LLMs. Analyze, search, and retrieve code from any public git repository.
Git-backed platform for skills, tools, and context for AI agents
Read and write KukGit repositories, files, issues and pull requests from an AI assistant.
Connect AI assistants to GitHub - manage repos, issues, PRs, and workflows through natural language.
Related MCP Servers
- FlicenseNot gradedqualityNot gradedmaintenanceEnables AI assistants to interact with local Git repositories for operations like status, commits, branching, and diffs, plus GitHub API integration for managing pull requests when authenticated.-
- AlicenseBqualityDmaintenanceEnables Git repository interaction and automation via LLMs, providing tools to read, search, and manipulate Git repositories.1541 npmMIT
- FlicenseBqualityDmaintenanceEnables AI assistants to inspect local Git repositories and interact with the GitHub API for reading commits, diffs, files, issues, comments, pull requests, and project boards.1091 npm-
- FlicenseNot gradedqualityDmaintenanceEnables analysis of local Git repositories via standard git commands, providing insights like line authorship, commit frequency, code churn, and co-changed files.-