Back to MCP Servers

Git MCP Server

Reference MCP server for Git repository interaction and automation. Read, search, and manipulate local Git repos directly from an LLM.

Developer Tools by Anthropic (Model Context Protocol) None active
Overview

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.
Setup Guide

Prerequisites

  • Git installed and available on PATH.
  • One of: uv/uvx, Python with pip, 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 .
Use Cases
  • Let an agent read git status and git diff to 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_commit for you.
  • Browse commit history with git_log filtered by date range to produce changelogs or release notes.
  • Inspect a specific commit with git_show to 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.
Example Prompts
  • "Show me the unstaged diff in this repo and summarize what changed."
  • "Stage src/api.ts and src/types.ts, then commit with a conventional commit message describing the changes."
  • "List all local branches that contain the word feature and check out the most recent one."
  • "Show the contents of commit a1b2c3d and explain what it does."
  • "Give me the commit log from 2026-04-01 to 2026-05-01 and turn it into release notes."
Pros
  • Official reference implementation maintained in the canonical modelcontextprotocol/servers repo.
  • 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.
Limitations
  • No remote operations: missing push, pull, fetch, clone, merge, and rebase.
  • No tag, stash, or cherry-pick support.
  • Marked as early-stage; functionality and APIs may evolve.
Alternatives
  • 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 git directly without an MCP server.