# Git MCP

> Git MCP is an open-source MCP server for developer tools. MCP server giving AI coding agents full Git workflow access with safety defaults. It runs locally on your machine and is started by your AI client.

- **Kind:** MCP server
- **Pricing:** Open source
- **Platforms:** CLI, vscode, self-hosted, macOS, Linux, Windows
- **Repository:** https://github.com/selfagency/git-mcp
- **MCP Registry name:** io.github.selfagency/git-mcp
- **Categories:** [developer tools](https://ai-powered.com/categories/developer-tools)
- **Listing updated:** 2026-11-18

## About

The README says git-mcp exposes a broad Git surface to MCP clients, grouped into about 18 root tools covering status, history, commits, branches, remotes, stash, rebase, bisect, worktrees, submodules, LFS and git-flow. Each root tool selects an operation through an action parameter, so an agent can inspect a repository before it changes anything.

Mutating behaviour is gated by configuration. Force push, hook bypass and git-flow hook execution are off until their environment variables are set, and reset and history-rewrite actions require an explicit confirm flag. Commit and tag signing with GPG or SSH keys can be enabled server-wide. Paths are checked against the repository root, and the project is built on the simple-git library.

It is aimed at people who run coding agents such as Copilot, Claude Code, Cursor or Codex against their repositories and want structured Git operations rather than raw shell commands. It also adds pull request creation and merging across GitHub, GitLab, Forgejo, Gitea and Bitbucket, and repository analytics computed from local history.

## Features

- **Broad Git workflow coverage:** Exposes status, history, commits, branches, remotes, workspace operations and LFS through grouped tools with many actions.
- **Safety defaults:** Force push, hook bypass and git-flow hooks stay disabled until enabled, and destructive resets need explicit confirmation.
- **Commit and tag signing:** Supports GPG and SSH signing with optional automatic signing for commits and tags.
- **Git Flow support:** Drives the git-flow-next CLI for initialisation, topic branches, configuration and finish operations.
- **Pull request actions:** Creates, lists and merges pull or merge requests via provider CLIs or REST tokens.
- **Repository analytics and history rewrite:** Reports contributors, file churn and activity, and offers reword, squash and backup/restore for history edits.

## Good for

- Letting a coding agent inspect working tree state and recent history before proposing changes
- Creating feature branches, committing and opening a pull request from an agent session
- Recovering from a bad reset or rebase using reflog and backup branches
- Managing worktrees and submodules for parallel work on one repository
- Running git-flow release or hotfix workflows through an assistant

## Install

### Claude Code (Terminal)

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

### Claude Desktop (claude_desktop_config.json)

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

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

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

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

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

### Windsurf (~/.codeium/windsurf/mcp_config.json)

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

### Other clients (your client's MCP settings (most use this shape))

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

## FAQ

### How is the server installed?

The README shows running it with npx @selfagency/git-mcp and a --repo-path argument, or installing it globally with npm. Example configs are given for Claude Desktop and VS Code.

### Are force pushes allowed by default?

No. Force push is disabled unless GIT_ALLOW_FORCE_PUSH is set to true, while force_with_lease is always available.

### Which clients does it work with?

The README names GitHub Copilot, Claude Code, Cursor and OpenAI Codex, and says it should work with any MCP client that can call tools and resources.

### Does it need git-flow installed?

Only for the git_flow tool, which requires the git-flow-next CLI on PATH or a GIT_FLOW_BINARY override. Other tools use git directly.

### Is Git MCP free?

Yes. Git MCP is open source, so you can use and self-host it for free.

### How do I add Git MCP to Claude Code?

Run this command in your terminal: claude mcp add git-mcp --env GIT_SIGNING_KEY='<GIT_SIGNING_KEY>' -- npx -y @selfagency/git-mcp

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

The closest alternatives to Git MCP are GitEasy MCP, GitHub, Agentic MCP, Fluxgit MCP Server and Advanced GitLab MCP server.

## Where this comes from

- Description: written from the project's README and its MCP Registry entry.
- Install steps: from the official MCP Registry entry.

## Alternatives

- [GitEasy MCP](https://ai-powered.com/mcp/giteasy-mcp): GitEasy MCP is a freemium MCP server for developer tools.
- [GitHub](https://ai-powered.com/mcp/github-2): GitHub is an open-source MCP server for developer tools.
- [Agentic MCP](https://ai-powered.com/mcp/agentic-mcp): Agentic MCP is an open-source MCP server for developer tools.
- [Fluxgit MCP Server](https://ai-powered.com/mcp/fluxgit-mcp-server): Fluxgit MCP Server is an open-source MCP server for developer tools.
- [Advanced GitLab MCP server](https://ai-powered.com/mcp/advanced-gitlab-mcp-server): Advanced GitLab MCP server is an open-source MCP server for developer tools.
- [Carbon Forge](https://ai-powered.com/mcp/carbon-forge): Carbon Forge is a freemium MCP server for developer tools.
- [MewCP](https://ai-powered.com/mcp/mewcp): MewCP is a freemium MCP server for developer tools.
- [MCPProxy](https://ai-powered.com/mcp/mcpproxy): MCPProxy is an open-source MCP server for developer tools.

---
Source: https://ai-powered.com/mcp/git-mcp
