使用说明
Git MCP Server
基于 MCP 协议的 Git 操作工具,让 AI 助手帮你管理 Git 提交,自动生成符合规范的中文提交信息。
📦 安装
git clone https://github.com/your-username/git-mcp.git
cd git-mcp
cargo build --release
⚙️ MCP 配置
{
"mcpServers": {
"git-mcp": {
"command": "D:\\AI\\MCP\\git-mcp\\target\\release\\git-mcp.exe",
"args": []
}
}
}
🛠️ 工具列表
| 工具 | 说明 |
|---|---|
git_status |
获取仓库状态,显示变更文件(新增/修改/删除) |
generate_commit_message |
根据类型和描述生成规范的提交信息 |
git_commit |
执行 git add 和 git commit |
list_commit_types |
列出所有支持的提交类型 |
git_log |
查看最近的提交历史 |
git_branch |
查看当前分支 |
� 提交类型
| Type | Emoji | 说明 |
|---|---|---|
| feat | ✨ | 新增功能 |
| fix | 🐛 | 修复 Bug |
| docs | 📝 | 文档变更 |
| style | 💄 | 代码格式 |
| refactor | ♻️ | 重构代码 |
| perf | ⚡️ | 性能优化 |
| test | ✅ | 增加测试 |
| chore | 🔧 | 构建/工具变动 |
| build | 📦 | 构建系统变动 |
| ci | 👷 | CI 配置变动 |
| revert | ⏪ | 回退代码 |
| init | 🎉 | 项目初始化 |
| ui | 🎨 | 更新 UI 样式 |
| config | ⚙️ | 配置文件修改 |
| merge | 🔀 | 合并分支 |
🚀 使用示例
用户: 帮我看看当前仓库有哪些变更
AI: 调用 git_status 工具...
用户: 帮我生成一个 feat 类型的提交,描述是"添加用户登录功能"
AI: 调用 generate_commit_message 工具...
用户: 确认提交
AI: 调用 git_commit 工具...
📋 生成的提交信息格式
✨ feat: 添加用户登录功能
详细描述:
- 新增: src/login.rs
- 修改: src/main.rs
📄 License
MIT
