Provides Docker support for containerized deployment of the Git MCP server with ready-to-use Docker images.
Provides comprehensive Git repository management capabilities including cloning, status checks, pulling, pushing, committing, branch operations, history viewing, staging files, repository initialization, and remote repository management.
Server is implemented in Node.js, allowing for execution of Git operations through a Model Context Protocol interface with proper error handling and validation.
Implements type-safe command execution for Git operations with structured input validation.
Uses Zod for schema validation of Git operation commands, ensuring type safety and proper input validation.
GIT MCP Server
Node.js server implementing Model Context Protocol (MCP) for git operations.
Features
- Git repository management through MCP protocol
- Support for common Git operations
- Type-safe command execution with Zod schema validation
- Robust error handling with detailed git error messages
- Comprehensive test suite covering all operations
API
The server provides the following Git operations:
git_clone
Clone a git repository to a local directory.
git_status
Get the status of a git repository, showing changed files and branch information.
git_pull
Pull changes from a remote repository into your local repository.
git_push
Push local changes to a remote repository.
git_commit
Commit changes to the repository with a message.
git_checkout
Checkout a branch or specific commit.
git_log
Show commit history.
git_branch
List all branches in the repository.
git_add
Add files to the staging area.
git_init
Initialize a new git repository.
git_remote
Manage remote repositories.
Error Handling
The server provides robust error handling for git operations:
- All git commands are executed with proper error capturing
- Error messages are cleaned and formatted for improved readability
- Specific git error patterns are detected and extracted from command output
- Each tool returns structured error responses with
isError: true
flag - Errors include descriptive messages that match standard git error formats
Installation
Usage
The server can be run using:
Or directly using the built executable:
Testing
The project includes a comprehensive test suite that verifies all git operations work correctly. To run the tests:
The tests:
- Create a temporary git repository
- Test the full git workflow (clone, branch, add, commit, etc.)
- Verify proper error handling for invalid operations
- Clean up resources after test execution
For continuous test development, you can also use:
Docker
A Docker image is available for easy deployment:
Development
Using with Cursor AI Chat
For detailed instructions on using this Git MCP server with Cursor's AI assistant, please see using with cursor.
License
MIT
Node.js server implementing Model Context Protocol for git operations, enabling AI assistants to manage git repositories through natural language commands.
Related MCP Servers
- -securityAlicense-qualityA Model Context Protocol server for Git repository interaction and automation. This server provides tools to read, search, and manipulate Git repositories via Large Language Models.Last updated -1261,341TypeScriptMIT License
- AsecurityAlicenseAqualityA Model Context Protocol server that enables Large Language Models to interact with Git repositories through a robust API, supporting operations like repository initialization, cloning, file staging, committing, and branch management.Last updated -211,28597TypeScriptApache 2.0
- AsecurityFlicenseAqualityA Model Context Protocol server that enables AI models to interact with GitHub's API, allowing for repository creation and management with descriptions, topics, and website URLs through natural language commands.Last updated -1JavaScript
- -securityFlicense-qualityA Model Context Protocol server that enables AI assistants to perform GitHub operations including repository management, file operations, issue tracking, and pull request creation.Last updated -1TypeScript