Git MCP Server
Provides tools for local git operations including creating branches, committing with conventional commit format, pushing and pulling from remotes, checking status, and syncing with main branch.
Integrates with GitHub for authenticated remote operations such as push and pull, and supports branch naming conventions based on GitHub issues.
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., "@Git MCP Server create branch for issue #42"
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.
Git MCP Server
Python MCP (Model Context Protocol) server for local git operations, providing native tool integration with Claude Code and other MCP clients.
Features
6 Git Tools: Commit, branch, push, pull, status, and sync operations
Native MCP Integration: Works seamlessly with Claude Code
Conventional Commits: Enforced commit message format with type prefixes
Branch Naming: Enforced conventions (issue-N-description, feature-*, etc.)
Token Authentication: Automatic GitHub token injection for remote operations
Related MCP server: SAGE
Installation
From PyPI
pip install git-mcp-server
# or with uv
uvx git-mcp-serverFrom Source
git clone https://github.com/rriesco/git-mcp-server.git
cd git-mcp-server
uv syncConfiguration
Environment Variables
Variable | Required | Description |
| For push/pull | GitHub Personal Access Token for authenticated git operations |
Claude Code Configuration
Add to your MCP configuration (~/.config/claude-code/mcp-config.json):
{
"mcpServers": {
"git-manager": {
"type": "stdio",
"command": "uvx",
"args": ["git-mcp-server"],
"env": {
"GITHUB_TOKEN": "${GITHUB_TOKEN}"
}
}
}
}Available Tools
Tool | Description |
| Create and checkout a new branch with naming conventions |
| Create conventional commit with Claude attribution |
| Push commits to remote with upstream tracking |
| Pull commits from remote |
| Get current branch, tracking info, and file changes |
| Sync current branch with main (merge or rebase) |
Usage Examples
Create a Branch
result = git_create_branch(
issue_number=42,
description="add-feature-x"
)
# Creates: issue-42-add-feature-xCommit Changes
result = git_commit(
type="feat",
message="implement user authentication"
)
# Creates: feat: implement user authentication
#
# Co-Authored-By: Claude <noreply@anthropic.com>Check Status
result = git_status()
# Returns: {branch, tracking, ahead, behind, staged, modified, untracked, clean}Sync with Main
result = git_sync_with_main(
main_branch="main",
strategy="merge" # or "rebase"
)Commit Types
The git_commit tool enforces conventional commit types:
Type | Description |
| New feature |
| Bug fix |
| Documentation only |
| Code style (formatting, semicolons, etc.) |
| Code refactoring |
| Performance improvement |
| Adding or fixing tests |
| Build system or dependencies |
| CI/CD configuration |
| Maintenance tasks |
| Revert previous commit |
Branch Naming
The git_create_branch tool enforces naming conventions:
issue-<N>-<description>- For GitHub issuesfeature-<description>- For features without issuesfix-<description>- For bug fixesrefactor-<description>- For refactoring
Development
Prerequisites
Python >= 3.10
uv (recommended) or pip
Git
Setup
git clone https://github.com/rriesco/git-mcp-server.git
cd git-mcp-server
uv syncRunning Tests
# Unit tests only (fast)
uv run pytest -m "not integration" -v
# Integration tests (creates real git repos in temp directories)
uv run pytest -m integration -v
# All tests with coverage
uv run pytest --cov=git_mcp_server --cov-report=term-missingType Checking
uv run mypy src/git_mcp_server --strictArchitecture
Claude Code / MCP Client
|
| MCP Protocol (stdio)
v
┌─────────────────────────────┐
│ Python FastMCP Server │
│ - Tool Registry │
│ - GitPython Client │
│ - Error Handling │
│ - Type Validation │
└─────────────┬───────────────┘
|
| GitPython
v
Local Git RepoProject Structure
git-mcp-server/
├── src/git_mcp_server/
│ ├── server.py # Server entry point
│ ├── tools/
│ │ ├── branch.py # Branch operations
│ │ ├── commit.py # Commit operations
│ │ ├── remote.py # Push/pull operations
│ │ ├── status.py # Status queries
│ │ └── sync.py # Sync with main
│ └── utils/
│ ├── git_client.py # Singleton Repo instance
│ └── errors.py # Structured error handling
└── tests/
├── test_*.py # Unit tests
└── integration/ # Integration testsLicense
MIT License - see LICENSE for details.
Contributing
Contributions are welcome! Please read the contributing guidelines before submitting PRs.
Fork the repository
Create a feature branch
Make your changes with tests
Submit a pull request
Links
Available Tools
6 toolsgit_commitA
Create conventional commit (type: message) with Claude attribution.
Types: feat, fix, docs, style, refactor, perf, test, build, ci, chore, revert
Options:
files: commit specific files only (default: all changes)
skip_hooks: bypass pre-commit hooks via --no-verify
Returns: {sha, stats: {files_changed, insertions, deletions}, message}
Inputs: type (required), message (required), files, skip_hooks. Returns: object
git_create_branchA
Create and checkout a git branch.
Naming: branch_name (explicit) OR issue_number/description (auto: issue-N-desc or feature-desc). Options: from_branch (default: HEAD or main if auto-naming), pull_latest (default: False).
Returns: {branch_name, previous_branch, sha, based_on}
Inputs: branch_name, issue_number, description, from_branch, +1 more. Returns: object
git_pullB
Pull commits from remote. Uses GITHUB_TOKEN from env if available.
Fails if there are uncommitted changes (commit or stash first).
Returns: {branch, remote, sha_before, sha_after, commits_pulled, files_changed, up_to_date}
Inputs: remote, branch. Returns: object
git_pushA
Push commits to remote. Uses GITHUB_TOKEN from env if available.
Options:
branch: specific branch (default: current)
set_upstream: track new branches (default: True)
force: force push (use with caution!)
Returns: {branch, remote, sha, commits_pushed, is_new_branch, force}
Inputs: remote, branch, set_upstream, force. Returns: object
git_statusA
Get repository status: branch, tracking info, and file changes.
Returns: {branch, tracking, ahead, behind, staged, modified, untracked, clean}
clean=True means no staged, modified, or untracked files.
Inputs: no named parameters. Returns: object
git_sync_with_mainA
Sync current branch with main. Fetches latest and merges/rebases.
Options:
main_branch: branch to sync from (default: "main")
strategy: "merge" (default) or "rebase"
Fails if on main branch or has uncommitted changes.
Returns: {branch, main_branch, strategy, sha_before, sha_after, commits_added, up_to_date, files_changed}
Inputs: main_branch, strategy. Returns: object
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 6 tools
Each tool has a distinct purpose: commit, create branch, pull, push, status, and sync with main. There is no ambiguity or overlap between them.
All tool names follow a consistent verb_noun pattern using snake_case (e.g., git_commit, git_push), making them predictable and easy to distinguish.
With 6 tools, the server is well-scoped for common Git operations. The number is neither too large nor too small for the domain.
The tool set covers core Git workflows (commit, branch, push/pull, status, sync). Minor gaps include no explicit diff or log tools, but these are not essential for basic operations.
Maintenance
Related MCP Connectors
Plain-English git for agents: 22 tools to branch, commit, push and tag. Free tier.
Access the GitHub API, enabling file operations, repository management, search functionality, and…
Manage repositories, users, releases, and automate GitHub workflows
Generate SBOMs, scan vulnerabilities, and analyze dependencies from local projects or Git repos.
Related MCP Servers
- FlicenseNot gradedqualityNot gradedmaintenanceEnables AI assistants to interact with local Git repositories for operations like status, commits, branching, and diffs, plus GitHub API integration for managing pull requests when authenticated.-
- AlicenseAqualityBmaintenanceLocal-first MCP server and CLI wrapper for AI coding agents. SAGE routes shell commands through a tracked local runner, stores command history on the user’s machine, and returns compressed terminal output to reduce noisy context.16167 PyPI11MIT
- FlicenseNot gradedqualityDmaintenanceEnables querying today's GitHub commits, performing local git operations (status, diff, add, commit, push), and creating GitHub issues through natural language.-
- FlicenseNot gradedqualityDmaintenanceEnables AI-powered git assistance including commit message generation, branch naming, and branch analysis using conventional commits and git status/diff/log.1-