MCP Server Official reference

Git

An MCP server that lets LLMs read, search and manipulate Git repositories through tools like status, diff, log, commit, add, branch and checkout.

  • 91.1k GitHub stars
pip install mcp-server-git
Git preview image

What it is

mcp-server-git is a Model Context Protocol server for Git repository interaction and automation. It exposes 12 tools that let Large Language Models read, search and manipulate Git repositories. The README notes it is in early development, so its functionality and tools are subject to change and expansion.

Who it's for

  • Developers who want an LLM client such as Claude Desktop, VS Code, Zed or Zencoder to inspect and modify Git repositories
  • Developers who want to automate Git operations like staging, committing and branching through an MCP-enabled assistant
  • Contributors who want to debug or extend an MCP server using the MCP inspector

Requirements

Requirements

  • MCP Python SDK 1.x (mcp>=1.29.0,<2); SDK 2.0 renamed APIs this server uses and the port to v2 is in progress
  • uv/uvx (recommended), or pip, or Docker to run the server
  • An MCP-capable client such as Claude Desktop, VS Code, Zed or Zencoder

Setup

  1. Run with uvx (recommended)

    When using uv no specific installation is needed; uvx runs mcp-server-git directly. Add this to your claude_desktop_config.json for Claude Desktop.

    json
    "mcpServers": {
      "git": {
        "command": "uvx",
        "args": ["mcp-server-git", "--repository", "path/to/git/repo"]
      }
    }
  2. Install via pip

    Alternatively, install the package with pip.

    bash
    pip install mcp-server-git
  3. Run the pip-installed server as a script

    After installing with pip, run it as a module.

    bash
    python -m mcp_server_git
  4. Run with Docker (Claude Desktop)

    Replace '/Users/username' with a path that you want to be accessible by this tool.

    json
    "mcpServers": {
      "git": {
        "command": "docker",
        "args": ["run", "--rm", "-i", "--mount", "type=bind,src=/Users/username,dst=/Users/username", "mcp/git"]
      }
    }
  5. Configure for VS Code (uvx)

    Add to your user mcp.json (via MCP: Open User Configuration) or to .vscode/mcp.json in your workspace.

    json
    {
      "servers": {
        "git": {
          "command": "uvx",
          "args": ["mcp-server-git"]
        }
      }
    }
  6. Build the Docker image

    Build the image locally from the repository.

    bash
    cd src/git
    docker build -t mcp/git .

Examples

Debug with the MCP inspector (uvx)

bash
bash
npx @modelcontextprotocol/inspector uvx mcp-server-git

What it does: Launches the MCP inspector against a uvx installation to test and debug the server.

Debug a local development checkout

bash
bash
cd path/to/servers/src/git
npx @modelcontextprotocol/inspector uv run mcp-server-git

What it does: Runs the inspector against the package in a specific directory when developing on it.

Check server logs

bash
bash
tail -n 20 -f ~/Library/Logs/Claude/mcp*.log

What it does: Shows logs from the server, which may help debug issues when used with Claude Desktop.

Filter commit history by date

Prompt
prompt
Use git_log on path/to/git/repo with max_count 10 and start_timestamp '2 weeks ago' to show recent commits.

Expected output: git_log accepts max_count and start_timestamp/end_timestamp, which can be ISO 8601, relative (e.g. '2 weeks ago', 'yesterday') or absolute dates.

Pros & cons

Pros

  • Pro:Covers a full basic Git workflow: status, diffs, add, reset, commit, log, show, branch listing, branch creation and checkout
  • Pro:git_log supports date filtering with ISO 8601, relative and absolute date formats
  • Pro:Multiple run options (uvx, pip, Docker) with documented configs for Claude Desktop, VS Code, Zed and Zencoder
  • Pro:MIT licensed, with MCP inspector support for debugging

Cons

  • Con:Described as in early development; functionality and tools are subject to change
  • Con:Requires MCP Python SDK 1.x (mcp>=1.29.0,<2); the port to SDK 2.0 is still in progress
  • Con:The tool list documents no push, pull or merge operations

Images