Git MCP Server

Official

Local repository surgery — status, diffs, commits, branches and history for any repo on disk.

Local serverstdioPythonMIT 63.0k

What is the Git MCP server?

Where the GitHub server talks to the cloud, the Git MCP server works the repositories on your own disk. It wraps everyday git plumbing — status, log, diff, show, add, commit, branch operations — so an assistant can understand and manipulate local repo state directly rather than inferring it from whatever files happen to be in context.

The most valuable tools are the read ones. git_diff and git_log give an assistant real awareness of what's changed and why: "what have I modified since main, and what did the last five commits to this file actually do?" is answerable precisely instead of approximately. For code review before you push, having the assistant read the staged diff and critique it is a genuinely good habit — a second pair of eyes that's already in your terminal.

Write operations (staging, committing, branch creation) are there too, which enables the pleasant workflow of finishing a change and saying "stage the relevant files and write a sensible commit message." The commit messages it writes from an actual diff tend to be better than the ones humans write from memory.

It's a Python server, run via uvx mcp-server-git, and lives in the archived reference repository — stable, minimal, unlikely to grow features. Note that agentic coding tools like Claude Code already run git through their shell access, so this server matters most for chat-style clients (Claude Desktop) that lack a shell, or when you want git operations exposed as structured, auditable tools rather than arbitrary commands.

Fitting it into a workflow

  • git_reset here means unstage. It clears the index rather than doing anything resembling --hard, so no tool in the set can throw away uncommitted work.
  • Diffs come back as raw text, and a sprawling feature branch will happily swallow the context window. Ask for a diff against a base ref instead of the whole branch when the change is large.
  • There is no fetch, pull, push or stash tool, so the assistant can never desync you with a remote — a limitation that doubles as the safety story.
  • If uvx isn't your style, pip install mcp-server-git and python -m mcp_server_git give you the same server from an ordinary virtualenv.

What you can do with it

Pre-push self-review

Have the assistant read your staged diff and point out problems before anyone else sees them.

History forensics

"When did this function change and why?" answered from actual log and show output.

Commit hygiene

Generated commit messages that describe the real diff instead of 'fix stuff'.

Available tools

ToolWhat it does
git_statusWorking tree status: modified, staged, untracked files
git_diff / git_diff_stagedDiffs of unstaged or staged changes
git_logCommit history with messages and authors
git_showInspect a specific commit's contents
git_addStage files for commit
git_commitCommit staged changes with a message
git_create_branch / git_checkoutCreate and switch branches

How to install the Git MCP server

{
  "mcpServers": {
    "git": {
      "command": "uvx",
      "args": ["mcp-server-git", "--repository", "/path/to/your/repo"]
    }
  }
}

Omit --repository to let tools take a repo path per call.

Configuration

Python 3.10+ with uv, and git on PATH. Point it at repos you trust the assistant to touch.

Example prompts to try

  • What's my current working tree state? Summarise the changes since main.
  • Review my staged diff and flag anything questionable before I commit.
  • Stage the files related to the login fix and commit with an appropriate message.

Frequently asked questions

Usually not — Claude Code runs git via its shell already. It's most useful in shell-less clients like Claude Desktop, or when you prefer git exposed as explicit, auditable tools.