Labsco
selfagency logo

git-mcp

from selfagency

A Git MCP server that doesn't suck

๐Ÿ”ฅ๐Ÿ”ฅ๐Ÿ”ฅ๐Ÿ”ฅโœ“ VerifiedFreeQuick setup

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.

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

Copy & paste โ€” that's it
{
 "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

Copy & paste โ€” that's it
{
 "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

Copy & paste โ€” that's it
{
 "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

Copy & paste โ€” that's it
GIT_REPO_PATH=/home/user/myproject git-mcp

You can also pass it on the command line:

bash

Copy & paste โ€” that's it
npx @selfagency/git-mcp --repo-path /home/user/myproject

If neither is set, the AI must provide repo_path explicitly in every tool call.

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