git
官方by modelcontextprotocol·★ 85,748·综合分 75
功能全面的 Git 操作 MCP 服务器,支持状态查看、差异比较、提交和分支管理。
概述
此 MCP 服务器通过模型上下文协议提供全面的 Git 仓库交互工具。它包含一套完整的操作,包括检查仓库状态、查看未暂存和已暂存的更改、比较分支或提交、创建提交、暂存文件、重置更改、浏览提交日志、创建和检出分支以及检查提交内容。服务器支持本地仓库路径和 Docker 配置,适用于不同的开发环境。
试试问 AI
装完之后,这里有 5 个你可以让 AI 做的事:
什么时候选它
当您需要通过 MCP 界面执行全面的 Git 操作时,选择此服务器,特别是如果您已经在使用 TypeScript 或偏好具有广泛文档和多种安装选项的工具。
什么时候不要选它
如果您需要远程仓库管理或子模块操作等高级 Git 功能,而这些功能不在当前工具集中,请不要选择此服务器。
此 server 暴露的工具
从 README 抽取出 12 个工具git_statusrepo_path: stringShows the working tree status
git_diff_unstagedrepo_path: string, context_lines?: numberShows changes in working directory not yet staged
git_diff_stagedrepo_path: string, context_lines?: numberShows changes that are staged for commit
git_diffrepo_path: string, target: string, context_lines?: numberShows differences between branches or commits
git_commitrepo_path: string, message: stringRecords changes to the repository
git_addrepo_path: string, files: string[]Adds file contents to the staging area
git_resetrepo_path: stringUnstages all staged changes
git_logrepo_path: string, max_count?: number, start_timestamp?: string, end_timestamp?: stringShows the commit logs with optional date filtering
git_create_branchrepo_path: string, branch_name: string, base_branch?: stringCreates a new branch
git_checkoutrepo_path: string, branch_name: stringSwitches branches
git_showrepo_path: string, revision: stringShows the contents of a commit
git_branchrepo_path: string, branch_type: string, contains?: string, not_contains?: stringList Git branches
可对比工具
安装
使用 uv(推荐)
当使用 [uv](https://docs.astral.sh/uv/) 时,无需特定安装。使用 [uvx](https://docs.astral.sh/uv/guides/tools/) 直接运行服务器:
uvx mcp-server-git --repository path/to/git/repo使用 PIP
或者通过 pip 安装 mcp-server-git:
pip install mcp-server-git安装后,按如下方式运行:
python -m mcp_server_gitClaude Desktop 配置
添加到您的 claude_desktop_config.json:
"mcpServers": {
"git": {
"command": "uvx",
"args": ["mcp-server-git", "--repository", "path/to/git/repo"]
}
}FAQ
- 我可以将此服务器用于远程仓库吗?
- 目前,此服务器设计用于本地 Git 仓库。您需要先克隆仓库到本地。
- 它支持私有仓库的身份验证吗?
- 服务器本身不处理身份验证。您需要确保本地 Git 环境已正确配置私有仓库的凭据。
Hacker News 讨论
开发者社区最近的相关讨论。
- 帖子 by vinnyglennon · 2025-03-20
git 对比
最后更新于 · 由 README + GitHub 公开数据自动生成。