home / mcp / git mcp server

Git MCP Server

Git MCP server

Installation
Add the following to your MCP client configuration file.

Configuration

View docs
{
  "mcpServers": {
    "mementorc-mcp-git": {
      "command": "uvx",
      "args": [
        "mcp-server-git",
        "--repository",
        "path/to/git/repo"
      ],
      "env": {
        "GITHUB_TOKEN": "ghp_abcdefghijklmnopqrstuvwxyz",
        "AZURE_DEVOPS_ORG": "YOUR_ORG",
        "AZURE_DEVOPS_TOKEN": "YOUR_AZURE_DEVOPS_TOKEN"
      }
    }
  }
}

You can use the MCP Git server to read, search, and manipulate Git repositories through a Model Context Protocol client. It exposes a set of tools that let you check status, view diffs, commit changes, manage branches, and inspect commit contents, all from a consistent MCP interface. This makes it easier to automate repository workflows, perform code analysis, and integrate Git operations into larger AI-assisted workflows.

How to use

To work with the MCP Git server, connect your MCP client to one of the available local (stdio) or remote (http) endpoints that are described in the MCP configuration options. You can run the server locally and interact with it through your client by starting the server in one of the supported ways and then issuing the standard MCP calls to perform Git operations such as checking status, viewing diffs, staging files, creating branches, and inspecting commits.

How to install

# Prerequisites
- Python 3.8+ (or the runtime specified by your environment)
- Access to a Git repository you want to manage

# Method A: Install via pip (development-friendly)
pip install mcp-server-git

# Run the server directly (example)
python -m mcp_server_git
```

If you prefer developers workflows or using a package manager that fits your setup, you can choose from the following MCP server configurations that are demonstrated in various usage scenarios. Use one configuration per runtime environment and start the server accordingly.

Configuration and usage notes

Environment variables are supported and can be loaded from .env files to customize authentication, API endpoints, and log levels. The server loads variables from several locations with a defined precedence, including .env files in your project, the repository directory, ClaudeCode workspace, and system environment variables. For example, you can provide a GitHub access token and optional API base URL via a .env file in your project directory.

Notes on development and debugging

During development or troubleshooting, you can inspect server logs to diagnose issues. If you run the server in a development environment, you may find logs under typical user log directories or as configured by your environment. Use the MCP inspector tooling to test changes and validate responses from the server.

Available tools

git_status

Shows the working tree status for a given repository path.

git_diff_unstaged

Shows changes in the working directory that have not been staged.

git_diff_staged

Shows changes that are staged for commit.

git_diff

Shows differences between the current state and a target branch or commit.

git_commit

Records changes to the repository with a commit message.

git_add

Adds file contents to the staging area with support for batch operations.

git_reset

Unstages all staged changes in the repository.

git_log

Shows the commit logs with advanced filtering and formatting.

git_create_branch

Creates a new branch from a base branch.

git_checkout

Switches to a specified branch.

git_show

Shows the contents of a specific commit revision.

git_init

Initializes a new Git repository.

azure_get_build_status

Retrieves the status of an Azure DevOps build/pipeline run.

azure_get_build_logs

Retrieves logs from an Azure DevOps build.

azure_get_failing_jobs

Provides details about failing jobs in an Azure DevOps build.

azure_list_builds

Lists builds for an Azure DevOps project with filtering options.