Git MCP server
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.
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.
# 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.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.
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.
Shows the working tree status for a given repository path.
Shows changes in the working directory that have not been staged.
Shows changes that are staged for commit.
Shows differences between the current state and a target branch or commit.
Records changes to the repository with a commit message.
Adds file contents to the staging area with support for batch operations.
Unstages all staged changes in the repository.
Shows the commit logs with advanced filtering and formatting.
Creates a new branch from a base branch.
Switches to a specified branch.
Shows the contents of a specific commit revision.
Initializes a new Git repository.
Retrieves the status of an Azure DevOps build/pipeline run.
Retrieves logs from an Azure DevOps build.
Provides details about failing jobs in an Azure DevOps build.
Lists builds for an Azure DevOps project with filtering options.