pia-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 pia-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
- 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_staged- Shows 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_diff- Shows 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_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 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_branch- Creates 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_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_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
Installation
Using uv (recommended)
Install uv, then prepare the project environment from the lock file:
uv --directory /path/to/pia-mcp-server-git sync --locked
Using pip
Alternatively, install the package with pip:
pip install pia-mcp-server-git
Deployment
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/pia-mcp-server-git run --no-sync pia-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
pia-mcp-server-git --repository /path/to/git/repo
The equivalent module invocation is:
python -m mcp_server_git --repository /path/to/git/repo
Verification
Use the MCP Inspector to verify the stdio server locally:
npx @modelcontextprotocol/inspector uv --directory /path/to/pia-mcp-server-git run --no-sync pia-mcp-server-git --repository /path/to/git/repo
For automated unit tests:
uv --directory /path/to/pia-mcp-server-git run pytest
.\scripts\setup-pypi-auth.ps1
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file pia_mcp_server_git-0.2.0.tar.gz.
File metadata
- Download URL: pia_mcp_server_git-0.2.0.tar.gz
- Upload date:
- Size: 69.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via:
uv/0.12.8 {"installer":{"name":"uv","version":"0.12.8","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":null,"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f6b3a14393445e05419a4e6eb23c1e9496ee6543b84d4fc44a88ca5be1d797bb
|
|
| MD5 |
2892c0122a9de6bf593907f275561ee0
|
|
| BLAKE2b-256 |
c7bb2a150f90c0a6f06d119d390116352c65ac13757cc77d9a7abbf79ebe1082
|
File details
Details for the file pia_mcp_server_git-0.2.0-py3-none-any.whl.
File metadata
- Download URL: pia_mcp_server_git-0.2.0-py3-none-any.whl
- Upload date:
- Size: 14.9 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via:
uv/0.12.8 {"installer":{"name":"uv","version":"0.12.8","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":null,"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5a99185d4025bcfbfd61a5f033680c803fb90969699b6365c735390304542b66
|
|
| MD5 |
3ab50ff95923d68e5438bd919ed01b41
|
|
| BLAKE2b-256 |
ae4f278626e6faa2b115c4d800336e2bdf801cd920ed6253cb5c1879eb6dd534
|