# git-smart-mcp **Repository Path**: wuluan/git-smart-mcp ## Basic Information - **Project Name**: git-smart-mcp - **Description**: Git Smart Agent 是一个智能的 Git 代码提交助手,通过 MCP (Model Context Protocol) 服务帮助用户执行代码提交、构建和灰度发布流程。 - **Primary Language**: Unknown - **License**: Not specified - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2026-02-26 - **Last Updated**: 2026-03-13 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # Git Smart Agent MCP Service Git Smart Agent 是一个智能的 Git 代码提交助手,通过 MCP (Model Context Protocol) 服务帮助用户执行代码提交、构建和灰度发布流程。 ## 功能特性 - 智能代码提交 - 自动构建镜像 - 灰度发布流程 - 实时进度监控 - 支持跳过构建或部署步骤 ## 安装要求 - Python 3.8+ - MCP 协议支持的客户端 安装依赖: ```bash pip install -r requirements.txt ``` ## 配置 编辑 `config.json` 文件: ```json { "git_agent_path": "D:\\code\\git-smart-mcp\\git_smart_agent.py", "projects_base_path": "D:\\code", "python_path": "python", "encoding": "utf-8", "log_level": "INFO" } ``` 设置环境变量: ```bash export AVATAR_USER=your_username export AVATAR_PWD=your_password ``` ## 注册 MCP 服务 运行注册脚本以将 Git Smart Agent 注册为 MCP 服务: ```bash python register_mcp.py ``` ## 使用方法 ### 直接使用 ```bash python git_smart_agent.py "提交信息" ``` 跳过构建(仅提交代码): ```bash python git_smart_agent.py "提交信息" --skip-build ``` 跳过部署(提交并构建): ```bash python git_smart_agent.py "提交信息" --skip-deploy ``` 仅触发构建(跳过Git操作): ```bash python git_smart_agent.py "构建备注" --skip-git ``` 指定 client.jar 版本: ```bash python git_smart_agent.py "提交信息" --client-version v1.2.3 ``` **参数说明**: - `--skip-build`, `-sb`: 跳过构建流程 - `--skip-deploy`, `-sd`: 跳过部署流程 - `--skip-git`, `-sg`: 跳过 Git 操作(仅触发构建) - `--client-version`, `-cv`: client.jar 版本号(可选,用于指定构建使用的客户端版本) ### 通过 MCP 服务 使用支持 MCP 的客户端调用 `git_smart_commit` 工具: ```json { "name": "git_smart_commit", "arguments": { "project": "yjyz.web.srv", "message": "修复用户登录bug", "skip_build": false, "skip_deploy": false, "skip_git": false, "client_version": "" } } ``` 仅触发构建(跳过Git操作): ```json { "name": "git_smart_commit", "arguments": { "project": "yjyz.web.srv", "message": "重新构建", "skip_build": false, "skip_deploy": true, "skip_git": true, "client_version": "" } } ``` 指定 client.jar 版本: ```json { "name": "git_smart_commit", "arguments": { "project": "yjyz.web.srv", "message": "修复用户登录bug", "skip_build": false, "skip_deploy": false, "skip_git": false, "client_version": "v1.2.3" } } ``` ## 工作流程 1. 提交当前分支的更改 2. 合并到目标分支(默认为 beta) 3. 推送到远程仓库 4. 切换回原分支 5. 触发镜像构建 6. 监控构建进度 7. 执行灰度部署 8. 监控部署状态 9. 确认部署完成 ## 开发 启动开发服务器: ```bash python run_server.py ``` ## 许可证 MIT