Provides comprehensive Git version control operations, enabling users to manage repositories, track changes, stage files, commit updates, and perform branch, push, pull, and clone operations.
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., "@MCP Git Servershow me the status of the repository and the last 5 commits"
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.
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 installAdd 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 formatView Changes
git_diff() // Unstaged changes
git_diff({ staged: true }) // Staged changes
git_diff({ file: "README.md" }) // Specific fileStage Files
git_add({ files: ["README.md", "src/index.js"] })
git_add({ files: ["."] }) // Stage all changesCommit 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 formatPush 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 repositoryTool Reference
Tool | Description | Required Args |
| Show repository status | None |
| Show changes | None |
| Stage files |
|
| Create commit |
|
| Manage branches | None |
| Show commit history | None |
| Push to remote | None |
| Pull from remote | None |
| Clone repository |
|
| 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.jsCommon Issues
"Not a git repository": Ensure you're in a git repository or provide the
pathparameterAuthentication errors: Configure git credentials or SSH keys
Push/pull failures: Check network connection and remote repository access
License
MIT
This server cannot be installed
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.