
Git Command MCP Server

2025.04.22
0
TypeScriptGit 工具MCP 服务器开发效率
mcp-git 是一个基于 Model Context Protocol (MCP) 的服务器,提供执行各种 Git 命令的工具。它需要在本地安装 git (git.exe) 命令。该服务器通过 MCP 协议与客户端(如 Roo Code、GitHub Copilot、Claude Desktop、Cursor 等)进行交互,执行 Git 命令并返回结果。
View on GitHub
Overview
基本能力
产品定位
mcp-git 是一个 Git 命令执行工具,通过 MCP 协议提供 Git 命令的远程执行能力。
核心功能
- 提供各种 Git 命令的执行能力,如
git-add
、git-commit
、git-status
等。 - 返回 Git 命令的执行结果,包括标准输出 (STDOUT)、标准错误输出 (STDERR) 以及服务器本身的执行错误 (ERROR)。
- 支持通过 MCP 协议与多种客户端工具集成。
适用场景
- 在开发环境中通过 MCP 客户端远程执行 Git 命令。
- 集成到代码编辑器或 IDE 中,提供 Git 命令的自动化执行能力。
- 用于自动化脚本或 CI/CD 流程中执行 Git 命令。
工具列表
git-add
: 执行git add
命令。git-commit
: 执行git commit
命令。git-status
: 执行git status
命令。- 其他 Git 命令,格式为
git-<command>
。
常见问题解答
- 需要本地安装 git (git.exe) 命令。
- 安装时需要 Node.js 和 npm 环境。
- 客户端连接时需要正确配置 MCP 服务器的路径。
使用教程
使用依赖
- 确保本地已安装 git (git.exe) 命令。
- 确保已安装 Node.js 和 npm。
安装教程
- 克隆仓库:
bash git clone http://github.com/ukiuni/mcp-git.git cd mcp-git
- 安装依赖:
bash npm install
- 通过 npm 安装:
bash npm i mcp-git
调试方式
- 启动 MCP 服务器:
bash node /path_to_mcp-git/mcp-git/dist/index.js
- 配置 MCP 客户端:
json { "mcpServers": { "mpc-git": { "command": "node", "args": [ "/path_to_mcp-git/mcp-git/dist/index.js" ] } } }
- 测试 Git 命令执行: 通过客户端发送 Git 命令请求,检查返回结果。