Git MCP Server
Reference MCP server for Git repository interaction and automation. Read, search, and manipulate local Git repos directly from an LLM.
The Git MCP server is a reference implementation in the official modelcontextprotocol/servers repository. It exposes a focused set of Git operations as MCP tools, allowing an LLM agent to inspect repository state, read diffs, browse commit history, stage changes, create commits, and manage branches on local Git repositories.
It is written in Python and ships as the mcp-server-git package. You can run it with uvx, install it with pip, or build/run it as a Docker container. Authentication is not required since it operates on local repositories using the installed Git toolchain; the server is pointed at a repo via the --repository flag (or via a bind-mounted path when running in Docker).
As a reference implementation, the server is intentionally minimal and stays close to common Git verbs (status, diff, log, show, add, commit, reset, branch, checkout). It is a good baseline for letting Claude or other MCP-compatible agents work with source code, but it does not cover remote operations like push, pull, or fetch.
Tools
| Tool | Description |
|---|---|
git_status |
Shows the working tree status of the repository. |
git_diff_unstaged |
Displays changes in the working directory that are not yet staged. |
git_diff_staged |
Displays changes that are staged for the next commit. |
git_diff |
Compares the current branch with another branch or commit. |
git_log |
Shows the commit history, with optional filtering by start and end timestamps. |
git_show |
Displays the contents and metadata of a specific commit. |
git_add |
Stages the given file paths for the next commit. |
git_commit |
Records staged changes as a new commit with the provided message. |
git_reset |
Unstages all currently staged changes. |
git_create_branch |
Creates a new branch, optionally from a specified base branch. |
git_checkout |
Switches the working tree to the specified branch. |
git_branch |
Lists branches (local, remote, or all) with optional contains/not-contains filters. |
Prerequisites
- Git installed and available on PATH.
- One of:
uv/uvx, Python withpip, or Docker. - A local Git repository to point the server at.
Install
Recommended (uv, no install needed):
uvx mcp-server-git --repository path/to/git/repo
With pip:
pip install mcp-server-git
python -m mcp_server_git --repository path/to/git/repo
Claude Desktop config (uvx)
Add to claude_desktop_config.json:
{
"mcpServers": {
"git": {
"command": "uvx",
"args": ["mcp-server-git", "--repository", "path/to/git/repo"]
}
}
}
Claude Desktop config (Docker)
{
"mcpServers": {
"git": {
"command": "docker",
"args": [
"run", "--rm", "-i",
"--mount", "type=bind,src=/Users/username,dst=/Users/username",
"mcp/git"
]
}
}
}
VS Code config
Add to your mcp.json:
{
"mcp": {
"servers": {
"git": {
"command": "uvx",
"args": ["mcp-server-git"]
}
}
}
}
To build the Docker image locally:
cd src/git
docker build -t mcp/git .
- Let an agent read
git statusandgit diffto summarize what changed in a working tree before you commit. - Have Claude generate a commit message from staged changes and then run
git_add+git_commitfor you. - Browse commit history with
git_logfiltered by date range to produce changelogs or release notes. - Inspect a specific commit with
git_showto review what a teammate did and explain it in plain English. - Create and switch to feature branches (
git_create_branch,git_checkout) as part of an automated coding workflow.
- "Show me the unstaged diff in this repo and summarize what changed."
- "Stage
src/api.tsandsrc/types.ts, then commit with a conventional commit message describing the changes." - "List all local branches that contain the word
featureand check out the most recent one." - "Show the contents of commit
a1b2c3dand explain what it does." - "Give me the commit log from 2026-04-01 to 2026-05-01 and turn it into release notes."
- Official reference implementation maintained in the canonical
modelcontextprotocol/serversrepo. - Multiple distribution options:
uvx,pip, and Docker. - Covers the common local Git workflow (status, diff, log, show, add, commit, branch, checkout) with a small, predictable surface.
- No auth or external API required; works fully offline on local repos.
- No remote operations: missing
push,pull,fetch,clone,merge, andrebase. - No tag, stash, or cherry-pick support.
- Marked as early-stage; functionality and APIs may evolve.
- GitHub MCP server for hosted GitHub operations (issues, PRs, repos) via the GitHub API.
- GitLab MCP server for GitLab projects, issues, and merge requests.
- Built-in shell/Bash tooling in coding agents, which can invoke
gitdirectly without an MCP server.