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_status
- Shows the working tree status
- Input:
repo_path
(string): Path to Git repository
- Returns: Current status of working directory as text output
-
git_diff_unstaged
- Shows changes in working directory not yet staged
- Input:
repo_path
(string): Path to Git repository
- Returns: Diff output of unstaged changes
-
git_diff_staged
- Shows changes that are staged for commit
- Input:
repo_path
(string): Path to Git repository
- Returns: Diff output of staged changes
-
git_commit
- Records changes to the repository
- Inputs:
repo_path
(string): Path to Git repositorymessage
(string): Commit message
- Returns: Confirmation with new commit hash
-
git_add
- Adds 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_reset
- Unstages all staged changes
- Input:
repo_path
(string): Path to Git repository
- Returns: Confirmation of reset operation
-
git_log
- Shows the commit logs
- Inputs:
repo_path
(string): Path to Git repositorymax_count
(number, optional): Maximum number of commits to show (default: 10)
- Returns: Array of commit entries with hash, author, date, and message
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-git
After installation, you can run it as a script using:
python -m mcp_server_git
Configuration
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"]
}
}
</details>
<details>
<summary>Using pip installation</summary>
"mcpServers": {
"git": {
"command": "python",
"args": ["-m", "mcp_server_git", "--repository", "path/to/git/repo"]
}
}
</details>
Usage with Zed
Add to your Zed settings.json:
<details> <summary>Using uvx</summary>"context_servers": [
"mcp-server-git": {
"command": {
"path": "uvx",
"args": ["mcp-server-git"]
}
}
],
</details>
<details>
<summary>Using pip installation</summary>
"context_servers": {
"mcp-server-git": {
"command": {
"path": "python",
"args": ["-m", "mcp_server_git"]
}
}
},
</details>
Debugging
You can use the MCP inspector to debug the server. For uvx installations:
npx @modelcontextprotocol/inspector uvx mcp-server-git
Or 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-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.