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 "Install 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 Servercreate 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: Git Workflow MCP Server
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}
| Name | Required | Description | Default |
|---|---|---|---|
| type | Yes | ||
| message | Yes | ||
| files | No | ||
| skip_hooks | No |
Output Schema
| Name | Required | Description |
|---|---|---|
No output parameters | ||
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
With no annotations, the description must carry behavioral disclosure. It mentions return structure and options (files, skip_hooks), but lacks details on side effects (e.g., automatic staging, error handling, or repository state requirements). Incomplete but not missing.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is concise (6 lines), front-loads the main action, and each sentence provides distinct value: type list, options, and return format. No wasted words.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
The description covers purpose, parameters, and return value, but lacks prerequisites (e.g., staged changes, git repo requirement) and error conditions. Given no annotations and moderate complexity (4 params), more context would improve completeness.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
The description adds significant meaning beyond the schema: it lists allowed types (feat, fix, etc.) where schema only has a string, explains 'files' defaults to all changes, and clarifies 'skip_hooks' bypasses pre-commit hooks. Schema coverage is 0%, so description compensates well.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description clearly states the tool's action: 'Create conventional commit (type: message) with Claude attribution.' It specifies the verb (create), resource (commit), and format (conventional), distinguishing it from sibling tools like git_push or git_status.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The description implies usage for committing changes but does not explicitly provide when-to-use vs alternatives or exclusions. Options like 'files' and 'skip_hooks' offer some context, but no direct guidance on tool selection.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
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}
| Name | Required | Description | Default |
|---|---|---|---|
| branch_name | No | ||
| issue_number | No | ||
| description | No | ||
| from_branch | No | ||
| pull_latest | No |
Output Schema
| Name | Required | Description |
|---|---|---|
No output parameters | ||
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
No annotations are provided, but the description discloses the behavior: creates and checks out a branch, outlines auto-naming logic, and specifies the return structure. It does not mention potential issues like a dirty working directory or error conditions, but for a creation tool, it is fairly transparent.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is very concise and well-structured: a clear one-line purpose, followed by a paragraph on naming and options, then a short return specification. Every sentence adds value without redundancy.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
With 5 parameters, no required fields, and no output schema (though return fields are listed), the description covers naming, options, and returns. It does not address error conditions or preconditions, but for a straightforward creation tool, it is sufficiently complete.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
The input schema has 0% description coverage, so the description carries the full burden. It adds meaning to parameters: explains that branch_name is explicit, while issue_number/description trigger auto-naming, and describes options like from_branch and pull_latest with defaults.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description clearly states the action: 'Create and checkout a git branch.' This is a specific verb and resource, and it distinguishes the tool from siblings like git_commit or git_pull.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The description provides naming conventions (explicit or auto) and options (from_branch, pull_latest) with defaults. It gives some guidelines but does not explicitly state when not to use this tool or when alternatives might be better.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
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}
| Name | Required | Description | Default |
|---|---|---|---|
| remote | No | origin | |
| branch | No |
Output Schema
| Name | Required | Description |
|---|---|---|
No output parameters | ||
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
With no annotations, the description carries the full burden. It discloses that the tool uses GITHUB_TOKEN and fails with uncommitted changes. However, it does not cover conflict resolution or error scenarios beyond the precondition.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is very concise, using three short sentences and a bulleted return format. All information is front-loaded and no words are wasted.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
Given the tool's simplicity (two optional params, output schema described), the description covers auth, a key precondition, and the return structure. It is sufficiently complete for an agent to use the tool correctly in most cases.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Schema coverage is 0%, but the description adds no parameter details beyond the names in the schema. The defaults and types are in the schema, but the description could have clarified the branch parameter's role (e.g., current branch if null).
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description clearly states 'Pull commits from remote', specifying the action (pull) and resource (commits from remote). It distinguishes itself from siblings like git_push and git_commit through the pull action, but lacks explicit differentiation.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The description provides usage context by noting the tool fails if there are uncommitted changes, advising to commit or stash first. However, it does not mention when not to use it or alternatives like git_sync_with_main.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
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}
| Name | Required | Description | Default |
|---|---|---|---|
| remote | No | origin | |
| branch | No | ||
| set_upstream | No | ||
| force | No |
Output Schema
| Name | Required | Description |
|---|---|---|
No output parameters | ||
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
No annotations are provided, so the description carries full burden. It discloses that the tool pushes commits (a write operation), notes authentication via GITHUB_TOKEN, warns about force push, and specifies the return value. However, it does not mention potential side effects like overwriting remote commits or failure scenarios.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is very concise: one sentence for purpose, then a bullet list of options, and a return description. It is front-loaded and every sentence adds value without redundancy.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
For a simple git push tool, the description covers the purpose, parameters, and return values. It lacks explicit context about prerequisites (e.g., having a remote configured) or full authentication details, but the output schema is provided. Overall, it is adequate given the tool's complexity.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Schema description coverage is 0%, but the description compensates thoroughly by explaining all four parameters: branch (specific, defaults to current), set_upstream (track new branches), force (force push with caution), and remote (implied by default 'origin'). This adds significant meaning beyond the schema's bare names.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description 'Push commits to remote' clearly states the verb (push) and resource (commits to remote). The tool name 'git_push' aligns perfectly, and it distinguishes itself from sibling tools like git_commit, git_create_branch, etc., which have different purposes.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The description includes usage notes like using GITHUB_TOKEN and a caution for force push, but it does not explicitly state when to use this tool over siblings (e.g., vs. git_pull or git_commit). The context is implied but not fully explicit.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
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.
| Name | Required | Description | Default |
|---|---|---|---|
No parameters | |||
Output Schema
| Name | Required | Description |
|---|---|---|
No output parameters | ||
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
No annotations provided, so description carries full burden. It explains what each returned field means and the condition for clean=True (no changes). Provides useful behavioral context beyond the empty input schema.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
Description is two sentences, no wasted words. First sentence states purpose, second clarifies output structure. Well front-loaded and efficient.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
Given no parameters and output schema (implied by returns description), the description fully explains what the tool does and what it returns. No gaps for a status-checking tool.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Tool has 0 parameters, so schema coverage is 100%. Baseline is 4 because parameter meaning is not needed. Description adds no param info but none is required.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
Description clearly states it gets repository status including branch, tracking info, and file changes. This verb+resource combination is distinct from sibling tools like git_commit, git_create_branch, git_pull, git_push, git_sync_with_main.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
No explicit guidance on when to use this vs alternatives, but siblings are all different actions (commit, branch, pull, push, sync), so usage context is implied. Adequate but lacks when-not or prerequisite statements.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
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}
| Name | Required | Description | Default |
|---|---|---|---|
| main_branch | No | main | |
| strategy | No | merge |
Output Schema
| Name | Required | Description |
|---|---|---|
No output parameters | ||
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
With no annotations, the description carries full burden. It states it fetches and then merges or rebases, implies it modifies the branch history, and lists return fields including sha changes. It fails with uncommitted changes, indicating a precondition. It does not mention push behavior or destructive implications of rebase, but overall it provides good transparency.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is very concise: one introductory sentence, then a bullet-like list of options and return fields. It is front-loaded with the main purpose and uses minimal words. Every sentence earns its place.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
Given the tool's complexity (git sync with merge/rebase), two optional parameters, and an output schema, the description is complete. It covers purpose, parameters, failure conditions, and return format. The output schema exists, so the return list is supplementary but not redundant.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
The input schema has no descriptions (0% coverage), so the description fully supplies meaning for both parameters: main_branch defaults to 'main', strategy defaults to 'merge' with option 'rebase'. This adds essential context beyond the schema's bare type declarations.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description clearly states the tool syncs the current branch with main by fetching latest and merging or rebasing. This distinguishes it from siblings like git_pull (generic) and git_push (push only), as it is specifically about updating the current branch relative to main.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The description explicitly provides failure conditions: fails if on main branch or has uncommitted changes. This tells when not to use it. It also lists options and defaults, giving clear usage context. However, it does not explicitly compare with alternatives like git_merge or git_rebase, though the siblings are sufficiently distinct.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
TDQS
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
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Related MCP Connectors
Plain-English git via MCP: 22 tools to branch, commit, push, and tag. No git jargon.
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
- -licenseBqualityNot gradedmaintenanceEnables comprehensive Git and GitHub operations through 30 DevOps tools including repository management, file operations, workflows, and advanced Git features. Provides complete Git functionality without external dependencies for seamless integration with Gitea and GitHub platforms.18819
- 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.
- AlicenseBqualityDmaintenanceProvides comprehensive Git functionality to MCP clients, enabling users to manage repositories through operations like commits, diffs, and branch management via natural language. It automatically detects the current working directory and supports multi-project workflows across different local environments.166072MIT
- AlicenseAqualityAmaintenanceLocal-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.1610MIT
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/rriesco/git-mcp-server'
If you have feedback or need assistance with the MCP directory API, please join our Discord server