Skip to content

MCP server

Git MCP server

The MCP project's Git reference server lets AI read history and diffs and stage, commit and switch branches in a local repository.

At a glance

Maintained by
Model Context Protocol project (Anthropic reference servers)
Tools exposed
10 listed below
Reviewed
September 24, 2026

Why it matters

What it does and why it matters

The Git server works on a repository on your own machine, without any hosting service. An assistant can check status, read staged and unstaged diffs, read the log, show a commit and, when asked, stage files, commit, create branches and switch between them.

It is useful for writing clear commit messages from real diffs, understanding what changed between two points and keeping a coding assistant aware of the working state.

This is a reference server from the Model Context Protocol project. Reference servers show how the protocol works and are useful for learning and prototypes. Check the project notes before relying on one in production. It can change the local repository, including commits and branch switches, so keep it pointed at the repository you are working in and review commits before pushing.

Use cases

Best business use cases

Commit messages

Write clear commit messages from the actual diff.

History questions

Ask what changed in a file and why.

Diff reviews

Summarize staged changes before committing.

Branch work

Create and switch branches for a task.

Learning Git

Explain what each command did.

Tools

Available tools

Tool names as published by the maintainer at review time. Versions change, so check the repository for the current list.

Read and write: Read and write: reads history and diffs, and can stage, commit, reset and switch branches in a local repo.

  • git_status

    Show the working tree status.

  • git_diff_unstaged

    Show changes not yet staged.

  • git_diff_staged

    Show changes staged for commit.

  • git_diff

    Show differences between branches or commits.

  • git_commit

    Record changes to the repository.

  • git_add

    Add file contents to the staging area.

  • git_log

    Show commit logs with optional date filters.

  • git_create_branch

    Create a new branch.

  • git_checkout

    Switch branches.

  • git_show

    Show the contents of a commit.

Workflows

Example workflows

Commit with a clear message

  1. 1

    Finish a change.

  2. 2

    Ask the assistant to read the staged diff.

  3. 3

    It drafts a commit message.

  4. 4

    You edit and approve it.

  5. 5

    It commits.

Understand a file's history

  1. 1

    Ask about a file.

  2. 2

    The assistant reads the log for it.

  3. 3

    It shows key commits.

  4. 4

    It explains how the file evolved.

  5. 5

    You find the change you were looking for.

Prompts

Example prompts

  • “Read my staged changes and write a commit message.”

  • “What changed in src/billing.php over the last ten commits?”

  • “Create a branch called fix/invoice-rounding and switch to it.”

Setup

Installation and configuration

Examples for Claude Desktop and Claude Code. Replace the placeholder values with your own keys, and store secrets outside version control.

Claude Desktop: claude_desktop_config.json

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

Claude Code: terminal

claude mcp add git -- uvx mcp-server-git --repository path/to/git/repo
  • Local server: stdio; mcp-server-git; uvx mcp-server-git; mcp/git.

Security

Security considerations

  • One repository

    Point it at a single repository.

  • Review commits

    Check commits before pushing.

  • Reference server

    Treat it as a reference implementation.

  • No secrets in commits

    Watch for secrets before committing.

Related servers

Servers that pair well with it

GitHub

GitHub's official MCP server lets AI read repositories, search code, manage issues and pull requests and, when allowed, change files.

Filesystem

The MCP project's Filesystem reference server lets AI read, write, edit, move and search files, only inside folders you allow.

GitLab

GitLab's built-in MCP server lets AI read projects, code, merge requests and pipelines and create commits and work items. In beta.

Keep exploring

FAQ

Questions people ask us

Have a question that is not here? Ask us directly.

Start a project

Want this connected to your own systems? We build AI workflows with MCP.

Send a short brief. We reply with questions, a suggested plan and an estimate you can compare with other offers.

Your privacy choices

We use necessary storage to run this site. With your permission we also use Google Analytics to see which pages help people, and load maps from Google. You can change this at any time. Read the cookie policy.