# Git

> Local Git operations: commit, diff, log, branch, and more.

[Canonical HTML page](https://top-mcps.com/mcp/git) · [server.json](https://top-mcps.com/mcp/git.json) · [methodology](https://top-mcps.com/about/methodology)

## Install

### Claude Desktop — `claude_desktop_config.json`

Paste under mcpServers. Fully quit and reopen Claude after editing.

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

### Claude Code — `CLI or .mcp.json`

Run from your repo. Commit .mcp.json to share with your team.

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

### Cursor — `.cursor/mcp.json`

Global path: ~/.cursor/mcp.json. Reload window after editing.

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

### VS Code — `.vscode/mcp.json`

VS Code uses the "servers" key (not "mcpServers").

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

### Windsurf — `~/.codeium/windsurf/mcp_config.json`

Open via Cascade → hammer icon → Configure.

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

### Cline — `cline_mcp_settings.json`

Open via the Cline sidebar → MCP Servers → Edit.

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

### Continue — `~/.continue/config.json`

Continue uses modelContextProtocolServers with a transport block.

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

### Codex CLI — `~/.codex/config.toml`

Codex uses TOML. Each server is a [mcp_servers.<name>] subtable.

```shell
# ~/.codex/config.toml
[mcp_servers.git]
command = "uvx"
args = [
  "mcp-server-git",
  "--repository",
  "/path/to/repo",
]
```

### Zed — `~/.config/zed/settings.json`

Zed calls them "context_servers". Settings live-reload on save.

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

### ChatGPT — `ChatGPT → Apps directory`

Git doesn't ship a hosted HTTPS endpoint today. ChatGPT supports remote MCP servers only — to use this server in ChatGPT you'll need to deploy it to a public HTTPS URL first (e.g. via Cloudflare Workers or Vercel) or wait for an official remote build.

```none

```

## At a glance

- **Maintainer:** Anthropic (modelcontextprotocol)
- **Transport:** stdio
- **Auth model:** None
- **Required secrets:** None
- **Supported clients:** Claude, Cursor, Any MCP-compatible client, Git 2.x+
- **License:** MIT
- **Language:** Python
- **Latest version:** latest
- **Last verified:** 2026-05-31
- **GitHub stars:** 84,102 (fetched 2026-06-02T11:55:51.519Z)
- **Score:** 93/100 (rubric 2026-04 — see https://top-mcps.com/about/methodology)
- **Source:** https://github.com/modelcontextprotocol/servers/tree/main/src/git

## Tools & permissions

| Tool | Description | Args | Side effects |
|------|-------------|------|--------------|
| `git_status` | Show the working tree status. | `repo_path: string` | read |
| `git_diff_unstaged` | Diff unstaged changes. | `repo_path: string` | read |
| `git_diff_staged` | Diff staged changes. | `repo_path: string` | read |
| `git_add` | Stage files. | `repo_path: string, files: string[]` | write |
| `git_commit` | Create a commit with the staged changes. | `repo_path: string, message: string` | write |
| `git_reset` | Unstage files. | `repo_path: string` | write |
| `git_log` | Show commit history. | `repo_path: string, max_count?: number` | read |
| `git_create_branch` | Create a new branch. | `repo_path: string, branch_name: string` | write |
| `git_checkout` | Switch branches. | `repo_path: string, branch_name: string` | write |
| `git_show` | Show details of a commit. | `repo_path: string, revision: string` | read |

## Security & scope

- **Access scope:** read-write
- **Sandbox:** Runs local `git` CLI commands scoped to the repository path passed at launch. No implicit network access unless the agent invokes a push or fetch tool.
- **Gotchas:**
  - `git push` uses whatever credentials are configured in the local git config — if a credential helper is unlocked, the agent has push access.
  - No signing by default; commits authored by the agent carry the local user config.

## Quick answer

**What it does.** Executes Git operations on local repositories: status, diff, log, commit, branch, checkout, merge, and more.

**Best for:**
- Commit message generation
- Diff summarization
- Branch management
- Merge conflict help
- Code history exploration

**Not for:**
- GitHub API operations
- Remote repository management
- GitLab workflows

## Recipes

### Review, stage, and commit changes in a repo

```
In the repo at ~/code/project-a, show me git status and a diff of unstaged changes. If everything looks safe, stage them and create a single conventional-commit commit like `feat: …` summarising the change in under 72 characters.
```

_Tested with: Claude Desktop, Cursor_

## Description

The Git MCP provides AI models with direct access to local Git repositories. Run commits, diffs, logs, branch operations, and status checks without leaving the AI context. The best option when you want AI-assisted Git operations on local code without GitHub connectivity.

## Why it matters

Developers need Git context to understand code history and changes. This MCP gives models that context directly, improving code assistance quality.

## Key features

- Local Git operations
- Diff and status viewing
- Commit creation
- Branch management
- Log and history access
- Official Anthropic support

## FAQ

### What is the difference between the Git MCP and the GitHub MCP?

Git MCP drives the local `git` binary — status, diff, log, stage, commit. It never talks to a remote. GitHub MCP uses the GitHub REST API for remote-only things: PRs, issues, code search. Pair them when you want the agent to do both: stage a commit locally, then open the PR.

### Can it create commits?

Yes. It can stage specific files, run `git commit` with a supplied message, and report back the resulting SHA. It deliberately does not run `git push` — pushing is left to a separate step so the agent cannot mutate remote state by accident.

### Does it handle merge conflicts?

It surfaces conflict state via `git_status` and can read the conflicted file contents, but it does not auto-resolve. The agent is expected to read the markers, decide, and run subsequent edits through the Filesystem MCP.

### Do I have to pass `--repository` up front?

Yes — the server pins itself to one repo per process. If you work across several repos, declare multiple entries in your MCP config (one per repo) or pass a workspace-root variable that expands at launch.

### Why use `uvx` instead of `npx`?

This MCP is written in Python and distributed on PyPI. `uvx` runs it without polluting a global Python install, the same way `npx` does for Node packages. If you do not have `uv` yet: `curl -LsSf https://astral.sh/uv/install.sh | sh`.

## Changelog

- **2026-05-31** — Refreshed install snippets and fact sheet; verified for 2026.
- **2024-11-25** — Initial directory listing.
