The git MCP server enables interaction with and automation of Git repositories through these commands:
Check repository status (
git_status)View unstaged or staged changes (
git_diff_unstaged,git_diff_staged)Compare branches or commits (
git_diff)Record changes with a message (
git_commit)Add file contents to staging area (
git_add)Unstage all changes (
git_reset)View commit history (
git_log)Create and switch branches (
git_create_branch,git_checkout)Display commit contents (
git_show)Initialize repositories (
git_init)
Provides tools to read, search, and manipulate Git repositories via Large Language Models. Includes functionalities for viewing git status, diffs, committing changes, managing branches, and other git operations.
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
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 branchstart_point(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
git_branch
List 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: GitLab 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:
After installation, you can run it as a script using:
Configuration
Usage with Claude Desktop
Add this to your claude_desktop_config.json:
Note: replace '/Users/username' with the a path that you want to be accessible by this tool
Usage with VS Code
For quick installation, use one of the one-click install buttons below...
For manual installation, you can configure the MCP server using one of these methods:
Method 1: User Configuration (Recommended)
Add the configuration to your user-level MCP configuration file. Open the Command Palette (Ctrl + Shift + P) and run MCP: Open User Configuration. This will open your user mcp.json file where you can add the server configuration.
Method 2: Workspace Configuration
Alternatively, you can add the configuration to a file called .vscode/mcp.json in your workspace. This will allow you to share the configuration with others.
For more details about MCP configuration in VS Code, see the official VS Code MCP documentation.
For Docker installation:
Usage with Zed
Add to your Zed settings.json:
Usage with Zencoder
Go to the Zencoder menu (...)
From the dropdown menu, select
Agent ToolsClick on the
Add Custom MCPAdd the name (i.e. git) and server configuration from below, and make sure to hit the
Installbutton
Debugging
You can use the MCP inspector to debug the server. For uvx installations:
Or if you've installed the package in a specific directory or are developing on it:
Running 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
UVX
Build
Docker build:
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.