2bytes-org/git-mcp-server
If you are the rightful owner of git-mcp-server and would like to certify it and/or have it hosted online, please leave a comment on the right or send an email to henry@mcphub.com.
A Model Context Protocol server for Git repository interaction and automation, providing tools to read, search, and manipulate Git repositories via Large Language Models.
MCP Git Server
A Model Context Protocol server for Git repository interaction and automation. This server provides robust tools to read, search, and manipulate Git repositories via Large Language Models.
Features
- Seamless Git command execution through MCP
- Support for all essential Git operations (status, diff, commit, branch, etc.)
- Easy integration with Claude Desktop, VS Code, and Zed
- Reliable error handling and comprehensive logging
- Docker support for isolated and consistent environment
Installation
Docker Installation (Recommended)
Using Docker is the most reliable way to run MCP Git Server, as it ensures a consistent environment with all dependencies.
# Clone the repository
git clone https://github.com/2bytes-org/git-mcp-server.git
cd git-mcp-server
# Build Docker image
# Linux/macOS
./scripts/build-docker.sh
# or Windows
.\scripts\build-docker.ps1
For detailed Docker setup instructions, see .
Configuration with Claude Desktop (Recommended Method)
Using Docker with Claude Desktop
Add the following to your Claude Desktop configuration file:
{
"mcpServers": {
"git": {
"command": "docker",
"args": [
"run",
"--rm",
"-i",
"--mount", "type=bind,src=C:/path/to/your/projects,dst=/workspace",
"mcp/git"
]
}
}
}
⚠️ IMPORTANT: Replace C:/path/to/your/projects
with the absolute path to your projects directory:
- Use forward slashes
/
even on Windows - The path must be absolute (e.g.,
C:/Users/username/Documents
) - Make sure the specified directory exists
Configuration file locations:
- Windows:
%APPDATA%\Claude\config.json
- macOS:
~/Library/Application Support/Claude/config.json
- Linux:
~/.config/Claude/config.json
Available Commands
git_status
: Shows the working tree statusgit_diff_unstaged
: Shows changes in working directory not yet stagedgit_diff_staged
: Shows changes that are staged for commitgit_diff
: Shows differences between branches or commitsgit_commit
: Records changes to the repositorygit_add
: Adds file contents to the staging areagit_reset
: Unstages all staged changesgit_log
: Shows the commit logsgit_create_branch
: Creates a new branchgit_checkout
: Switches branchesgit_show
: Shows the contents of a commitgit_init
: Initializes a Git repository
Troubleshooting
If you encounter issues with the Docker setup:
-
Invalid mount path error: Make sure you're using absolute paths with forward slashes in your configuration
- Example:
C:/Users/username/Documents
(not${workspaceFolder}
or Windows backslashes)
- Example:
-
Other issues:
- Ensure Docker is installed and running
- Verify that you have proper permissions to build Docker images
- Try running the Docker build manually:
docker build -t mcp/git .
For more detailed troubleshooting, check the logs:
docker logs $(docker ps -q --filter "ancestor=mcp/git")
VS Code and Zed Integration
The server also works with other editors that support MCP. See the examples
directory for configuration templates.
License
This MCP server is licensed under the MIT License.