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.
Version Lists
- Ver0.0.1: 添加tool:git_describe
- Ver0.0.2: 一致性优化
- Ver0.0.3: 完善README.md中Using uvx示例
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_diff- Shows 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_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
-
git_create_branch- Creates 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_describe
- Shows the closest tag associated with the current commit
- Inputs:
repo_path(string): Path to Git repository
- Returns: Contents of the specified tagged commit
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 or mcp.json(Trae):
Using uvx
"mcpServers": {
"git": {
"command": "uvx",
"args": ["mcp-server-git", "--repository", "path/to/git/repo"]
}
}
使用pypi.org打包文件
{
"mcpServers": {
"git-airnet": {
"command": "uvx",
"args": [
"--from",
"mcp_git_AirNet==0.0.3",
"--refresh-package",
"mcp_git_AirNet",
"git_mcp_server_AirNet"
]
}
}
}
使用本地打包文件,--from 参数直接指定whl/tar.gz文件路径
{
"mcpServers": {
"git-whl": {
"command": "uvx",
"args": [
"--from",
"E:\\技术支持室\\Trae\\mcp_git_AirNet\\dist\\mcp_git_airnet-0.0.3-py3-none-any.whl",
"git_mcp_server_AirNet"
]
}
}
}
{
"mcpServers": {
"git-tar": {
"command": "uvx",
"args": [
"--from",
"E:\\技术支持室\\Trae\\mcp_git_AirNet\\dist\\mcp_git_airnet-0.0.3.tar.gz",
"git_mcp_server_AirNet"
]
}
}
}
Using docker
- 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"]
}
}
Using pip installation
"mcpServers": {
"git": {
"command": "python",
"args": ["-m", "mcp_server_git", "--repository", "path/to/git/repo"]
}
}
Usage with Zed
Add to your Zed settings.json:
Using uvx
"context_servers": [
"mcp-server-git": {
"command": {
"path": "uvx",
"args": ["mcp-server-git"]
}
}
],
Using pip installation
"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-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
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
{
"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.
Metadata
Release files for mcp_git_AirNet 0.0.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| mcp_git_airnet-0.0.3.tar.gz | 6.5 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| mcp_git_airnet-0.0.3-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 14.3 kB
Release files / mcp_git_airnet-0.0.3.tar.gz
| Download URL | mcp_git_airnet-0.0.3.tar.gz |
|---|---|
| Size | 6.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
051ec8b500e37b0a89edb4762f8672299971fcf1a9350fcc7b5421c827937b66
|
|
BLAKE2b-256 checksum How to use checksums |
99f5b618fb678ff06977aa4e117a4fdb51dd04e101268671ab50a9bba344c569
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.6.17
|
Release files / mcp_git_airnet-0.0.3-py3-none-any.whl
| Download URL | mcp_git_airnet-0.0.3-py3-none-any.whl |
|---|---|
| Size | 7.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
10692562ca2105ad9d653c40e840e06551467f72c04c95d1ce3d6524f1f4f443
|
|
BLAKE2b-256 checksum How to use checksums |
de0d3c096beaaeace920bb03f25283e492f5521b9d9f15540113f3862b731dd4
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.6.17
|
Security for mcp_git_AirNet 0.0.3
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.