Git MCP Server
Git MCP 服务器
模型上下文协议 (MCP) 服务器,通过标准化接口提供增强的 Git 操作。该服务器与 MCP 生态系统集成,为 AI 助手提供 Git 功能。
特征
核心 Git 操作:初始化、克隆、状态、添加、提交、推送、拉取
分支管理:列出、创建、删除、结帐
标签操作:列出、创建、删除
远程管理:列出、添加、删除
存储操作:列出、保存、弹出
批量操作:按顺序执行多个 Git 操作
GitHub 集成:通过个人访问令牌内置 GitHub 支持
路径解析:具有可选默认路径配置的智能路径处理
错误处理:使用自定义错误类型进行全面的错误处理
存储库缓存:高效的存储库状态管理
性能监控:内置性能跟踪
Related MCP server: GitPilot MCP
安装
克隆存储库:
git clone https://github.com/yourusername/git-mcp-v2.git
cd git-mcp-v2安装依赖项:
npm install构建项目:
npm run build配置
添加到您的 MCP 设置文件:
{
"mcpServers": {
"git-v2": {
"command": "node",
"args": ["path/to/git-mcp-v2/build/index.js"],
"env": {
"GIT_DEFAULT_PATH": "/path/to/default/git/directory",
"GITHUB_PERSONAL_ACCESS_TOKEN": "your-github-pat"
}
}
}
}环境变量
GIT_DEFAULT_PATH:(可选)Git 操作的默认路径GITHUB_PERSONAL_ACCESS_TOKEN:(可选)用于 GitHub 操作的 GitHub 个人访问令牌
可用工具
基本操作
init:初始化一个新的 Git 存储库clone:克隆存储库status:获取存储库状态add:阶段文件commit:创建提交push:将提交推送到远程pull:从远程拉取更改
分支机构运营
branch_list:列出所有分支branch_create:创建一个新分支branch_delete:删除分支checkout:切换分支或恢复工作树文件
标签操作
tag_list:列出标签tag_create:创建标签tag_delete:删除标签
远程操作
remote_list:列出遥控器remote_add:添加远程remote_remove:删除远程
存储操作
stash_list:列出存储stash_save:将更改保存到存储区stash_pop:应用和删除存储
批量操作
bulk_action:按顺序执行多个 Git 操作
发展
# Run tests
npm test
# Run tests with coverage
npm run test:coverage
# Run linter
npm run lint
# Format code
npm run format执照
麻省理工学院
贡献
分叉存储库
创建你的功能分支(
git checkout -b feature/amazing-feature)提交您的更改(
git commit -m 'Add some amazing feature')推送到分支(
git push origin feature/amazing-feature)打开拉取请求
Available Tools
21 toolsaddC
Stage files
Inputs: files (required), path.
branch_createC
Create a new branch
Inputs: name (required), force, path, setUpstream, +1 more.
branch_deleteC
Delete a branch
Inputs: name (required), path.
branch_listC
List all branches
Inputs: path.
bulk_actionA
Execute multiple Git operations in sequence. This is the preferred way to execute multiple operations.
Inputs: actions (required), path.
checkoutC
Switch branches or restore working tree files
Inputs: target (required), path.
cloneC
Clone a repository
Inputs: url (required), path.
commitC
Create a commit
Inputs: message (required), path.
initB
Initialize a new Git repository
Inputs: path.
pullC
Pull changes from remote
Inputs: branch (required), path, remote.
pushC
Push commits to remote
Inputs: branch (required), force, noVerify, path, +2 more.
remote_addC
Add a remote
Inputs: name (required), url (required), path.
remote_listC
List remotes
Inputs: path.
remote_removeC
Remove a remote
Inputs: name (required), path.
stash_listC
List stashes
Inputs: path.
stash_popC
Apply and remove a stash
Inputs: index, path.
stash_saveC
Save changes to stash
Inputs: all, includeUntracked, keepIndex, message, +1 more.
statusC
Get repository status
Inputs: path.
tag_createC
Create a tag
Inputs: name (required), annotated, force, message, +2 more.
tag_deleteC
Delete a tag
Inputs: name (required), path.
tag_listC
List tags
Inputs: path.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 21 tools
Every tool has a clearly distinct purpose targeting specific Git operations with no ambiguity. For example, branch_create, branch_delete, and branch_list are clearly differentiated, and tools like stash_save, stash_pop, and stash_list cover distinct aspects of stash management without overlap.
Tool names follow a highly consistent verb_noun pattern throughout, such as branch_create, tag_delete, remote_add, and stash_list. All tools use snake_case with clear, descriptive names that align with Git terminology, making the set predictable and readable.
With 21 tools, the count is borderline high for a Git server, as it includes many specific operations that might be overwhelming. While comprehensive, a typical Git scope could be covered with fewer tools (e.g., 10-15), making this feel slightly heavy but still within reason for the domain.
The tool set provides complete coverage of core Git workflows, including repository management (init, clone), branching (create, delete, list), committing (add, commit), remote operations (add, list, remove, push, pull), and stash/tag handling. No obvious gaps exist, and agents can perform full CRUD/lifecycle operations seamlessly.
Related MCP Connectors
A comprehensive Model Context Protocol (MCP) server that enables AI assistants to interact with yo…
GitHub Copilot MCP: code, repo, PR, workflow tools for AI assistants.
AI-native git hosting — repos, PRs, issues, CI gates, and AI code review over MCP (60 tools).
Driflyte MCP server which lets AI assistants query topic-specific knowledge from web and GitHub.
Related MCP Servers
- AlicenseNot gradedqualityDmaintenanceA Model Context Protocol server that enables AI assistants to perform standard Git operations like staging, committing, and pushing changes. It facilitates a high-quality, standardized workflow for managing code repositories through natural language commands.ISC
- AlicenseNot gradedqualityNot gradedmaintenanceA lightweight MCP server that enables AI assistants to manage local Git repositories by executing commands like status, add, and commit. It streamlines development workflows by providing repository context and diffs directly to the assistant.Apache 2.0
- AlicenseBqualityCmaintenanceAn enhanced Git MCP server that provides AI assistants with powerful code review, commit analysis, and branch management capabilities for Git repositories.571 npm1MIT
- AlicenseNot gradedqualityDmaintenanceAn MCP server that provides tools for interacting with Git repositories, enabling AI assistants to manage repositories, branches, commits, and files through a standardized interface.4,204 npm1Apache 2.0