Git MCP Server: Setup, Tools, and Real Use Cases (2026)

Complete guide to git MCP servers. Covers the official modelcontextprotocol git server, GitHub's MCP server (27.7k stars), GitMCP, setup commands for Claude Code and Claude Desktop, and which server fits which workflow.

March 10, 2026 ยท 3 min read

A git MCP server gives your AI assistant direct access to your repository: reading diffs, creating branches, committing changes, and inspecting history without you pasting code into a chat. Three implementations cover the main use cases. This guide covers all three, with exact setup commands for Claude Code and Claude Desktop.

What Is a Git MCP Server

The Model Context Protocol (MCP), released by Anthropic and now hosted under the Linux Foundation, is an open standard for connecting AI tools to external systems. An MCP server exposes a set of tools that an AI client (Claude Code, Claude Desktop, Cursor, VS Code) can call during a conversation.

A git MCP server exposes git operations as those tools. When you ask Claude Code to "review the changes in this branch," it can call git_diff directly rather than relying on you to paste the output. When you ask it to commit staged changes, it calls git_commit with a generated message.

The practical result: your AI assistant operates on your actual working tree, with full context of what changed, who changed it, and when. It does not hallucinate file contents from stale training data. It reads the repository.

27.7k
Stars on GitHub official MCP server
12
Tools in the official git server
7.7k
Stars on GitMCP (zero-setup option)
51+
Tools in GitHub remote MCP endpoint

MCP is not a GitHub-only protocol

Git MCP servers work with any git repository: GitLab, Bitbucket, self-hosted Gitea, or a local bare repo. The local modelcontextprotocol git server reads from the filesystem, not from any remote API. The GitHub-specific server adds platform features (issues, PRs, Actions) on top.

The Three Main Implementations

Three servers cover the practical use cases for git and AI. Understanding what each one does prevents the common mistake of configuring the wrong one for the job.

mcp-server-git (official)

Local git operations. Reads and writes your working tree via git commands. Works with any git repo, any hosting platform. Install via pip or uvx. 12 tools covering status, diff, log, commit, branch, add, reset, show, and checkout.

github-mcp-server (official)

GitHub platform operations. Talks to the GitHub API for issues, pull requests, Actions workflows, Dependabot alerts, and code search. Remote mode requires Copilot. Local Docker mode works with a PAT. 51+ tools. 27.7k stars.

GitMCP

Zero-setup documentation access. Swap github.com to gitmcp.io in any URL and get a read-only MCP server for that repo. No token, no installation. Reads README, llms.txt, and code to reduce hallucinations when using a library. 7.7k stars.

Official modelcontextprotocol Git Server

The mcp-server-git package is part of the modelcontextprotocol/servers repository. It is written in Python and provides 12 tools for local git operations.

Available tools

Read operations

git_status (working tree status), git_diff_unstaged (uncommitted changes), git_diff_staged (staged changes), git_diff (compare branches or commits), git_log (commit history with ISO 8601 date filtering), git_show (commit contents), git_branch (list local, remote, or all branches)

Write operations

git_add (stage file contents), git_reset (unstage all changes), git_commit (record changes to repository), git_create_branch (generate new branch), git_checkout (switch between branches)

Installation

Install via pip or run directly with uvx. The uvx approach requires no separate installation step.

Install and run

# Using uvx (no installation needed)
uvx mcp-server-git --repository /path/to/your/repo

# Using pip
pip install mcp-server-git
python -m mcp_server_git --repository /path/to/your/repo

# Using Docker (mounts local filesystem)
docker run --rm -i \
  --mount type=bind,src=/Users/username,dst=/Users/username \
  mcp/git

Optional --repository flag

The --repository argument is optional. If you omit it, the server accepts a repository path as a parameter on each tool call, letting one server instance operate across multiple repos.

GitHub Official MCP Server

github/github-mcp-server is GitHub's official implementation, written in Go, with 27.7k GitHub stars. It talks to the GitHub API rather than your local filesystem.

Tool categories

Tools are organized into toolsets you can enable selectively to avoid overwhelming the AI with irrelevant capabilities.

repos

Browse code, search files, analyze commits, stream file contents, understand project structure across any repository you have access to.

issues + pull_requests

Create, update, triage, label, and merge issues and PRs. Let AI review code changes, resolve merge conflicts, and maintain project boards.

actions

Monitor workflow runs, analyze build failures, manage releases, retrieve CI/CD logs, and get visibility into your deployment pipeline.

code_security

Examine Dependabot alerts, review security findings, detect vulnerabilities, and convert security alerts into tracked issues programmatically.

discussions

Read and write team discussions, manage comments, and surface relevant community conversations alongside code context.

projects

List, retrieve, and write to GitHub Projects. Unified access to project management with automatic owner type detection (user or organization).

Remote setup (recommended)

The remote server at api.githubcopilot.com/mcp/ requires a GitHub Copilot seat. No local installation needed.

Remote GitHub MCP server configuration

{
  "servers": {
    "github": {
      "type": "http",
      "url": "https://api.githubcopilot.com/mcp/"
    }
  }
}

Local Docker setup

For teams without Copilot, the Docker image works with a Personal Access Token.

Local Docker setup

# Pull and run the Docker image
docker run -i --rm \
  -e GITHUB_PERSONAL_ACCESS_TOKEN=ghp_your_token_here \
  ghcr.io/github/github-mcp-server

# Read-only mode (no write operations)
# Add X-MCP-Readonly: true header in your client config

OAuth scope filtering

When using a classic Personal Access Token, the server automatically detects your token's OAuth scopes and hides tools you do not have permission to use. If your token lacks the repo scope, write tools disappear from the available tool list.

GitMCP: Zero-Setup Documentation Access

GitMCP (7.7k stars) converts any GitHub repository into a remote MCP server with no setup. Change github.com to gitmcp.io in the URL.

URL formats

GitMCP URL conversion

# Specific repository
# Before: https://github.com/facebook/react
# MCP URL: https://gitmcp.io/facebook/react

# GitHub Pages site
# Before: https://facebook.github.io/react
# MCP URL: https://facebook.gitmcp.io/react

# Generic server (AI picks the repo from context)
# URL: https://gitmcp.io/docs

How it works

GitMCP reads llms.txt, llms-full.txt, README.md, and relevant code files from the repository. It implements semantic search to find the most relevant content for each AI query. The AI gets accurate, up-to-date documentation rather than stale training data.

Claude Desktop config for GitMCP (React docs)

{
  "mcpServers": {
    "react-docs": {
      "command": "npx",
      "args": [
        "-y",
        "@smithery/cli@latest",
        "run",
        "@idosal/git-mcp",
        "--config",
        "{}"
      ]
    }
  }
}

GitMCP vs GitHub MCP server

GitMCP is read-only and focused on documentation and code retrieval. It does not create issues, open PRs, or trigger Actions. Use it when you want the AI to understand a library accurately. Use the GitHub MCP server when you want the AI to interact with the GitHub platform.

Setup for Claude Code

Claude Code supports three configuration scopes. Local scope is session-only. Project scope uses a .mcp.json file in the repo root. User scope uses ~/.claude.json for cross-project access.

Local git server via CLI

Add mcp-server-git to Claude Code

# Add with user scope (available in all projects)
claude mcp add git --scope user -- uvx mcp-server-git

# Add with project scope (committed with repo)
claude mcp add git -- uvx mcp-server-git --repository /path/to/repo

# Verify
claude mcp list

# Test inside Claude Code
/mcp

Project-scoped .mcp.json

Commit .mcp.json to the project root so your whole team shares the configuration automatically.

.mcp.json for local git server

{
  "mcpServers": {
    "git": {
      "command": "uvx",
      "args": ["mcp-server-git", "--repository", "."]
    }
  }
}

GitHub MCP server via CLI

Add GitHub MCP server to Claude Code

# Remote server (requires GitHub Copilot)
claude mcp add github --scope user \
  -e GITHUB_TOKEN=ghp_your_token_here \
  -- npx -y @modelcontextprotocol/server-github

# Or add manually to ~/.claude.json:
# {
#   "mcpServers": {
#     "github": {
#       "type": "http",
#       "url": "https://api.githubcopilot.com/mcp/"
#     }
#   }
# }

Setup for Claude Desktop

Claude Desktop reads MCP configuration from claude_desktop_config.json. On macOS: ~/Library/Application Support/Claude/claude_desktop_config.json. On Windows: %APPDATA%\Claude\claude_desktop_config.json.

claude_desktop_config.json with git server (uvx)

{
  "mcpServers": {
    "git": {
      "command": "uvx",
      "args": [
        "mcp-server-git",
        "--repository",
        "/Users/username/projects/my-repo"
      ]
    }
  }
}

claude_desktop_config.json with git server (Docker)

{
  "mcpServers": {
    "git": {
      "command": "docker",
      "args": [
        "run",
        "--rm",
        "-i",
        "--mount",
        "type=bind,src=/Users/username,dst=/Users/username",
        "mcp/git"
      ]
    }
  }
}

claude_desktop_config.json with GitHub server

{
  "mcpServers": {
    "github": {
      "command": "npx",
      "args": ["-y", "@modelcontextprotocol/server-github@latest"],
      "env": {
        "GITHUB_PERSONAL_ACCESS_TOKEN": "ghp_your_token_here"
      }
    }
  }
}

Restart required after config changes

Claude Desktop does not hot-reload MCP configuration. Fully quit and restart the application after editing claude_desktop_config.json. This catches everyone at least once.

Comparison: Which Server to Use

The servers are not mutually exclusive. Most teams run the local git server and the GitHub server in parallel, using each for what it does best.

mcp-server-gitgithub-mcp-serverGitMCP
StarsPart of 10k+ stars repo27.7k7.7k
ScopeLocal git operationsGitHub platform APIRead-only docs access
Write operationsYes (commit, branch, stage)Yes (issues, PRs, releases)No
Requires tokenNoYes (PAT or Copilot)No
Hosting platformAny git repoGitHub onlyGitHub only
Setup time~2 min~5 min (local), ~1 min (remote)~30 sec
LanguagePythonGoTypeScript
TransportSTDIOSTDIO + HTTP (remote)HTTP (remote only)
Best forWorking-tree operations in any repoGitHub platform automationLibrary documentation accuracy

A practical rule: if the operation involves your local working tree (staging, diffing, committing), use mcp-server-git. If it involves GitHub objects (issues, PRs, Actions), use the GitHub server. If you want the AI to stop hallucinating about a library's API surface, use GitMCP.

Real Use Cases

Git MCP servers change what AI assistants can do in practice. These are the workflows teams use most.

AI-assisted code review

With the local git server connected, Claude can call git_diff to read the exact changes in your branch, then review them in context. No copy-pasting. The AI sees what actually changed, including surrounding code.

Code review prompt with git MCP

Review the staged changes in this repository.
Look for:
- Logic errors and edge cases
- Security issues (SQL injection, XSS, auth bypasses)
- Missing error handling
- Test coverage gaps

Use git_diff_staged to read the changes first.

Automated PR creation

Pair the local git server with the GitHub server. The AI creates a branch via git_create_branch, makes changes, stages with git_add, commits with git_commit, then opens a PR through the GitHub MCP tools. End to end in one conversation.

Debugging with history context

When diagnosing a regression, the AI calls git_log to find relevant commits, then git_show on each one to read the actual changes. It builds a change timeline without you running a single git command.

Multi-agent pipelines

In multi-agent architectures, each subagent can have the git server available. One agent implements a feature, commits it, and reports back. Another agent reviews the commit via git_diff before the lead merges it. The git server is the shared state layer.

Documentation-accurate library usage

Connect GitMCP for the libraries you use most. When Claude writes code using that library, it reads the current documentation rather than relying on training data that may be 1-2 versions behind. GitMCP's semantic search surfaces the right docs for each query.

Code review

AI reads git_diff_staged directly, reviews actual changes in context, flags issues with file and line references. No copy-pasting required.

Automated PR workflow

Create branch, implement changes, commit via local git server, open PR and assign reviewers via GitHub server. Full cycle in one conversation.

Regression debugging

AI calls git_log to find relevant commits, git_show on each one to read changes, builds a cause timeline from commit history alone.

Dependabot triage

GitHub MCP server lists Dependabot alerts, creates issues for the ones above a severity threshold, and assigns them to the relevant team. Automated weekly triage.

Frequently Asked Questions

What is a git MCP server?

A git MCP server is a Model Context Protocol server that gives AI assistants direct access to git repository operations. The AI can call git_status, git_diff, git_commit, and similar tools inside your actual repository. Three main implementations exist: mcp-server-git for local operations, github-mcp-server for GitHub platform access, and GitMCP for zero-setup documentation retrieval.

What tools does mcp-server-git provide?

Twelve tools: git_status, git_diff_unstaged, git_diff_staged, git_diff, git_commit, git_add, git_reset, git_log, git_create_branch, git_checkout, git_show, and git_branch. The log tool supports ISO 8601 and relative date formats for filtering commits by time range.

How do I add the git MCP server to Claude Code?

Run claude mcp add git --scope user -- uvx mcp-server-git for user-scoped access across all projects. For project-scoped setup, create a .mcp.json file in the repo root and commit it. Verify with claude mcp list and check status inside Claude Code with /mcp.

What is the difference between the git server and the GitHub server?

The local git server reads and writes your working tree via git commands. It works with any hosting platform. The GitHub server talks to the GitHub API and handles platform objects: issues, pull requests, Actions workflows, and security alerts. Most teams run both. Working-tree operations go to the git server; platform operations go to the GitHub server.

Does the GitHub MCP server require a paid GitHub account?

The remote server at api.githubcopilot.com/mcp/ requires a GitHub Copilot seat. The local Docker image works with a standard Personal Access Token. The npm package @modelcontextprotocol/server-github is a community implementation that also accepts a PAT.

What is GitMCP and when should I use it?

GitMCP converts any GitHub repo into a read-only remote MCP server by changing github.com to gitmcp.io in the URL. It needs no token or installation. Use it when you want the AI to stop hallucinating about a library's API by giving it access to the current documentation. It does not support write operations.

Can I configure multiple git MCP servers in Claude Code?

Yes. Give each server a unique name in your configuration. For example, git-frontend pointing to your frontend repo and git-backend pointing to your backend repo. Claude Code lists all configured servers with claude mcp list and shows their status with /mcp inside a session.

Which Claude Code configuration scope should I use?

Use project scope (.mcp.json) for repo-specific git servers that your team shares via version control. Use user scope (~/.claude.json) for your personal GitHub token configuration that applies across all projects. Use local scope for temporary servers you do not want committed.

Git MCP Servers Generate Code Edits. Apply Them Reliably.

When AI agents commit code through a git MCP server, each edit needs to land cleanly. Morph's Fast Apply model merges LLM-generated code changes at 10,500+ tokens per second with deterministic accuracy. The reliability layer your agent pipeline needs.