git-mcp
A Git MCP server that doesn't suck
Return to top
git-mcp is a production-grade Model Context Protocol server that gives AI agents full access to Git workflows. It uses simple-git under the hood and requires only a system Git installation — no other dependencies.
It is especially useful for coding agents running inside GitHub Copilot, Claude Code, Cursor, and OpenAI Codex, where reliable Git inspection and safe mutation matter more than vibes and shell roulette.
Prerequisites
- Node.js 20 or later
- Git installed and available on
PATH - An MCP-compatible AI agent or coding agent host (Claude Desktop, GitHub Copilot in VS Code, Cursor, OpenAI Codex, etc.)
Installation
npx (no install required)
Run git-mcp on demand without installing anything globally:
bash
npx @selfagency/git-mcp
Global install
bash
npm install -g @selfagency/git-mcp
git-mcp
From source
bash
git clone https://github.com/selfagency/git-mcp.git
cd git-mcp
pnpm install
pnpm build
pnpm start
Connecting to Claude Desktop
Edit your Claude Desktop configuration file:
- macOS:
~/Library/Application Support/Claude/claude_desktop_config.json - Windows:
%APPDATA%\Claude\claude_desktop_config.json
json
{
"mcpServers": {
"git": {
"command": "npx",
"args": ["-y", "@selfagency/git-mcp"],
"env": {
"GIT_REPO_PATH": "/path/to/your/repo"
}
}
}
}
Restart Claude Desktop after saving the file. You should see a hammer icon in the chat toolbar indicating MCP tools are available.
Connecting to VS Code (GitHub Copilot)
User settings
Add to your VS Code settings.json (Cmd+Shift+P → "Open User Settings (JSON)"):
json
{
"mcp": {
"servers": {
"git": {
"type": "stdio",
"command": "npx",
"args": ["-y", "@selfagency/git-mcp"],
"env": {
"GIT_REPO_PATH": "${workspaceFolder}"
}
}
}
}
}
Workspace .vscode/mcp.json
For per-project configuration, create .vscode/mcp.json in the root of your repository:
json
{
"servers": {
"git": {
"type": "stdio",
"command": "npx",
"args": ["-y", "@selfagency/git-mcp"],
"env": {
"GIT_REPO_PATH": "${workspaceFolder}"
}
}
}
}
Setting a Default Repository
The GIT_REPO_PATH environment variable sets the default repository path used by all tools when repo_path is not provided in the tool call:
bash
GIT_REPO_PATH=/home/user/myproject git-mcp
You can also pass it on the command line:
bash
npx @selfagency/git-mcp --repo-path /home/user/myproject
If neither is set, the AI must provide repo_path explicitly in every tool call.
Verifying the Installation
Ask your AI agent:
"What's the git status of this repo?"
"Show me the last 5 commits."
The AI agent will call git_status or git_log and stream results back. If you see an error about repo_path, set GIT_REPO_PATH in the server configuration.
Next Steps
- Configuration reference — all environment variables
- MCP Resources — URI-addressable read-only data
- Tool reference — complete parameter documentation for every tool
- Safety model — how git-mcp protects against destructive operations
Related Servers
Scout Monitoring MCP
sponsorPut performance and error data directly in the hands of your AI assistant.
Alpha Vantage MCP Server
sponsorAccess financial market data: realtime & historical stock, ETF, options, forex, crypto, commodities, fundamentals, technical indicators, & more
Bazaar MCP Server
MCP server providing x402 micropayment-powered developer tools including screenshot capture, AI analysis, PDF generation, code security scanning, and dependency auditing via USDC payments on Base.
AC to Automation Converter
An AI-powered system that converts Acceptance Criteria (AC) from QA specifications into automated browser testing workflows.
Terragrunt-Docs
Terragrunt documentation always up to date.
Base64 Encode/Decode
A simple and efficient MCP server for Base64 encoding and decoding of text and images.
MCP Rules Enforcer Zero
An MCP server that enforces rules from markdown files for AI agents. This is a zero-tool version that requires an external rules file.
Swagger/OpenAPI MCP Server
Explore and interact with Swagger/OpenAPI specifications, allowing for browsing endpoints and retrieving details on API operations.
Liveblocks
Interact with the Liveblocks REST API to manage rooms, threads, comments, and notifications, with read access to Storage and Yjs.
CryptoAnalysisMCP
Provides comprehensive cryptocurrency technical analysis, including real-time price data, technical indicators, chart pattern detection, and trading signals for over 2,500 cryptocurrencies.
Puppeteer MCP
MCP server for browser automation via Puppeteer
Matter AI
Provides advanced code review, implementation planning, and pull request generation using Matter AI.