Provides integration with MGit, a command-line tool for managing multiple Git repositories, enabling batch push operations with commit messages across multiple Git projects simultaneously.
MCP MGit Server
A MCP server for executing mgit push operations with multiple instance support.
Prerequisites
⚠️ Important: This MCP server requires the MGit tool to be installed and configured on your system.
MGit is a command-line tool for managing multiple Git projects. It helps you efficiently manage, synchronize, and update multiple Git repositories.
MGit Installation and Setup
Before using this MCP server, please:
Install MGit: Download and install MGit from https://github.com/liliangshan/mgit/releases
Initialize MGit: Follow the MGit setup instructions in the MGit README
Configure Projects: Use
mgit initto add your Git repositories to MGitVerify Setup: Use
mgit listto view available repository names
For detailed MGit usage instructions, features, and configuration, please refer to the MGit README.
Key MGit Features
Multi-project Management: Manage multiple Git projects with one click
Multi-language Support: Supports multiple languages including Chinese (Simplified/Traditional), English, Japanese, Korean, French
Remote Database Sync: Supports project configuration synchronization across multiple devices
Smart Branch Management: Automatically detects and switches branches to avoid conflicts
Batch Operations: Supports pulling/pushing changes for multiple projects simultaneously
Features
✅ Execute
mgit pushcommand for repositories✅ Configurable mgit command (default:
mgit)✅ Multiple instance support with repository name isolation
✅ Operation logging
✅ Error handling and recovery
Installation
Global Installation (Recommended)
Local Installation
From Source
Configuration
Set environment variables:
Usage
1. Direct Run (Global Installation)
2. Using npx (Recommended)
3. Direct Start (Source Installation)
4. Managed Start (Recommended for Production)
Managed start provides:
Auto-restart (up to 10 times)
Error recovery
Process management
Logging
5. Development Mode
Editor Integration
Cursor Editor Configuration
Create
.cursor/mcp.jsonfile in your project root:
VS Code Configuration
Install the MCP extension for VS Code
Create
.vscode/settings.jsonfile:
Multiple MGit Server Instances Support
You can configure multiple MGit server instances with different REPO_NAME and PROJECT_NAME to isolate tools and configurations. Each instance must have a unique REPO_NAME (required). This is useful when you need to push to different repositories or manage different project groups. Use mgit list (or ${MGIT_CMD} list) to view available repository names.
Example: Cursor Editor Configuration
Create .cursor/mcp.json file:
Benefits of Multiple Instances:
Tool Isolation: Each instance has its own tool names (e.g.,
local_mgit_push,custom_mgit_push)Config Isolation: Logs are stored in separate directories (e.g.,
./.setting.local/,./.setting.custom/)Different Commands: Configure different mgit commands for each instance
Project Branding: Each instance can have its own project name for better identification
Note: When using multiple instances, tools will be prefixed with REPO_NAME. For example:
local-repo_mgit_push- uses local mgit command for local-repocustom-repo_mgit_push- uses custom mgit command for custom-repo
As MCP Server
The server communicates with MCP clients via stdin/stdout after startup:
Available Tools
mgit_push: Execute mgit push command for the repository configured via REPO_NAME environment variable
{ "jsonrpc": "2.0", "id": 2, "method": "tools/call", "params": { "name": "mgit_push", "arguments": { "message": "Update project files" } } }get_operation_logs: Get operation logs
{ "jsonrpc": "2.0", "id": 3, "method": "tools/call", "params": { "name": "get_operation_logs", "arguments": { "limit": 50, "offset": 0 } } }
Logging
General Logs
Log file location: ./.setting/mcp-mgit.log (or ./.setting.<REPO_NAME>/mcp-mgit.log if REPO_NAME is set)
Logged content:
All requests and responses
MGit operation records
Error messages
Server status changes
Error Handling
Individual request errors don't affect the entire server
Process exceptions are automatically restarted (managed mode)
Detailed error messages in logs
Environment Variables
Variable | Default | Description |
REPO_NAME | Required repository name for push operations. Use
(or
) to view available repository names. Example:
| |
MGIT_CMD | mgit | Optional mgit command to execute (can be full path) |
LANGUAGE | en | Optional language setting for commit messages. Supported values:
(English),
or
(Simplified Chinese),
(Traditional Chinese). The tool will prompt users to provide commit messages in the configured language. |
PROJECT_NAME | Optional project branding for tool descriptions | |
MCP_LOG_DIR | ./.setting (or ./.setting.<REPO_NAME> if REPO_NAME is set) | Log directory |
MCP_LOG_FILE | mcp-mgit.log | Log filename |
Development
Project Structure
Testing
Quick Start
1. Install Package
2. Configure Environment Variables
3. Run Server
Usage Example
Using the mgit_push tool
The mgit_push tool executes the command: ${MGIT_CMD} push ${REPO_NAME} "<message>"
Note: The repository name is configured via the REPO_NAME environment variable (required). Use mgit list (or ${MGIT_CMD} list) to view available repository names.
Parameters:
message(required): The commit message for the push operation
Example:
If REPO_NAME="my-project" and MGIT_CMD="mgit", this will execute: mgit push my-project "Update documentation"
License
MIT
This server cannot be installed