# Git — MCP Server

> Read history, stage and commit in a local repository.

**Source:** https://mcpplaygroundonline.com/mcp-servers/git  
**Transport:** stdio  
**Requires auth:** No

---

## What it does

This is the third piece of the local development set, alongside the filesystem and GitHub servers, and it covers the part neither of the others reach. The filesystem server sees files as they are now; GitHub sees what has already been pushed. Git sees the working tree — what changed, what is staged, what the history says about why. In practice that is what makes a model useful on a real branch: it can read git_diff_staged before writing a commit message, check git_log to match the repository conventions, or run git_show on the commit that introduced a bug. The write tools are deliberately narrow. There is no push, no rebase, no force anything — the destructive end of git is simply not exposed, so the blast radius of a confused agent stays inside the local repository. You point the server at a repository path when you launch it.

## Tools exposed

- git_status — working tree status, the usual starting point
- git_diff_unstaged / git_diff_staged — what changed, and what is about to be committed
- git_diff — compare two branches or commits directly
- git_add / git_reset — stage file contents, or unstage everything
- git_commit — record staged changes with a message
- git_log — commit history, with optional date filtering
- git_show — the full contents of a single commit
- git_branch / git_create_branch / git_checkout — list, create and switch branches

## Example queries you can run

- "Read the staged diff and write a commit message that matches this repo’s style."
- "What changed on this branch compared to main, and does anything look unrelated?"
- "Find the commit that introduced this function and show me what else it touched."
- "Create a branch for this fix, stage only the files I changed, and commit."

## Details

- **Recommended model:** anthropic/claude-sonnet-4.5 — Reading a diff and summarising intent is the core task here. Sonnet 4.5 writes commit messages that describe why rather than restating the changed filenames.
- **Transport:** stdio
- **Authentication:** Not required — No credentials. The server operates on a local repository path, so access is bounded by the repository you point it at.
- **Official source:** [Git MCP Server — official reference implementation](https://github.com/modelcontextprotocol/servers/tree/main/src/git)

## Connecting to Git

### Client configuration

**uvx (recommended)**

Pass --repository to bind the server to one repo. Without it, the client supplies the path through Roots.

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

**pip install**

Use this when you want the package pinned in an environment you manage rather than resolved at launch.

```
{
  "mcpServers": {
    "git": {
      "command": "python",
      "args": ["-m", "mcp_server_git", "--repository", "/path/to/your/repo"]
    }
  }
}
```

## Frequently asked questions

### What is the Git MCP server?

It is an official reference server from the Model Context Protocol project, published on PyPI as mcp-server-git. It lets a model read and manipulate a local git repository — status, diffs, log, branches, staging and commits.

### How is this different from the GitHub MCP server?

The GitHub server talks to GitHub’s API — pull requests, issues, code search, anything already pushed. The Git server operates on a repository on your own disk, including uncommitted work. They complement each other: read the working tree with Git, then open a PR with GitHub.

### Can an agent push or force-push with it?

No. The tool set stops at commit — there is no push, rebase, reset --hard or force operation exposed at all. That is a deliberate design choice, and it means the worst outcome is a local commit you can undo rather than rewritten remote history.

### How do I point it at the right repository?

Pass --repository with an absolute path when launching the server. Clients that support Roots can instead supply the working directory dynamically, which is useful if you move between projects in the same session.

### Is it safe to let a model commit?

Reasonably, because git itself is the safety net — a bad commit is one reset away, and nothing leaves your machine. The real practice worth keeping is reviewing git_diff_staged yourself before approving the commit call, which also catches the case where the model staged more than you expected.

---

_Test this server across 40+ models on MCP Playground: https://mcpplaygroundonline.com/mcp-servers/git — free, no install._
