mcp-server-git
Provides tools for interacting with Git repositories, including status, diffs, commits, staging, branch management, logs, and showing commit contents.
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-server-git show me the git status of /path/to/my-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.
Requires MCP Python SDK 1.x (mcp>=1.29.0,<2). SDK 2.0 renamed APIs this server uses. The port to v2 is in progress.
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
Inputs:
repo_path(string): Path to Git repositorycontext_lines(number, optional): Number of context lines to show (default: 3)
Returns: Diff output of unstaged changes
git_diff_stagedShows changes that are staged for commit
Inputs:
repo_path(string): Path to Git repositorycontext_lines(number, optional): Number of context lines to show (default: 3)
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 withcontext_lines(number, optional): Number of context lines to show (default: 3)
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
Inputs:
repo_path(string): Path to Git repositoryfiles(string[]): Array of file paths to stage
Returns: Confirmation of staged files
git_resetUnstages all staged changes
Input:
repo_path(string): Path to Git repository
Returns: Confirmation of reset operation
git_logShows the commit logs with optional date filtering
Inputs:
repo_path(string): Path to Git repositorymax_count(number, optional): Maximum number of commits to show (default: 10)start_timestamp(string, optional): Start timestamp for filtering commits. Accepts ISO 8601 format (e.g., '2024-01-15T14:30:25'), relative dates (e.g., '2 weeks ago', 'yesterday'), or absolute dates (e.g., '2024-01-15', 'Jan 15 2024')end_timestamp(string, optional): End timestamp for filtering commits. Accepts ISO 8601 format (e.g., '2024-01-15T14:30:25'), relative dates (e.g., '2 weeks ago', 'yesterday'), or absolute dates (e.g., '2024-01-15', 'Jan 15 2024')
Returns: Array of commit entries with hash, author, date, and message
git_create_branchCreates a new branch
Inputs:
repo_path(string): Path to Git repositorybranch_name(string): Name of the new branchbase_branch(string, optional): Base branch to create from (defaults to current branch)
Returns: Confirmation of branch creation
git_checkoutSwitches branches
Inputs:
repo_path(string): Path to Git repositorybranch_name(string): Name of branch to checkout
Returns: Confirmation of branch switch
git_showShows 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_branchList Git branches
Inputs:
repo_path(string): Path to the Git repository.branch_type(string): Whether to list local branches ('local'), remote branches ('remote') or all branches('all').contains(string, optional): The commit sha that branch should contain. Do not pass anything to this param if no commit sha is specifiednot_contains(string, optional): The commit sha that branch should NOT contain. Do not pass anything to this param if no commit sha is specified
Returns: List of branches
Related MCP server: Git MCP Server
Installation
Using uv (recommended)
Install uv, then prepare the project environment from the lock file:
uv --directory /path/to/mcp-server-git sync --lockedUsing pip
Alternatively, install the package with pip:
pip install mcp-server-gitDeployment
This server communicates over stdio. A host service must launch the process and connect its standard input and output to the MCP client. The project does not expose an HTTP endpoint by itself.
Using uv from the source tree
uv --directory /path/to/mcp-server-git run --no-sync mcp-server-git --repository /path/to/git/repo--repository limits the server to the specified repository and its subdirectories. Omit --no-sync if the environment has not been prepared with uv sync.
Using an installed package
mcp-server-git --repository /path/to/git/repoThe equivalent module invocation is:
python -m mcp_server_git --repository /path/to/git/repoDocker
Build the image from the project root:
docker build -t mcp/git .Run it with a repository mounted into the container:
docker run --rm -i \
--mount type=bind,src=/path/to/git/repo,dst=/workspace \
mcp/git --repository /workspaceThe container also communicates over stdio, so it must be started by an MCP-capable host service.
Verification
Use the MCP Inspector to verify the stdio server locally:
npx @modelcontextprotocol/inspector uv --directory /path/to/mcp-server-git run --no-sync mcp-server-git --repository /path/to/git/repoFor automated unit tests:
uv --directory /path/to/mcp-server-git run pytestAvailable Tools
12 toolsgit_addBIdempotent
Adds file contents to the staging area
Inputs: files (required), repo_path (required).
git_branchARead-onlyIdempotent
List Git branches
Inputs: repo_path (required), branch_type (required), contains, not_contains.
git_checkoutC
Switches branches
Inputs: repo_path (required), branch_name (required).
git_commitC
Records changes to the repository
Inputs: message (required), repo_path (required).
git_create_branchC
Creates a new branch from an optional base branch
Inputs: repo_path (required), branch_name (required), base_branch.
git_diffCRead-onlyIdempotent
Shows differences between branches or commits
Inputs: target (required), repo_path (required), context_lines.
git_diff_stagedARead-onlyIdempotent
Shows changes that are staged for commit
Inputs: repo_path (required), context_lines.
git_diff_unstagedARead-onlyIdempotent
Shows changes in the working directory that are not yet staged
Inputs: repo_path (required), context_lines.
git_logCRead-onlyIdempotent
Shows the commit logs
Inputs: repo_path (required), max_count, end_timestamp, start_timestamp.
git_resetADestructiveIdempotent
Unstages all staged changes
Inputs: repo_path (required).
git_showCRead-onlyIdempotent
Shows the contents of a commit
Inputs: revision (required), repo_path (required).
git_statusBRead-onlyIdempotent
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 12 tools
Most tools map to distinct Git operations, but git_diff, git_diff_staged, and git_diff_unstaged overlap enough that an agent could select the wrong one without careful attention. The descriptions help separate them, but the boundary between general diff and specific diff variants creates slight ambiguity.
All tools follow a consistent git_ prefix with familiar Git command names, making the set predictable and easy to navigate. Verb and noun forms align with standard Git vocabulary, so there is no stylistic mixing or confusing variation.
Twelve tools is well-scoped for a Git server, covering common local repository workflows without unnecessary bloat. Each tool addresses a concrete Git operation, and the count feels appropriate rather than sparse or excessive.
The toolset covers the core local Git workflow: status, diff, add, commit, branch, checkout, log, and show. Minor gaps like branch deletion or merge are missing, but agents can perform essential repository inspection and commit tasks without dead ends.
Maintenance
Related MCP Connectors
GitHub Copilot MCP: code, repo, PR, workflow tools for AI assistants.
AI-native git hosting — repos, PRs, issues, CI gates, and AI code review over MCP (60 tools).
Connect AI assistants to GitHub - manage repos, issues, PRs, and workflows through natural language.
Read and write KukGit repositories, files, issues and pull requests from an AI assistant.
Related MCP Servers
- AlicenseBqualityDmaintenanceProvides comprehensive Git functionality to MCP clients, enabling users to manage repositories through operations like commits, diffs, and branch management via natural language. It automatically detects the current working directory and supports multi-project workflows across different local environments.163MIT
- AlicenseNot gradedqualityDmaintenanceAn MCP server that provides tools for interacting with Git repositories, enabling AI assistants to manage repositories, branches, commits, and files through a standardized interface.1Apache 2.0
- AlicenseNot gradedqualityFmaintenanceProvides comprehensive git tooling via MCP, including status, diffs, commits, branches, stashes, and multi-root inventory, enabling AI agents to manage repositories.9 npmMIT
- AlicenseNot gradedqualityBmaintenanceEnables AI agents to search commits, retrieve diffs, and inspect file change history in a Git repository using MCP.50 npmMIT