Get the FREE Ultimate OpenClaw Setup Guide →

git

An MCP (Model Context Protocol) server enabling LLMs and AI agents to interact with Git repositories. Provides tools for comprehensive Git operations including clone, commit, branch, diff, log, status, push, pull, merge, rebase, worktree, tag management, and more, via the MCP standard. STDIO & HTTP.

Installation
Run this command in your terminal to add the MCP server to Claude Code.
Run in terminal:
Command
claude mcp add --transport stdio cyanheads-git-mcp-server npx @cyanheads/git-mcp-server@latest \
  --env LOGS_DIR="~/Developer/logs/git-mcp-server/" \
  --env GIT_EMAIL="casey@caseyjhand.com" \
  --env GIT_BASE_DIR="~/Developer/" \
  --env GIT_USERNAME="cyanheads" \
  --env MCP_LOG_LEVEL="info" \
  --env GIT_SIGN_COMMITS="true" \
  --env MCP_TRANSPORT_TYPE="stdio"

How to use

The cyanheads/git-mcp-server provides a collection of 28 Git-related tools that you can invoke via an MCP client. It wraps common Git operations into declarative, self-contained tools that can be orchestrated by an AI agent. Use the server to initialize repositories, manage branches, inspect history, perform safe destructive actions with explicit confirmations, and run advanced workflows like stashing, worktrees, and changelog analysis. Configure the server to run over stdio for local AI interaction or enable Streamable HTTP to send/receive commands over HTTP. The included prompts and session management help you guide AI agents through complete Git sessions—from setup to wrap-up and tagging releases. To start, point your MCP client at the git-mcp-server with the provided environment variables, ensuring that user identity (GIT_USERNAME and GIT_EMAIL) and optional signing are set as needed.

How to install

Prerequisites:

  • Node.js (recommended >= 20) or Bun (for Bun runtime)
  • Internet access to install the MCP server package

Installation steps:

  1. Ensure Node.js or Bun is installed on your system
  2. Start the MCP server using npx (Node.js) or bunx (Bun) as shown in the example configuration
    • For Node.js: npx @cyanheads/git-mcp-server@latest
    • For Bun: bunx @cyanheads/git-mcp-server@latest
  3. If you plan to use Streamable HTTP, configure MCP_TRANSPORT_TYPE to http and set MCP_HTTP_PORT (e.g., 3015) in your MCP client config
  4. Customize environment variables as needed for your Git identity and repository base paths

Example minimal start (stdio):

  • Prereqs: Node.js installed
  • Command: npx @cyanheads/git-mcp-server@latest
  • In your MCP client settings, set: { "mcpServers": { "git-mcp-server": { "type": "stdio", "command": "npx", "args": ["@cyanheads/git-mcp-server@latest"], "env": { "MCP_TRANSPORT_TYPE": "stdio", "MCP_LOG_LEVEL": "info", "GIT_BASE_DIR": "/Developer/", "LOGS_DIR": "/Developer/logs/git-mcp-server/", "GIT_USERNAME": "cyanheads", "GIT_EMAIL": "casey@caseyjhand.com", "GIT_SIGN_COMMITS": "true" } } } }

Notes:

  • The server auto-detects Bun vs Node.js at runtime when using the library runner; however, the provided config uses npx for Node.js environments.

Additional notes

Tips and common issues:

  • Ensure GIT_BASE_DIR exists and the process has permission to read/write in that directory.
  • If using signed commits, ensure GIT_SIGN_COMMITS is set to true and your environment has signing keys configured.
  • For multi-tenant setups, use GIT_BASE_DIR to sandbox operations per tenant.
  • When enabling Streamable HTTP, remember to set MCP_TRANSPORT_TYPE=http and expose an appropriate port (e.g., MCP_HTTP_PORT=3015) in the client configuration.
  • If you encounter command argument validation errors, verify that tool names (e.g., git_clone, git_commit) match the server's declared capabilities and that you’re using the correct MCP client schema.
  • Logs are written to LOGS_DIR; rotate or prune logs periodically to avoid disk growth.
  • The server supports authentication modes (none, jwt, oauth); configure as needed for secure deployments.

Related MCP Servers

Sponsor this space

Reach thousands of developers