🔌

Git MCP

DevTools1,500

Read, search, and manipulate Git repositories directly from AI agents.

Claude DesktopCursorWindsurf

Overview

Read, search, and manipulate Git repositories directly from AI agents.

Setup

Run with npx:

uvx mcp-server-git

Configuration

Added to claude_desktop_config.json

Documentation

Git MCP Server

Overview

The Git MCP Server provides AI agents with powerful tools to read, search, and manipulate Git repositories directly from within their workflow. It transforms the Git command line into a set of structured tools that agents can use to understand codebases, analyze commit history, and perform repository operations.

This is particularly valuable for AI coding assistants that need to understand the context of a project, trace the origin of a bug, or plan changes based on the existing code structure.

Features

  • Repository Navigation: Read file contents, list directories, and explore repository structure.
  • Commit History Analysis: Search commits by author, date, message, or file path.
  • Diff Inspection: View changes between commits, branches, or the working directory.
  • Branch Management: List branches, switch branches, and understand the branching topology.
  • Status Monitoring: Check the current state of the working directory and staging area.

Installation

# Install via uvx (recommended)
uvx mcp-server-git

# Or via pip
pip install mcp-server-git

Configuration

To use the Git MCP server, add it to your claude_desktop_config.json:

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

Available Tools

ToolDescription
git_statusCheck the current status of the repository (untracked, modified, staged files).
git_diffView changes between commits, branches, or the working directory.
git_logSearch commit history with filters for author, date, message, or file.
git_branchList branches and understand the branching topology.
git_read_fileRead the contents of a file at a specific commit or branch.

Usage Examples

Understanding a Codebase

The agent can use git_log to trace when a particular function was introduced, git_diff to understand how it has evolved, and git_read_file to inspect the current implementation.

Planning a Refactor

The agent can use git_status to understand the current state, git_branch to understand the branching strategy, and git_diff to review recent changes before proposing a refactor.

Pros

  • Deep Codebase Context: Gives agents a complete picture of the project history and structure.
  • Non-Destructive: Most operations are read-only by default, making it safe to use.
  • Powerful Search: Can find the exact commit that introduced a bug or feature.

Cons

  • Repository-Specific: Only works within a Git repository.
  • Complex Operations: Some Git operations (like interactive rebase) are not well-suited for AI agents.

Resources