Provides comprehensive Git operations including repository management, commits, branches, files, tags, and advanced features like cherry-pick, submodules, and worktrees.
Enables integration with Gitea platform for managing repositories, issues, pull requests, releases, webhooks, and user operations.
Offers full GitHub integration including repository operations, issues, pull requests, plus GitHub-exclusive features like workflows, actions, deployments, security, analytics, code review, codespaces, gists, and projects.
GIT MCP Server
Professional MCP (Model Context Protocol) server for Git operations with multi-provider support, enhanced security, and comprehensive safety features.
Features
🚀 17 Specialized Git Tools - Complete Git workflow coverage with safety warnings
🔄 Multi-Provider Support - GitHub and Gitea simultaneously with credential validation
🔒 Security-First Design - Read-only file operations, no content modification via API
🚨 Safety Warnings - Comprehensive warnings for destructive operations
🛡️ Enhanced Error Handling - Detailed diagnostics with actionable solutions
📋 Comprehensive Validation - Pre-execution validation with helpful guidance
🔧 IDE/Client Compatibility - Universal aliases for different MCP client expectations
📦 NPM Distribution - Easy installation via npx
🤖 AI Agent Integration - Designed for AI agent workflows with safety controls
Quick Start
Installation & Usage
Configuration
Set up your provider credentials via environment variables:
GitHub Configuration
Gitea Configuration
Multi-Provider Support
Configure both GitHub and Gitea to use provider="both" in tool calls.
Available Tools
Tool | Description | Operations | Safety Features |
| Core Git operations | init, status, commit, sync, backup, create, list, get, update, delete, fork, search | Repository deletion warnings |
| Read-only file operations | read, list, search, backup | File modification blocked |
| Branch management | create, list, get, delete, merge, compare | Branch deletion warnings |
| Issue management | create, list, get, update, close, comment, search | - |
| Pull request management | create, list, get, update, merge, close, review, search | - |
| Tag management | create, list, get, delete, search | - |
| Release management | create, list, get, update, delete, publish, download | - |
| Remote repository management | add, remove, rename, show, set-url, prune | - |
| ⚠️ Repository reset | soft, mixed, hard, reset-to-commit, reset-branch | Hard reset warnings |
| Stash management | stash, pop, apply, list, show, drop, clear | - |
| Git configuration | get, set, unset, list, edit, show | - |
| Repository monitoring | status, changes, health | - |
| Repository backup | create, restore, list, verify | - |
| Repository archiving | create, extract, list, verify | - |
| Repository synchronization | sync, status | - |
| Package management | list, get, create, update, delete, publish, download | - |
| Repository analytics | stats, insights, reports | - |
Security Features
🔒 File Operations Restriction
The git-files tool is read-only only for security reasons:
✅ Allowed Operations:
read- Read file contentlist- List directory contentssearch- Search file contentbackup- Create local backups
❌ Blocked Operations:
create- Create new files (blocked)update- Modify existing files (blocked)delete- Delete files (blocked)
Why? File content modification should be done through your local development environment, not via remote API calls.
🚨 Safety Warnings
Destructive operations include comprehensive safety warnings:
Git Reset Warnings
Result: Detailed warning about data loss with alternatives:
git reset --soft(keeps changes staged)git reset --mixed(keeps changes unstaged)git stash(saves changes temporarily)
Branch Deletion Warnings
Result: Warning about permanent branch deletion with suggestions:
Ensure branch is merged first
Create backup branch before deletion
Check for unmerged commits
🔍 Enhanced Error Handling
All tools provide detailed error messages with actionable solutions:
Example Error Response:
Usage Examples
Local Git Operations
Remote Repository Operations
Safe File Operations (Read-Only)
Destructive Operations (With Warnings)
Error Codes Reference
Common Error Codes
Code | Description | Solution |
| Parameter validation failed | Check required parameters and format |
| Directory is not a Git repository | Use
first |
| No changes to commit | Make changes first |
| Merge conflicts detected | Resolve conflicts before proceeding |
| Permission denied | Check credentials and access rights |
| Provider not configured | Set up GitHub or Gitea credentials |
| Network connectivity issue | Check internet connection |
| File modification blocked | Use read-only operations only |
| Destructive operation detected | Review warning and confirm if needed |
Git-Specific Error Codes
Code | Description | Solution |
| Branch already exists | Use different name or delete existing |
| Branch not found | Check branch name and remote config |
| Uncommitted changes | Commit or stash changes first |
| Repository in detached HEAD state | Create branch or checkout existing |
| Cannot lock Git reference | Wait for other operations to complete |
Configuration Guide
Environment Variables
Required for GitHub:
GITHUB_TOKEN- Personal access token with repo permissionsGITHUB_USERNAME- Your GitHub username
Required for Gitea:
GITEA_URL- Your Gitea instance URL (e.g.,https://git.example.com)GITEA_TOKEN- Personal access tokenGITEA_USERNAME- Your Gitea username
Credential Validation
The server automatically validates credentials on startup:
✅ Valid credentials - API connectivity confirmed
❌ Invalid token - Authentication failed
🌐 Network error - Cannot reach provider API
⚠️ Partial failure - Some providers failed validation
Setup Instructions
Generate GitHub Token:
Go to GitHub Settings → Developer settings → Personal access tokens
Create token with
reposcopeCopy token to
GITHUB_TOKENenvironment variable
Generate Gitea Token:
Go to your Gitea instance → Settings → Applications
Generate new token with appropriate permissions
Copy token to
GITEA_TOKENenvironment variable
Test Configuration:
# Start the server to see validation results npx @andrebuzeli/git-mcp@latest
Troubleshooting
Common Issues
"Provider not configured" error:
Check environment variables are set correctly
Verify token has required permissions
Test API connectivity manually
"Operation restricted" error:
File modification operations are blocked for security
Use read-only operations:
read,list,search,backupMake file changes through your local development environment
"Safety warning" error:
Review the detailed warning message
Consider safer alternatives suggested
Use
confirmDestructive: trueonly if absolutely necessary
"Network error" errors:
Check internet connectivity
Verify provider URLs are correct
Check firewall/proxy settings
Getting Help
Check error messages - They include specific suggestions
Review safety warnings - They explain risks and alternatives
Validate credentials - Server validates on startup
Use read-only operations - Safe file operations are always available
Development
Building from Source
Testing
License
MIT License - see LICENSE file for details.
Contributing
Fork the repository
Create a feature branch
Make your changes
Add tests for new functionality
Submit a pull request
⚠️ Important Security Notes:
File content modification is intentionally restricted for security
Always review safety warnings before destructive operations
Keep your API tokens secure and rotate them regularly
Use
confirmDestructive: trueonly when absolutely necessary