MCP Git Server
An MCP server that provides Git version control operations for Claude, enabling comprehensive repository management. It allows users to perform tasks such as staging files, committing changes, managing branches, and handling remote operations like pushing and pulling.
README
MCP Git Server
A Model Context Protocol (MCP) server that provides Git version control operations for Claude.
Features
- 📊 Repository Status: Check git status and working tree state
- 🔍 View Changes: Show diffs for staged and unstaged changes
- ➕ Stage Files: Add files to the staging area
- 💾 Commit Changes: Create commits with messages
- 🌿 Branch Operations: List, create, switch, and delete branches
- 📜 View History: Show commit logs
- ⬆️ Push Changes: Push commits to remote repositories
- ⬇️ Pull Changes: Pull updates from remote repositories
- 📦 Clone Repositories: Clone remote repositories
- 🚀 Initialize Repos: Create new git repositories
Installation
-
Prerequisites:
- Node.js 18+ installed
- Git installed and configured
-
Install the MCP server:
cd /Users/bard/Code/mcp-git npm install -
Add to Claude Desktop config: Edit
~/Library/Application Support/Claude/claude_desktop_config.json:{ "mcpServers": { "git": { "command": "node", "args": ["/Users/bard/Code/mcp-git/src/index.js"] } } } -
Restart Claude Desktop
Usage
Check Repository Status
git_status({ path: "/path/to/repo" })
git_status({ short: true }) // Short format
View Changes
git_diff() // Unstaged changes
git_diff({ staged: true }) // Staged changes
git_diff({ file: "README.md" }) // Specific file
Stage Files
git_add({ files: ["README.md", "src/index.js"] })
git_add({ files: ["."] }) // Stage all changes
Commit Changes
git_commit({ message: "Add new feature" })
Branch Operations
git_branch() // List branches
git_branch({ action: "create", name: "feature/new-feature" })
git_branch({ action: "switch", name: "main" })
git_branch({ action: "delete", name: "old-branch" })
View Commit History
git_log() // Last 10 commits, one-line format
git_log({ limit: 20, oneline: false }) // Detailed format
Push and Pull
git_push() // Push current branch to origin
git_push({ branch: "main", force: true }) // Force push specific branch
git_pull() // Pull current branch from origin
git_pull({ remote: "upstream", branch: "main" })
Clone Repository
git_clone({ url: "https://github.com/user/repo.git" })
git_clone({ url: "git@github.com:user/repo.git", path: "my-repo" })
Initialize Repository
git_init({ path: "/path/to/new/repo" })
git_init({ bare: true }) // Create bare repository
Tool Reference
| Tool | Description | Required Args |
|---|---|---|
git_status |
Show repository status | None |
git_diff |
Show changes | None |
git_add |
Stage files | files |
git_commit |
Create commit | message |
git_branch |
Manage branches | None |
git_log |
Show commit history | None |
git_push |
Push to remote | None |
git_pull |
Pull from remote | None |
git_clone |
Clone repository | url |
git_init |
Initialize repository | None |
Error Handling
The server provides detailed error messages for common issues:
- Repository not found
- Uncommitted changes
- Merge conflicts
- Authentication failures
- Network issues
Development
Testing the server:
# Run directly
node src/index.js
# Test with sample commands
echo '{"jsonrpc": "2.0", "method": "tools/list", "id": 1}' | node src/index.js
Common Issues
- "Not a git repository": Ensure you're in a git repository or provide the
pathparameter - Authentication errors: Configure git credentials or SSH keys
- Push/pull failures: Check network connection and remote repository access
License
MIT
Recommended Servers
playwright-mcp
A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.
Magic Component Platform (MCP)
An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.
Audiense Insights MCP Server
Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.
VeyraX MCP
Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.
graphlit-mcp-server
The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.
Kagi MCP Server
An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.
E2B
Using MCP to run code via e2b.
Neon Database
MCP server for interacting with Neon Management API and databases
Exa Search
A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.
Qdrant Server
This repository is an example of how to create a MCP server for Qdrant, a vector search engine.