MCP Git Server
One-line summary: An MCP server that lets an LLM read, search, and modify Git repositories, inspect GitHub pull requests and CI results, and (per README) monitor Azure Pipelines builds.
Inspect repo state:
git_status,git_diff_unstaged,git_diff_staged,git_diff(vs branch/commit),git_show,git_log(with filtering/formatting, per README).Stage, unstage, and commit:
git_add,git_reset,git_commit(with GPG signing viagpg_sign/gpg_key_id).Branches and history:
git_create_branch(optional base),git_checkout,git_diff_branches,git_init.Remote sync:
git_push(remote, branch, force, set_upstream),git_pull.GitHub PR/CI triage:
github_list_pull_requests,github_get_pr_details,github_get_pr_files,github_get_pr_status,github_get_pr_checks,github_get_failing_jobs,github_get_workflow_run.CI debugging: pull logs and annotations from failing checks/jobs and workflow runs.
Azure DevOps (README): build status, build logs, and detailed failing-job info for pipelines.
Context-lean mode (README):
discover_tools,get_tool_spec,execute_toolto access all 64 tools with ~97% less context.Repo binding (README):
--repositorybinds a repo sorepo_path: "."works; absolute paths for others.Identity/config (README): env-file config (
GITHUB_TOKEN,AZURE_DEVOPS_TOKEN/ORG) and per-repo GitHub identities for commits, pushes, and API calls.
Provides tools for Git repository interaction and automation, including viewing repository status, managing changes through staging and committing, checking repository history, creating and switching branches, and initializing new repositories.
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@MCP Git Server show me the recent commits in the current repo"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
mcp-server-git: A git MCP server
Overview
A Model Context Protocol server for Git repository interaction and automation. This server provides tools to read, search, and manipulate Git repositories via Large Language Models.
Please note that mcp-server-git is currently in early development. The functionality and available tools are subject to change and expansion as we continue to develop and improve the server.
Tools
git_statusShows the working tree status
Input:
repo_path(string): Path to Git repository
Returns: Current status of working directory as text output
git_diff_unstagedShows changes in working directory not yet staged
Input:
repo_path(string): Path to Git repository
Returns: Diff output of unstaged changes
git_diff_stagedShows changes that are staged for commit
Input:
repo_path(string): Path to Git repository
Returns: Diff output of staged changes
git_diffShows differences between branches or commits
Inputs:
repo_path(string): Path to Git repositorytarget(string): Target branch or commit to compare with
Returns: Diff output comparing current state with target
git_commitRecords changes to the repository
Inputs:
repo_path(string): Path to Git repositorymessage(string): Commit message
Returns: Confirmation with new commit hash
git_addAdds file contents to the staging area with support for batch operations
Inputs:
repo_path(string): Path to Git repositoryfiles(string[], optional): Array of file paths to stage (use["."]to stage everything)update_only(boolean, optional): Stage only tracked file updates and deletions (git add -u)patterns(string[], optional): Array of glob patterns to match files (e.g., [".py", "src/**/.js"])
Returns: Confirmation of staged files
Note: Only one of files, update_only, or patterns should be specified
git_resetUnstages all staged changes
Input:
repo_path(string): Path to Git repository
Returns: Confirmation of reset operation
git_logShows the commit logs with advanced filtering and formatting
Inputs:
repo_path(string): Path to Git repositorymax_count(number, optional): Maximum number of commits to show (default: 10)oneline(boolean, optional): Compact format showing hash and message only (default: false)graph(boolean, optional): Show merge graph structure (default: false)format(string, optional): Custom format string (e.g., "%h - %s (%an)")since(string, optional): Show commits after date (e.g., "2024-01-01", "1 week ago")until(string, optional): Show commits before date (e.g., "yesterday", "2024-12-31")author(string, optional): Filter by author name or emailgrep(string, optional): Search commit messages with regex patternfiles(string[], optional): Show only commits affecting these filesbranch(string, optional): Show log for specific branch (default: current)reverse(boolean, optional): Show commits in reverse chronological order (default: false)merges(boolean, optional): Filter merge commits (null=all, true=only merges, false=no merges)
Returns: Formatted commit log matching specified criteria
Examples:
Find recent fix commits:
{repo_path: ".", max_count: 20, grep: "fix:", oneline: true}Changes by author:
{repo_path: ".", author: "john@example.com", since: "1 month ago"}File history:
{repo_path: ".", files: ["src/main.py"], max_count: 50}
git_create_branchCreates a new branch
Inputs:
repo_path(string): Path to Git repositorybranch_name(string): Name of the new branchbase_branch(string, optional): Starting point for the new branch
Returns: Confirmation of branch creation
git_checkout
Switches branches
Inputs:
repo_path(string): Path to Git repositorybranch_name(string): Name of branch to checkout
Returns: Confirmation of branch switch
git_show
Shows the contents of a commit
Inputs:
repo_path(string): Path to Git repositoryrevision(string): The revision (commit hash, branch name, tag) to show
Returns: Contents of the specified commit
git_init
Initializes a Git repository
Inputs:
repo_path(string): Path to directory to initialize git repo
Returns: Confirmation of repository initialization
Azure DevOps Integration
The server provides Azure DevOps integration for monitoring and analyzing Azure Pipelines builds:
azure_get_build_statusGet status of an Azure DevOps build/pipeline run
Inputs:
project(string): The project name or IDbuild_id(integer): The build ID
Returns: Formatted build status information including definition, status, result, branch, and timing
azure_get_build_logsGet logs from an Azure DevOps build
Inputs:
project(string): The project name or IDbuild_id(integer): The build IDlog_id(integer, optional): Specific log ID to retrieve. If omitted, lists all logs
Returns: Log content or list of available logs
azure_get_failing_jobsGet detailed information about failing jobs in an Azure DevOps build
Inputs:
project(string): The project name or IDbuild_id(integer): The build IDinclude_logs(boolean, optional): Whether to include log excerpts (default: true)
Returns: Detailed failure information including error messages and log excerpts
Configuration: Azure DevOps integration requires setting AZURE_DEVOPS_TOKEN and AZURE_DEVOPS_ORG environment variables. See the Environment Variables section for details.
Lean MCP Interface (Context-Optimized)
The server provides an alternative lean interface that reduces context consumption by ~97% (from ~30k tokens to ~900 tokens). Instead of exposing all 64 tools upfront, it uses a 3-meta-tool pattern:
Meta-Tool | Purpose |
| List available tools with optional filtering |
| Get full schema for a specific tool on-demand |
| Execute any tool dynamically |
Tool Coverage: All 64 tools remain accessible (27 git, 34 GitHub, 3 Azure DevOps).
Usage Example:
# 1. Discover available tools (optional filtering)
discover_tools("pr") # Returns 11 PR-related tools
# 2. Get schema when needed
get_tool_spec("github_create_pr") # Returns full parameter schema
# 3. Execute the tool
execute_tool("github_create_pr", {
"repo_owner": "owner",
"repo_name": "repo",
"title": "feat: new feature",
"head": "feature-branch",
"base": "main"
})Configuration: Use the mcp-git-lean entry point:
"mcpServers": {
"git-lean": {
"command": "pixi",
"args": ["run", "-m", "mcp-git-lean", "--repository", "path/to/repo"]
}
}Important: Repository Path Resolution
The repo_path parameter in all git tools supports the following behaviors:
Absolute paths: Always used directly (e.g.,
/home/user/my-repo)"." (current directory): Resolves to the bound repository when the server is started with the
--repositoryparameter. If no repository is bound, the operation will fail with a clear error message.Relative paths: Converted to absolute paths relative to the current working directory. For best reliability, use absolute paths or bind a repository with
--repository.
Recommended Usage:
When starting the server, use the
--repositoryparameter to bind to a specific repositoryIn tool calls, use
repo_path: "."to reference the bound repositoryFor operations on different repositories, provide absolute paths
Example:
# Start server bound to a repository
mcp-server-git --repository /path/to/my-repo
# Then use "." in tool calls to reference the bound repository
# This prevents cross-repository contaminationRelated MCP server: git-mcp-server
Installation
Using uv (recommended)
When using uv no specific installation is needed. We will
use uvx to directly run mcp-server-git.
Using PIP
Alternatively you can install mcp-server-git via pip:
pip install mcp-server-gitNote: For development, use pixi install instead of pip for proper dependency management.
After installation, you can run it as a script using:
python -m mcp_server_gitConfiguration
Environment Variables
The server supports loading environment variables from .env files with the following precedence order:
Project-specific .env file -
.envfile in the current working directoryRepository-specific .env file -
.envfile in the repository directory (when using--repositoryargument)ClaudeCode working directory .env file -
.envfile in ClaudeCode workspace root (automatically detected)System environment variables - Standard environment variables
Example .env file
Create a .env file in your project directory or ClaudeCode workspace:
# GitHub API Token for GitHub integration features
# Get your token from: https://github.com/settings/tokens
GITHUB_TOKEN=your_github_token_here
# Optional: Custom GitHub API base URL (for GitHub Enterprise)
# GITHUB_API_BASE_URL=https://api.github.com
# Azure DevOps Configuration
# Get your Personal Access Token from: https://dev.azure.com/{organization}/_usersSettings/tokens
# The token should have 'Build (Read)' scope at minimum
AZURE_DEVOPS_TOKEN=your_azure_devops_pat_token_here
AZURE_DEVOPS_ORG=your_organization_name
# Optional: Log level for debugging
# LOG_LEVEL=INFONote: The .env file is loaded automatically when the server starts. The server intelligently detects ClaudeCode workspace directories by traversing up from both the current working directory and the repository path (if provided via --repository argument). If no .env files are found, the server will use system environment variables.
For ClaudeCode users: If you have your .env file in your ClaudeCode workspace root (e.g., /home/memento/ClaudeCode/.env), it will be automatically detected and loaded when running the MCP server from any subdirectory within that workspace.
Per-repo GitHub identities
Lets selected repos push, commit and call the GitHub API as a different identity (for example a bot). Every repo not listed behaves exactly as before.
Map file: $MCP_GIT_IDENTITIES, default ~/.config/mcp-git/identities.toml:
[identities.roth-bot]
env_file = "~/.config/gh/roth-bot.env"
repos = ["MementoRC/roth_planner"] # Owner/repo, case-insensitive
owners = ["roth-org"] # optional: owner logins for owner-level resourcesowners (optional, case-insensitive exact match) is the only way an identity is used for owner-level resources such as github_project_* tools. A repos entry is never promoted to owner level: an owner not listed in any owners uses the default GITHUB_TOKEN. Listing the same owner under two identities, or a non-list owners, makes the map invalid (fail closed).
Env file (read only, never loaded into the server's environment; chmod 600). GITHUB_TOKEN, GPG_SIGNING_KEY, GIT_AUTHOR_NAME and GIT_AUTHOR_EMAIL are required; the committer keys are optional and default to the author:
GITHUB_TOKEN=...
GPG_SIGNING_KEY=...
GIT_AUTHOR_NAME=...
GIT_AUTHOR_EMAIL=...
GIT_COMMITTER_NAME=...
GIT_COMMITTER_EMAIL=...Adding an identity: edit the TOML (or add an env file). The map reloads when the file's mtime changes; no restart needed. A missing map file means no identities (default behaviour).
Fail closed: a mapped repo never silently runs as the owner. A missing or unreadable env file, an env file without GITHUB_TOKEN, or (for commits) a missing signing key or author name/email produces a tool error. An invalid map file (bad TOML, env_file not a string, repos not a list of strings) makes every identity lookup, and so every push, commit and repo-scoped API call, return a tool error until the file is fixed, because the server cannot tell which repos were meant to be mapped. Error messages name the problem, never secret values.
Which identity served a call: git_commit and authenticated git_push results contain an identity: <name> line, and every identity use is logged at info level (names only, never tokens).
Precedence
Push token: identity token, then repo
.env,GITHUB_TOKEN,gh auth token. The identity follows the push URL, notorigin: a push to a fork or second remote uses the identity mapped to that URL's repo, or none.Commit signing key: explicit
gpg_key_id, then identity key, thenGPG_SIGNING_KEY, thenuser.signingkey. Author/committer come from the identity unlessauthoris passed. While an identity is active the server does not write any key or user name/email into the repo config.GitHub API tools: when
repo_owner/repo_namematch a mapped repo, the identity token is used instead ofGITHUB_TOKEN.
Limits: tag, merge, cherry-pick and rebase commits still use the default identity. A GitHub App is a possible future alternative.
Usage with Claude Desktop
Add this to your claude_desktop_config.json:
"mcpServers": {
"git": {
"command": "uvx",
"args": ["mcp-server-git", "--repository", "path/to/git/repo"]
}
}Note: replace '/Users/username' with the a path that you want to be accessible by this tool
"mcpServers": {
"git": {
"command": "docker",
"args": ["run", "--rm", "-i", "--mount", "type=bind,src=/Users/username,dst=/Users/username", "mcp/git"]
}
}"mcpServers": {
"git": {
"command": "python",
"args": ["-m", "mcp_server_git", "--repository", "path/to/git/repo"]
}
}Usage with VS Code
For quick installation, use one of the one-click install buttons below...
For manual installation, add the following JSON block to your User Settings (JSON) file in VS Code. You can do this by pressing Ctrl + Shift + P and typing Preferences: Open Settings (JSON).
Optionally, you can add it to a file called .vscode/mcp.json in your workspace. This will allow you to share the configuration with others.
Note that the
mcpkey is not needed in the.vscode/mcp.jsonfile.
{
"mcp": {
"servers": {
"git": {
"command": "uvx",
"args": ["mcp-server-git"]
}
}
}
}For Docker installation:
{
"mcp": {
"servers": {
"git": {
"command": "docker",
"args": [
"run",
"--rm",
"-i",
"--mount", "type=bind,src=${workspaceFolder},dst=/workspace",
"mcp/git"
]
}
}
}
}Usage with Zed
Add to your Zed settings.json:
"context_servers": [
"mcp-server-git": {
"command": {
"path": "uvx",
"args": ["mcp-server-git"]
}
}
],"context_servers": {
"mcp-server-git": {
"command": {
"path": "python",
"args": ["-m", "mcp_server_git"]
}
}
},Debugging
You can use the MCP inspector to debug the server. For uvx installations:
npx @modelcontextprotocol/inspector uvx mcp-server-gitOr if you've installed the package in a specific directory or are developing on it:
cd path/to/servers/src/git
npx @modelcontextprotocol/inspector uv run mcp-server-gitRunning tail -n 20 -f ~/Library/Logs/Claude/mcp*.log will show the logs from the server and may
help you debug any issues.
Development
If you are doing local development, there are two ways to test your changes:
Run the MCP inspector to test your changes. See Debugging for run instructions.
Test using the Claude desktop app. Add the following to your
claude_desktop_config.json:
Docker
{
"mcpServers": {
"git": {
"command": "docker",
"args": [
"run",
"--rm",
"-i",
"--mount", "type=bind,src=/Users/username/Desktop,dst=/projects/Desktop",
"--mount", "type=bind,src=/path/to/other/allowed/dir,dst=/projects/other/allowed/dir,ro",
"--mount", "type=bind,src=/path/to/file.txt,dst=/projects/path/to/file.txt",
"mcp/git"
]
}
}
}UVX
{
"mcpServers": {
"git": {
"command": "uv",
"args": [
"--directory",
"/<path to mcp-servers>/mcp-servers/src/git",
"run",
"mcp-server-git"
]
}
}Build
Docker build:
cd src/git
docker build -t mcp/git .License
This MCP server is licensed under the MIT License. This means you are free to use, modify, and distribute the software, subject to the terms and conditions of the MIT License. For more details, please see the LICENSE file in the project repository.
Available Tools
22 toolsgit_addC
Adds file contents to the staging area
Inputs: files (required), repo_path (required).
git_checkoutC
Switches branches
Inputs: branch_name (required), repo_path (required).
git_commitC
Records changes to the repository
Inputs: message (required), repo_path (required), gpg_key_id, gpg_sign.
git_create_branchC
Creates a new branch from an optional base branch
Inputs: branch_name (required), repo_path (required), base_branch.
git_diffC
Shows differences between branches or commits
Inputs: repo_path (required), target (required).
git_diff_branchesC
Show differences between two branches
Inputs: base_branch (required), compare_branch (required), repo_path (required).
git_diff_stagedC
Shows changes that are staged for commit
Inputs: repo_path (required).
git_diff_unstagedB
Shows changes in the working directory that are not yet staged
Inputs: repo_path (required).
github_get_failing_jobsC
Get detailed information about failing jobs in a PR
Inputs: pr_number (required), repo_name (required), repo_owner (required), include_annotations, +1 more.
github_get_pr_checksC
Get check runs for a pull request
Inputs: pr_number (required), repo_name (required), repo_owner (required), conclusion, +1 more.
github_get_pr_detailsC
Get comprehensive PR details
Inputs: pr_number (required), repo_name (required), repo_owner (required), include_files, +1 more.
github_get_pr_filesC
Get files changed in a pull request with pagination support
Inputs: pr_number (required), repo_name (required), repo_owner (required), include_patch, +2 more.
github_get_pr_statusC
Get the status and check runs for a pull request
Inputs: pr_number (required), repo_name (required), repo_owner (required).
github_get_workflow_runC
Get detailed workflow run information
Inputs: repo_name (required), repo_owner (required), run_id (required), include_logs.
github_list_pull_requestsC
List pull requests for a repository with filtering and pagination
Inputs: repo_name (required), repo_owner (required), base, direction, +5 more.
git_initC
Initialize a new Git repository
Inputs: repo_path (required).
git_logC
Shows the commit logs
Inputs: repo_path (required), format, graph, max_count, +1 more.
git_pullC
Pull changes from remote repository
Inputs: repo_path (required), branch, remote.
git_pushC
Push commits to remote repository
Inputs: repo_path (required), branch, force, remote, +1 more.
git_resetC
Unstages all staged changes
Inputs: repo_path (required).
git_showC
Shows the contents of a commit
Inputs: repo_path (required), revision (required).
git_statusC
Shows the working tree status
Inputs: repo_path (required).
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 22 tools
The tools are mostly distinct, but there is significant overlap in the diff tools (git_diff, git_diff_branches, git_diff_staged, git_diff_unstaged) which could cause confusion, and the GitHub PR tools (github_get_pr_checks, github_get_pr_status) have unclear boundaries. However, descriptions help clarify some differences.
Most tools follow a consistent verb_noun pattern with prefixes (git_ or github_), but there are minor deviations like 'git_create_branch' (verb_noun_noun) and 'github_get_failing_jobs' (verb_adjective_noun) that break the pattern slightly. Overall, the naming is readable and predictable.
With 22 tools, this is borderline heavy for a Git server, as it combines core Git operations with GitHub-specific features, making it feel somewhat overloaded. The count is reasonable but could be streamlined for better focus.
The toolset covers core Git workflows (init, add, commit, push, pull, branch, diff, log) and GitHub PR/CI features well, with no major gaps. Minor gaps include missing tools for merging or rebasing, but agents can work around this using existing commands.
Maintenance
Related MCP Connectors
A comprehensive Model Context Protocol (MCP) server that enables AI assistants to interact with yo…
AI-native git hosting — repos, PRs, issues, CI gates, and AI code review over MCP (60 tools).
Code intelligence for LLMs. Analyze, search, and retrieve code from any public git repository.
Git-backed platform for skills, tools, and context for AI agents
Related MCP Servers
- AlicenseBqualityBmaintenanceA Model Context Protocol server for Git repository interaction and automation. This server provides tools to read, search, and manipulate Git repositories via Large Language Models.14115,976 PyPI92,301MIT
- AlicenseAqualityDmaintenanceA Model Context Protocol server that enables Large Language Models to interact with Git repositories through a robust API, supporting operations like repository initialization, cloning, file staging, committing, and branch management.286,847 npm246Apache 2.0
- AlicenseBqualityDmaintenanceA Model Context Protocol server that enables LLMs to interact with Git repositories, providing tools to read, search, and manipulate Git repositories through commands like status, diff, commit, and branch management.12MIT
- AlicenseAqualityDmaintenanceA Model Context Protocol server that provides Git version control operations as structured tools for AI coding agents. It enables LLMs to programmatically manage repositories through actions like committing changes, rolling back code, and comparing diffs.10Apache 2.0