Get the FREE Ultimate OpenClaw Setup Guide →

git

A Model Context Protocol (MCP) server providing comprehensive Git operations for Claude Code and other MCP clients

Installation
Run this command in your terminal to add the MCP server to Claude Code.
Run in terminal:
Command
claude mcp add --transport stdio danyelkirsch-git-mcp-server npx -y git-mcp-server

How to use

This MCP server exposes Git operations to MCP clients (for example Claude Desktop) by automatically contextually operating on the Git repository in your current working directory. It provides a range of commands for repository inspection and manipulation, including status, branch listing and switching, diffs, logs, viewing file contents at specific commits, staging, committing, and remote interactions like pull and fetch. The server is designed to work across multiple projects, detecting the appropriate repository based on where you run the commands from, and routing requests accordingly. Once running, you can issue high-level Git operations through your MCP client and the server will translate them into the underlying Git commands while returning MCP-friendly results and error messages.

How to install

Prerequisites:

  • Node.js 18+ (LTS recommended)
  • npm or yarn
  • Git installed on your system

Option 1: Global Installation (Recommended)

npm install -g git-mcp-server

Option 2: Local Development Setup

  1. Clone and install:
git clone https://github.com/yourusername/git-mcp-server.git
cd git-mcp-server
npm install
  1. Build the project (if using TypeScript sources):
npm run build

Start the server (after installation):

git-mcp-server

Additional notes

Tips and notes:

  • The server auto-detects the Git repository based on your current working directory. Ensure you run the server from within a Git-enabled project or configure your MCP client to target the correct server instance.
  • If you encounter permission or path issues on macOS or Linux, ensure the global npm bin directory is in your PATH.
  • The server supports multiple projects by analyzing the current directory; if you need explicit control, start separate server instances pointing at different working directories.
  • When integrating with Claude Desktop or other MCP clients, ensure the client configuration points to the appropriate command (git-mcp-server) and that any required environment variables are set if you extend functionality (no mandatory env vars are required for the default setup).
  • For troubleshooting, try running the server in a repository directory and test basic commands like status, branches, and diff via your MCP client to confirm responses are returned in MCP-compatible formats.

Related MCP Servers

Sponsor this space

Reach thousands of developers