---
title: "Git MCP Server: Official mcp-server-git Setup and Tools"
url: "https://mcpshelf.co/servers/git"
description: "The reference Git MCP server lets an assistant read status, diffs and logs and stage, commit, branch and merge in a local repo. uvx setup and --repository."
updated: "2026-11-24"
site: "MCP Shelf"
---

# Git MCP Server

> Status, diffs, history, commits and branches in a local Git repository.

Source: https://mcpshelf.co/servers/git  
Markdown: https://mcpshelf.co/servers/git.md  
Generated: 2026-11-24T21:04:31.099Z

## Facts

- **Name:** Git MCP Server
- **Tagline:** Status, diffs, history, commits and branches in a local Git repository.
- **Description:** Git MCP Server (mcp-server-git) is the Model Context Protocol project's reference server for reading, searching and changing local Git repositories: status, diffs, history, commits, branches and merges.
- **Repository:** https://github.com/modelcontextprotocol/servers
- **Package:** mcp-server-git 2026.11.18 (PyPI)
- **Install:** `claude mcp add git -- uvx mcp-server-git --repository path/to/git/repo`
- **Transport:** stdio (local)
- **Auth:** No required keys or settings listed
- **Tools exposed:** 14: `git_status`, `git_diff_unstaged`, `git_diff_staged`, `git_diff`, `git_commit`, `git_add`, `git_reset`, `git_log`, `git_create_branch`, `git_checkout`, `git_merge`, `git_show`, `git_branch`, `git_remote`
- **Category:** Developer tools (https://mcpshelf.co/categories/developer-tools)
- **Stats:** 92.2K GitHub stars, last commit 24 Nov 2026, 0 upvotes on MCP Shelf
- **Install check:** Not yet tested by us
- **Listed:** 2026-11-24
- **Page updated:** 2026-11-24

## Full description

### What is Git MCP Server?

**Git MCP Server (mcp-server-git) is the Model Context Protocol project's reference server for reading, searching and changing local Git repositories: status, diffs, history, commits, branches and merges.**

mcp-server-git is the Git server kept by the Model Context Protocol project. It works on repositories on your own disk: the assistant can check the status, read staged and unstaged diffs, compare branches or commits, read the log and file contents at any revision, and stage, commit, branch, check out and merge. Two prompts write a commit message for staged changes or summarise what changed.

Pass --repository so it only touches the repository you name; without it, it can work on any repository your user account can reach. It never runs hooks or other programs a repository configures, so opening an unfamiliar repo is safe. It has no push or pull, which keeps anything remote in your hands.

|  |  |
| --- | --- |
| Made by | Model Context Protocol project (modelcontextprotocol/servers) |
| GitHub | https://github.com/modelcontextprotocol/servers |
| Licence | MIT |
| PyPI package | [mcp-server-git](https://pypi.org/project/mcp-server-git/) 2026.11.18 (18 Nov 2026) |
| GitHub stars | 92.2K |
| Last commit | 24 Nov 2026 |
| Tools | 14 |
| Runs on | Your computer |
| Install check | Not yet tested by us |
| Category | [Developer tools](https://mcpshelf.co/categories/developer-tools) |
| Works with | Claude Code, Cursor, Claude Desktop, VS Code, Codex, Windsurf |
| Setup checked | 24 Nov 2026 |
| Page updated | 24 Nov 2026 |

**Our check:** Written from the project's own documentation. We have not run this config ourselves yet.

#### Try asking Git MCP Server

- "Look at my staged changes and write a commit message for them."
- "What changed on this branch compared with main?"
- "Show me the last ten commits that touched src/auth."

#### MCP Shelf take

> We started Git on our own test machine on 24 Nov 2026 and it answered with 14 tools. 8 of the 14 only read; the other 6 can change things. Every tool comes with a useful description, all of them say whether they change things, and the tool list costs about 600 tokens of context before you ask a thing. It sits 2nd of 27 in its category on our shelf by GitHub stars (92.2K).

— MCP Shelf tests (numbers from our own runs), tested on 24 Nov 2026

### What tools does Git MCP Server have?

We listed 14 tools on 24 Nov 2026. 8 only read; the rest can change things or run commands.

| Tool | Kind | What it is for |
| --- | --- | --- |
| `git_status` | reads | Shows the working tree status. |
| `git_diff_unstaged` | reads | Shows changes not yet staged. |
| `git_diff_staged` | reads | Shows changes staged for the next commit. |
| `git_diff` | reads | Compares the working tree with a branch or commit, or two revisions with a..b or a...b. |
| `git_commit` | changes | Commits the staged changes with a message and returns the new hash. |
| `git_add` | changes | Stages files; ["."] stages everything. |
| `git_reset` | changes | Unstages everything that is staged, without touching your files. |
| `git_log` | reads | Lists commits, optionally between two dates such as 2 weeks ago and yesterday. |
| `git_create_branch` | changes | Creates a branch from the current one or from a branch, tag or commit you name. |
| `git_checkout` | changes | Switches to a branch, or detaches HEAD at a commit or tag. |
| `git_merge` | changes | Merges a branch into the current one, fast-forward only unless you allow a merge commit. A merge with conflicts is aborted. |
| `git_show` | reads | Shows a commit, or a file or folder as it was at a revision. |
| `git_branch` | reads | Lists local, remote or all branches, optionally those that contain a commit. |
| `git_remote` | reads | Lists the remotes and their URLs, with any credentials in them hidden. |

#### How clearly it describes its tools

14 of 14 tools have a description and 14 of 14 say whether they change things. The tool list takes at least ~600 tokens of context. Every tool says whether it only reads or can change things, so a client can ask before the risky ones.

#### Tool groups

| Group | Covers |
| --- | --- |
| `Prompts` | git_commit_message asks the model for a commit message from the staged diff, and git_summarize_changes summarises the working tree or the diff against a branch. Clients usually show them as slash commands. |

### How do I install Git MCP Server?

#### Install steps from the Git MCP Server README

Copied from the project's [README on GitHub](https://github.com/modelcontextprotocol/servers/tree/HEAD/src/git#readme) on 24 Nov 2026 under its MIT licence.

##### Using uv (recommended)

When using [`uv`](https://docs.astral.sh/uv/) no specific installation is needed. We will
use [`uvx`](https://docs.astral.sh/uv/guides/tools/) to directly run *mcp-server-git*.

##### Using PIP

Alternatively you can install `mcp-server-git` via pip:

```
pip install mcp-server-git
```

After installation, you can run it as a script using:

```
python -m mcp_server_git
```

##### Usage with Claude Desktop

Add this to your `claude_desktop_config.json`:

**Using uvx**

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

**Using docker**

- Note: replace '/Users/username' with a path that you want to be accessible by this tool
- Note: the `-e` lines set the identity `git_commit` records; see Commit identity
- Note: the image runs as the unprivileged `app` user, not root, and trusts every repository mounted into it (`safe.directory '*'`), since a bind mount rarely shows up owned by that user. On a Linux host, where a bind mount keeps the host's file ownership, add `"--user", "1000:1000"` (your own `id -u` and `id -g`) before `mcp/git` so the server can write to the repository and its commits leave files you own; with `--user`, mount a gitconfig at `/.gitconfig` rather than `/home/app/.gitconfig`, or use the `-e` lines. Docker Desktop on macOS and Windows needs neither.

```
"mcpServers": {
  "git": {
    "command": "docker",
    "args": [
      "run", "--rm", "-i",
      "-e", "GIT_AUTHOR_NAME=Your Name",
      "-e", "GIT_AUTHOR_EMAIL=you@example.com",
      "-e", "GIT_COMMITTER_NAME=Your Name",
      "-e", "GIT_COMMITTER_EMAIL=you@example.com",
      "--mount", "type=bind,src=/Users/username,dst=/Users/username",
      "mcp/git"
    ]
  }
}
```

**Using pip installation**

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

##### Usage with VS Code

For quick installation, use one of the one-click install buttons below...

For manual installation, you can configure the MCP server using one of these methods:

**Method 1: User Configuration (Recommended)**
Add the configuration to your user-level MCP configuration file. Open the Command Palette (`Ctrl + Shift + P`) and run `MCP: Open User Configuration`. This will open your user `mcp.json` file where you can add the server configuration.

**Method 2: Workspace Configuration**
Alternatively, you can add the configuration to a file called `.vscode/mcp.json` in your workspace. This will allow you to share the configuration with others.

> For more details about MCP configuration in VS Code, see the [official VS Code MCP documentation](https://code.visualstudio.com/docs/copilot/customization/mcp-servers).

```
{
  "servers": {
    "git": {
      "command": "uvx",
      "args": ["mcp-server-git"]
    }
  }
}
```

For Docker installation:

```
{
  "mcp": {
    "servers": {
      "git": {
        "command": "docker",
        "args": [
          "run",
          "--rm",
          "-i",
          "--mount", "type=bind,src=${workspaceFolder},dst=/workspace",
          "mcp/git"
        ]
      }
    }
  }
}
```

#### What you need first

- uv, to run it with uvx (or pip install mcp-server-git)
- Git and a local repository

#### Claude Code

Where: Your terminal, in the project folder

```bash
claude mcp add git -- uvx mcp-server-git --repository path/to/git/repo
```

Claude Code can already run git in its terminal, so this server matters most in chat apps. To add it anyway: claude mcp add git -- uvx mcp-server-git --repository with your repository's path.

#### Cursor

Where: ~/.cursor/mcp.json, or .cursor/mcp.json in a project

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

#### Claude Desktop

Where: claude_desktop_config.json (Settings → Developer → Edit Config)

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

#### VS Code

Where: .vscode/mcp.json in your project

```json
{
  "servers": {
    "git": {
      "type": "stdio",
      "command": "uvx",
      "args": [
        "mcp-server-git",
        "--repository",
        "path/to/git/repo"
      ]
    }
  }
}
```

#### Codex

Where: ~/.codex/config.toml, shared by the Codex CLI, IDE extension and ChatGPT desktop app

```
[mcp_servers.git]
command = "uvx"
args = ["mcp-server-git", "--repository", "path/to/git/repo"]
```

Or run: `codex mcp add git -- uvx mcp-server-git --repository path/to/git/repo`

#### Windsurf

Where: ~/.codeium/windsurf/mcp_config.json

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

#### ChatGPT

Where: Not supported

ChatGPT on the web only connects to servers by URL. This one runs on your computer: the ChatGPT desktop app can start it from its MCP servers settings, with the same config as the Codex tab.

Replace path/to/git/repo with your repository. Commits use your Git config name and email; set GIT_AUTHOR_NAME, GIT_AUTHOR_EMAIL and the two GIT_COMMITTER variables in env to choose another identity.

Checked against the project's own install docs on 24 Nov 2026: https://github.com/modelcontextprotocol/servers/tree/main/src/git#readme, https://pypi.org/project/mcp-server-git/

### How do I configure Git MCP Server?

| Setting | Kind | Required | What it does |
| --- | --- | --- | --- |
| `--repository (-r)` | flag | no | Limits the server to one repository. Without it, each tool call names its own repo_path and can reach any repository your user can. Example: `--repository path/to/git/repo` |
| `GIT_AUTHOR_NAME and GIT_AUTHOR_EMAIL` | env | no | The author git_commit records. Without them it uses your Git config's user.name and user.email. |
| `GIT_COMMITTER_NAME and GIT_COMMITTER_EMAIL` | env | no | The committer, resolved separately from the author, so set all four together. |
| `--transport streamable-http` | flag | no | Runs it as a local HTTP service instead of over stdio. |

### What can Git MCP Server read and change?

**It can read**

- Status, diffs, history and branches of the repository
- File contents at any revision
- Remote names and URLs, with credentials hidden

**It can change**

- Stages and unstages files and makes commits
- Creates and checks out branches, which changes files in the working tree
- Merges branches into the current one

**Safer setup:** Always pass --repository so it can only reach one repository. It has no push, pull or fetch, never runs the repository's hooks or configured programs, and refuses merges over uncommitted changes.

### Good for

- Asking for a commit message or a review of what you changed
- Digging through history: when a line changed and what else changed with it
- Assistants without a terminal, such as Claude Desktop, working on a local repo

### Git MCP Server not working? Common fixes

**It exits saying path/to/git/repo does not exist**
Replace the example path after --repository with the path of a real repository on your machine. Any folder inside the working tree works; the server finds the root itself.

**Commits show the wrong name, or something like app@3f2a1b9c**
The server falls back to the system user when no identity is set, which happens in Docker. Set GIT_AUTHOR_NAME, GIT_AUTHOR_EMAIL, GIT_COMMITTER_NAME and GIT_COMMITTER_EMAIL in env, or mount your .gitconfig.

**A tool call says repo_path is outside the repository**
With --repository set, every call must point inside that repository. Start a second server entry for another repository, or remove --repository if you accept the wider access.

**git_merge fails**
It refuses a detached HEAD, uncommitted changes and a merge already in progress, and it aborts on conflicts and names the files. Commit or reset first, then resolve conflicts yourself.

### What are the alternatives to Git MCP Server?

| Server | What it does | Tools | Runs on | Licence | Stars |
| --- | --- | --- | --- | --- | --- |
| [Git MCP Server](https://mcpshelf.co/servers/git) | Status, diffs, history, commits and branches in a local Git repository. | 14 | Your computer | MIT | 92.2K |
| [Desktop Commander](https://mcpshelf.co/servers/desktop-commander) | A terminal, file search and surgical file edits for your assistant. | 25 | Your computer | MIT | 10.2K |
| [Serena](https://mcpshelf.co/servers/serena) | IDE-style "find symbol" and "edit symbol" for an agent, backed by language servers. | 3 (REPL) | Your computer | GPL-3.0 | 30.8K |
| [GitHub](https://mcpshelf.co/servers/github) | GitHub's own server for repos, issues, pull requests and Actions. | 46 | Hosted or your computer | MIT | 34K |
| [Filesystem MCP Server](https://mcpshelf.co/servers/filesystem) | Read, write, edit and search files, only inside the folders you name. | 16 | Your computer | Apache-2.0 and MIT | 92.2K |
| [jCodeMunch](https://mcpshelf.co/servers/jcodemunch) | Indexes your code so an agent can fetch one function instead of reading whole files. | 6 | Your computer | LicenseRef-jCodeMunch-Dual-Use-1 | 2.8K |

### Git MCP Server FAQ

#### Is the Git MCP Server official?

Yes. mcp-server-git is a reference server from the Model Context Protocol project, in the modelcontextprotocol/servers repository, published on PyPI and on Docker Hub as mcp/git. It is still described as early development, so tools may change.

#### Can the Git MCP Server push to GitHub?

No. It has no push, pull or fetch, so nothing leaves your machine. For GitHub itself, such as pull requests and issues, use the GitHub MCP server.

#### Is it different from GitMCP?

Yes. GitMCP is a hosted service that reads the docs of public GitHub repositories. mcp-server-git works on Git repositories on your own disk, including uncommitted changes.

#### Why should I pass --repository?

Without it, the model chooses a repo_path on every call and can read and change any repository your account can reach. With --repository, it is held to the one you name.

#### Is it safe to open a repository I did not write?

It is built for that. It never runs a repository's hooks, filters, diff drivers or other programs its config names, and refuses repositories that point outside themselves.

#### How do I add the Git MCP Server to Claude Desktop?

In claude_desktop_config.json, add an entry named git with the command uvx and the args mcp-server-git, --repository and the path to your repository, then restart Claude Desktop.

#### How do I add the Git MCP Server to Cursor?

Add an entry named git to ~/.cursor/mcp.json with the command uvx and the args mcp-server-git, --repository and your repository's path.

#### Can I use the Git MCP Server in VS Code?

Yes, with GitHub Copilot in Agent mode. Add a server named git running uvx mcp-server-git to .vscode/mcp.json, and add --repository with the workspace path to keep it to that repository.

#### Does the Git MCP Server work with Codex?

Yes. Run codex mcp add git -- uvx mcp-server-git --repository followed by the path, or add the same command and args as an [mcp_servers.git] table in ~/.codex/config.toml.

Full docs on GitHub: https://github.com/modelcontextprotocol/servers

## Notes for agents

Fetch these instead of parsing the HTML page:

- llms.txt: https://mcpshelf.co/llms.txt
- llms-full.txt: https://mcpshelf.co/llms-full.txt
- ai.txt: https://mcpshelf.co/ai.txt
- Full catalog (.md): https://mcpshelf.co/catalog.md
- API spec: https://mcpshelf.co/openapi.json
- MCP server: https://mcpshelf.co/mcp
- MCP manifest: https://mcpshelf.co/.well-known/mcp.json
- Developer docs: https://mcpshelf.co/developers

MCP endpoint (Streamable HTTP, no key): https://mcpshelf.co/mcp. REST API: https://mcpshelf.co/api/v1.

