# Git MCP server

> Lets an AI client manage local Git repositories including status, logs, diffs, branches, and gated commits using pure JavaScript.

- Repository: https://github.com/Abhishekkumar2021/mcp-suite
- Page: https://hostedmcp.org/servers/abhishekkumar2021/git
- Transport: stdio
- Stars: 1
- License: MIT
- Latest version: 0.2.0

## Install

### Claude Code

```sh
claude mcp add --env 'GIT_ROOTS=<GIT_ROOTS>' git -- npx -y @abhishekmcp/git
```

### Cursor (`~/.cursor/mcp.json`)

```json
{
  "mcpServers": {
    "git": {
      "command": "npx",
      "args": [
        "-y",
        "@abhishekmcp/git"
      ],
      "env": {
        "GIT_ROOTS": "<GIT_ROOTS>"
      }
    }
  }
}
```

### VS Code (`.vscode/mcp.json`)

```json
{
  "servers": {
    "git": {
      "type": "stdio",
      "command": "npx",
      "args": [
        "-y",
        "@abhishekmcp/git"
      ],
      "env": {
        "GIT_ROOTS": "<GIT_ROOTS>"
      }
    }
  }
}
```

### VS Code CLI

```sh
code --add-mcp '{"name":"git","type":"stdio","command":"npx","args":["-y","@abhishekmcp/git"],"env":{"GIT_ROOTS":"<GIT_ROOTS>"}}'
```

### Claude Desktop (`claude_desktop_config.json`)

```json
{
  "mcpServers": {
    "git": {
      "command": "npx",
      "args": [
        "-y",
        "@abhishekmcp/git"
      ],
      "env": {
        "GIT_ROOTS": "<GIT_ROOTS>"
      }
    }
  }
}
```

### Codex

```sh
codex mcp add git --env 'GIT_ROOTS=<GIT_ROOTS>' -- npx -y @abhishekmcp/git
```

### Codex config.toml (`~/.codex/config.toml`)

```toml
[mcp_servers.git]
command = "npx"
args = ["-y", "@abhishekmcp/git"]

[mcp_servers.git.env]
GIT_ROOTS = "<GIT_ROOTS>"
```

### Gemini CLI

```sh
gemini mcp add -s user -e 'GIT_ROOTS=<GIT_ROOTS>' git npx -- -y @abhishekmcp/git
```

### Gemini settings.json (`~/.gemini/settings.json`)

```json
{
  "mcpServers": {
    "git": {
      "command": "npx",
      "args": [
        "-y",
        "@abhishekmcp/git"
      ],
      "env": {
        "GIT_ROOTS": "<GIT_ROOTS>"
      }
    }
  }
}
```

## Environment variables

| Name | Required | Secret | Description |
|---|---|---|---|
| `GIT_ROOTS` | yes | no | Allowed repo root directories (comma-separated). Required — the server refuses to start without it. |
| `GIT_WRITABLE` | no | no | Set to 1 or true to enable local write tools (stage/commit/branch/checkout). |
| `NOTES_DIR` | no | no |  |

## FAQ

### Does this Git server require a local Git binary installed?

No, the server is written in pure JavaScript and does not require a Git binary to function.

### What Git operations can the AI perform with this server?

The server supports checking status, viewing logs and diffs, inspecting file history and branches/tags, performing gated staging and commits, and managing remotes via clone, fetch, pull, and push.

### How can I install the Git MCP server?

You can install it via npm using `npx -y @abhishekmcp/git` or by adding the Claude Code plugin.
