中文版


🚀 MCP MGit Server - 让 AI 助手自动推送代码到 Git 仓库

你是否还在为每次代码修改后繁琐的 Git 操作而烦恼?git addgit commitgit push 这些重复的命令是否已经让你感到厌倦?在 AI 辅助开发的今天,当 AI 助手帮你完成代码编写后,你还需要手动切换到终端执行推送操作,这种工作流的割裂感是否让你觉得效率低下?

MCP MGit Server 正是为了解决这些问题而诞生的革命性工具。它基于 MCP(Model Context Protocol)协议,将 AI 助手与 Git 操作无缝连接,让代码推送变得前所未有的简单和自动化。想象一下这样的场景:AI 助手帮你修复了一个 bug,你只需要说一句"请把修改推送到仓库",AI 就会自动分析代码变更、生成合适的提交信息、执行推送操作,甚至还能智能识别合并请求链接并提示你打开。整个过程一气呵成,你无需离开编辑器,无需切换窗口,更无需记忆那些 Git 命令。

对于需要管理多个项目的开发者来说,MCP MGit Server 的多仓库管理功能更是如虎添翼。你可以为每个项目配置独立的仓库实例,每个实例都有独立的工具名称和日志文件,互不干扰。无论是前端项目、后端服务,还是微服务架构中的多个模块,都能轻松管理。团队协作时,统一的推送流程和标准化的提交消息格式,让代码管理更加规范和高效。

更重要的是,MCP MGit Server 支持多语言提交消息,无论你的团队使用中文、英文还是其他语言,都能生成符合团队规范的提交信息。所有操作都有完整的日志记录,便于追踪和审计,这对于需要严格管理代码变更的企业环境来说尤其重要。通过环境变量配置,你的仓库信息得到安全保护,不会暴露在代码中,既方便又安全。

现在,就让我们一起拥抱 AI 驱动的开发新时代,让 MCP MGit Server 成为你的得力助手,把时间花在创造性的代码编写上,而不是重复的 Git 操作上。只需几分钟的配置,你就能体验到前所未有的开发效率提升!

什么是 MCP MGit Server?

MCP MGit Server 是一个基于 MCP(Model Context Protocol)协议的服务器,让 AI 助手能够直接执行 mgit push 操作,自动将代码推送到 Git 仓库。告别重复的手动操作,让 AI 帮你完成 Git 推送!

✨ 核心特性

  • 🤖 AI 自动推送:通过 MCP 协议,AI 助手可以直接执行代码推送操作
  • 📝 多语言支持:支持中文、英文等多种语言的提交消息
  • 🔧 多仓库管理:支持配置多个仓库实例,灵活管理不同项目
  • 📊 完整日志:记录所有操作历史,随时追踪推送记录
  • 🔐 安全可靠:通过环境变量配置,安全管理仓库信息
  • 🌐 智能识别:自动识别并处理分支合并请求链接

📦 快速开始

1. 安装 MGit 工具(必需)

MCP MGit Server 需要配合 MGit 工具使用。请先安装 MGit:

下载地址:https://github.com/liliangshan/mgit/releases

使用说明:https://github.com/liliangshan/mgit/blob/main/README.md

安装完成后,使用 mgit init 初始化项目,使用 mgit list 查看可用的仓库名称。

2. 全局安装 MCP MGit Server

npm install -g @liangshanli/mcp-server-mgit

3. IDE 配置示例

Cursor 编辑器配置

在项目根目录创建 .cursor/mcp.json 文件:

{
  "mcpServers": {
    "mgit": {
      "command": "npx",
      "args": ["@liangshanli/mcp-server-mgit"],
      "env": {
        "REPO_NAME": "your-repo-name",
        "MGIT_CMD": "mgit",
        "LANGUAGE": "zh-CN",
        "PROJECT_NAME": "MyProject"
      }
    }
  }
}

配置说明

  • REPO_NAME:必需,仓库名称(使用 mgit list 查看)
  • MGIT_CMD:可选,mgit 命令路径(默认:mgit)
  • LANGUAGE:可选,语言设置(默认:en,支持 en/zh/zh-CN/zh-TW)
  • PROJECT_NAME:可选,项目标识
VS Code 配置

安装 MCP 扩展后,在 .vscode/settings.json 中添加:

{
  "mcp.servers": {
    "mgit": {
      "command": "npx",
      "args": ["@liangshanli/mcp-server-mgit"],
      "env": {
        "REPO_NAME": "your-repo-name",
        "MGIT_CMD": "mgit",
        "LANGUAGE": "zh-CN",
        "PROJECT_NAME": "MyProject"
      }
    }
  }
}

4. 多仓库配置示例

如果需要管理多个仓库,可以配置多个实例:

{
  "mcpServers": {
    "mgit-frontend": {
      "command": "npx",
      "args": ["@liangshanli/mcp-server-mgit"],
      "env": {
        "REPO_NAME": "frontend-repo",
        "LANGUAGE": "zh-CN"
      }
    },
    "mgit-backend": {
      "command": "npx",
      "args": ["@liangshanli/mcp-server-mgit"],
      "env": {
        "REPO_NAME": "backend-repo",
        "LANGUAGE": "en"
      }
    }
  }
}

🎯 使用场景

场景 1:AI 辅助开发

  • AI 帮你写代码
  • AI 自动执行 git push
  • 自动识别并打开合并请求链接
  • 完整的操作日志记录

场景 2:多项目管理

  • 配置多个仓库实例
  • 每个仓库独立管理
  • 工具名称自动隔离(如:frontend-repo_mgit_push
  • 日志文件独立存储

场景 3:团队协作

  • 统一的推送流程
  • 标准化的提交消息格式
  • 完整的操作审计日志
  • 支持多语言提交消息

💡 使用示例

配置完成后,只需告诉 AI 助手:

请把上面修改的内容生成推送说明并推送到仓库

AI 助手会自动:

  1. 分析上面的代码修改内容
  2. 生成合适的提交说明
  3. 调用 mgit_push 工具执行推送
  4. 返回推送结果
  5. 如果包含合并请求链接,会自动识别并提示

🔗 相关链接

  • GitHub 仓库:https://github.com/liliangshan/mcp-server-mgit
  • NPM 包:https://www.npmjs.com/package/@liangshanli/mcp-server-mgit
  • MGit 下载:https://github.com/liliangshan/mgit/releases
  • MGit 文档:https://github.com/liliangshan/mgit/blob/main/README.md

📚 完整文档

  • 英文文档:https://github.com/liliangshan/mcp-server-mgit/blob/main/README.md
  • 中文文档:https://github.com/liliangshan/mcp-server-mgit/blob/main/README.zh-CN.md

🌟 主要优势

  1. 提升效率:告别重复的 git 操作,AI 自动处理
  2. 减少错误:标准化的推送流程,避免手动操作失误
  3. 完整记录:所有操作都有日志,便于追踪和审计
  4. 灵活配置:支持多仓库、多语言、多实例配置
  5. 安全可靠:通过环境变量管理配置,不暴露敏感信息

🚀 立即开始

# 1. 安装 MGit(如果还没有)
# 从 https://github.com/liliangshan/mgit/releases 下载

# 2. 安装 MCP MGit Server
npm install -g @liangshanli/mcp-server-mgit

# 3. 配置 IDE(参考上面的配置示例)

# 4. 开始使用!

📝 许可证

MIT License


让 AI 成为你的 Git 操作助手,专注代码创作,让工具处理重复工作!

#MCP #Git #自动化 #AI助手 #开发工具 #效率提升


English Version


🚀 MCP MGit Server - Let AI Assistants Automatically Push Code to Git Repositories

Are you still frustrated by the tedious Git operations after every code change? Have you grown tired of those repetitive commands like git add, git commit, and git push? In today’s AI-assisted development era, after your AI assistant helps you write code, you still need to manually switch to the terminal to execute push operations. Doesn’t this workflow fragmentation make you feel inefficient?

MCP MGit Server is a revolutionary tool born to solve these problems. Based on the MCP (Model Context Protocol), it seamlessly connects AI assistants with Git operations, making code pushing simpler and more automated than ever before. Imagine this scenario: your AI assistant helps you fix a bug, and you simply say “please push the changes to the repository.” The AI will automatically analyze code changes, generate appropriate commit messages, execute push operations, and even intelligently detect merge request links and prompt you to open them. The entire process flows smoothly—you don’t need to leave your editor, switch windows, or remember those Git commands.

For developers managing multiple projects, MCP MGit Server’s multi-repository management feature is even more powerful. You can configure independent repository instances for each project, with each instance having its own tool names and log files, completely isolated from each other. Whether it’s frontend projects, backend services, or multiple modules in a microservices architecture, everything can be managed effortlessly. In team collaboration, unified push workflows and standardized commit message formats make code management more standardized and efficient.

More importantly, MCP MGit Server supports multi-language commit messages. Whether your team uses Chinese, English, or other languages, it can generate commit messages that comply with your team’s standards. All operations are fully logged for tracking and auditing, which is especially important for enterprise environments that require strict code change management. Through environment variable configuration, your repository information is securely protected and won’t be exposed in code—both convenient and secure.

Now, let’s embrace the new era of AI-driven development together. Let MCP MGit Server become your powerful assistant, allowing you to spend time on creative coding rather than repetitive Git operations. With just a few minutes of configuration, you can experience unprecedented development efficiency improvements!

What is MCP MGit Server?

MCP MGit Server is a server based on the MCP (Model Context Protocol) that enables AI assistants to directly execute mgit push operations, automatically pushing code to Git repositories. Say goodbye to repetitive manual operations and let AI handle your Git pushes!

✨ Core Features

  • 🤖 AI Auto Push: AI assistants can directly execute push operations through MCP protocol
  • 📝 Multi-language Support: Support for Chinese, English, and other languages for commit messages
  • 🔧 Multi-repository Management: Support for configuring multiple repository instances for flexible project management
  • 📊 Complete Logging: Record all operation history for tracking push records
  • 🔐 Secure & Reliable: Secure repository information management through environment variables
  • 🌐 Smart Recognition: Automatically detect and handle branch merge request links

📦 Quick Start

1. Install MGit Tool (Required)

MCP MGit Server requires the MGit tool. Please install MGit first:

Download: https://github.com/liliangshan/mgit/releases

Documentation: https://github.com/liliangshan/mgit/blob/main/README.md

After installation, use mgit init to initialize projects and mgit list to view available repository names.

2. Global Installation

npm install -g @liangshanli/mcp-server-mgit

3. IDE Configuration Examples

Cursor Editor Configuration

Create .cursor/mcp.json file in your project root:

{
  "mcpServers": {
    "mgit": {
      "command": "npx",
      "args": ["@liangshanli/mcp-server-mgit"],
      "env": {
        "REPO_NAME": "your-repo-name",
        "MGIT_CMD": "mgit",
        "LANGUAGE": "en",
        "PROJECT_NAME": "MyProject"
      }
    }
  }
}

Configuration Notes:

  • REPO_NAME: Required, repository name (use mgit list to view)
  • MGIT_CMD: Optional, mgit command path (default: mgit)
  • LANGUAGE: Optional, language setting (default: en, supports en/zh/zh-CN/zh-TW)
  • PROJECT_NAME: Optional, project identifier
VS Code Configuration

After installing the MCP extension, add to .vscode/settings.json:

{
  "mcp.servers": {
    "mgit": {
      "command": "npx",
      "args": ["@liangshanli/mcp-server-mgit"],
      "env": {
        "REPO_NAME": "your-repo-name",
        "MGIT_CMD": "mgit",
        "LANGUAGE": "en",
        "PROJECT_NAME": "MyProject"
      }
    }
  }
}

4. Multi-Repository Configuration Example

To manage multiple repositories, configure multiple instances:

{
  "mcpServers": {
    "mgit-frontend": {
      "command": "npx",
      "args": ["@liangshanli/mcp-server-mgit"],
      "env": {
        "REPO_NAME": "frontend-repo",
        "LANGUAGE": "en"
      }
    },
    "mgit-backend": {
      "command": "npx",
      "args": ["@liangshanli/mcp-server-mgit"],
      "env": {
        "REPO_NAME": "backend-repo",
        "LANGUAGE": "en"
      }
    }
  }
}

🎯 Use Cases

Use Case 1: AI-Assisted Development

  • AI writes code for you
  • AI automatically executes git push
  • Automatically detects and opens merge request links
  • Complete operation logging

Use Case 2: Multi-Project Management

  • Configure multiple repository instances
  • Independent management for each repository
  • Automatic tool name isolation (e.g., frontend-repo_mgit_push)
  • Independent log file storage

Use Case 3: Team Collaboration

  • Unified push workflow
  • Standardized commit message format
  • Complete operation audit logs
  • Support for multi-language commit messages

💡 Usage Example

After configuration, simply tell your AI assistant:

Please generate a push message for the changes above and push to the repository

The AI assistant will automatically:

  1. Analyze the code changes above
  2. Generate an appropriate commit message
  3. Call the mgit_push tool to execute the push
  4. Return push results
  5. If merge request links are included, automatically detect and prompt

🔗 Related Links

  • GitHub Repository: https://github.com/liliangshan/mcp-server-mgit
  • NPM Package: https://www.npmjs.com/package/@liangshanli/mcp-server-mgit
  • MGit Download: https://github.com/liliangshan/mgit/releases
  • MGit Documentation: https://github.com/liliangshan/mgit/blob/main/README.md

📚 Complete Documentation

  • English Docs: https://github.com/liliangshan/mcp-server-mgit/blob/main/README.md
  • Chinese Docs: https://github.com/liliangshan/mcp-server-mgit/blob/main/README.zh-CN.md

🌟 Key Advantages

  1. Boost Efficiency: Say goodbye to repetitive git operations, AI handles it automatically
  2. Reduce Errors: Standardized push workflow prevents manual operation mistakes
  3. Complete Records: All operations are logged for tracking and auditing
  4. Flexible Configuration: Support for multi-repository, multi-language, multi-instance configuration
  5. Secure & Reliable: Manage configuration through environment variables without exposing sensitive information

🚀 Get Started Now

# 1. Install MGit (if not already installed)
# Download from https://github.com/liliangshan/mgit/releases

# 2. Install MCP MGit Server
npm install -g @liangshanli/mcp-server-mgit

# 3. Configure IDE (refer to configuration examples above)

# 4. Start using!

📝 License

MIT License


Let AI be your Git operation assistant, focus on coding, let tools handle repetitive work!

#MCP #Git #Automation #AIAssistant #DevTools #Productivity

Logo

有“AI”的1024 = 2048,欢迎大家加入2048 AI社区

更多推荐