git-mcp-server — Claude Code MCP server: what it does, how to install
Exposes 28 Git tools to AI agents, covering branching, commits, worktrees, and changelog analysis. Useful when delegating repository workflows directly to models.
claude mcp add --env MCP_LOG_LEVEL=<MCP_LOG_LEVEL> --env GIT_BASE_DIR=<GIT_BASE_DIR> --env MCP_HTTP_HOST=<MCP_HTTP_HOST> --env MCP_HTTP_PORT=<MCP_HTTP_PORT> --env MCP_HTTP_ENDPOINT_PATH=<MCP_HTTP_ENDPOINT_PATH> --transport stdio git-mcp-server -- npx -y @cyanheads/git-mcp-serverWhat git-mcp-server does
The server equips coding agents with 28 Git tools. It handles staging, commits, branch creation, merges, and cherry-picking. For repository history, it provides git_blame, reflogs, and an inspection utility named git_changelog_analyze. That tool extracts commit diffs for release summaries.
Beyond file tracking, it includes a session resource at git://working-directory and a workflow prompt called Git Wrap-up. This protocol helps models review, record, and tag updates before closing a task. Connection happens over stdio or Streamable HTTP.
You need Node.js 20.0.0 or Bun 1.2.0 at minimum. Runtime is detected automatically. Without configuring GIT_USERNAME and GIT_EMAIL in the environment block, commit generation will fail.
What it helps with
- Stage files, generate commits, and push changes from prompts
- Trace code authorship with
git_blamewithout leaving the chat - Prepare commit context for automated changelog generation
- Switch branches and isolate parallel experiments using worktrees
Example prompts for the agent
- Commit all staged modifications with the message "fix: handle edge cases"
- Show recent commit history using
git_logand explain the last patch - Run
git_changelog_analyzeto summarize changes since the previous tag
How to install git-mcp-server
Platform CLI
claude mcp add --env MCP_LOG_LEVEL=<MCP_LOG_LEVEL> --env GIT_BASE_DIR=<GIT_BASE_DIR> --env MCP_HTTP_HOST=<MCP_HTTP_HOST> --env MCP_HTTP_PORT=<MCP_HTTP_PORT> --env MCP_HTTP_ENDPOINT_PATH=<MCP_HTTP_ENDPOINT_PATH> --transport stdio git-mcp-server -- npx -y @cyanheads/git-mcp-serverReplace <…> with your own values. 1 more environment variable is in the server README
Platform CLI
codex mcp add git-mcp-server --env MCP_LOG_LEVEL=<MCP_LOG_LEVEL> --env GIT_BASE_DIR=<GIT_BASE_DIR> --env MCP_HTTP_HOST=<MCP_HTTP_HOST> --env MCP_HTTP_PORT=<MCP_HTTP_PORT> --env MCP_HTTP_ENDPOINT_PATH=<MCP_HTTP_ENDPOINT_PATH> -- npx -y @cyanheads/git-mcp-serverReplace <…> with your own values. 1 more environment variable is in the server README
Config file
{
"mcpServers": {
"git-mcp-server": {
"command": "npx",
"args": [
"-y",
"@cyanheads/git-mcp-server"
],
"env": {
"MCP_LOG_LEVEL": "<MCP_LOG_LEVEL>",
"GIT_BASE_DIR": "<GIT_BASE_DIR>",
"MCP_HTTP_HOST": "<MCP_HTTP_HOST>",
"MCP_HTTP_PORT": "<MCP_HTTP_PORT>",
"MCP_HTTP_ENDPOINT_PATH": "<MCP_HTTP_ENDPOINT_PATH>"
}
}
}
}Replace <…> with your own values. 1 more environment variable is in the server README
Config file
{
"servers": {
"git-mcp-server": {
"type": "stdio",
"command": "npx",
"args": [
"-y",
"@cyanheads/git-mcp-server"
],
"env": {
"MCP_LOG_LEVEL": "<MCP_LOG_LEVEL>",
"GIT_BASE_DIR": "<GIT_BASE_DIR>",
"MCP_HTTP_HOST": "<MCP_HTTP_HOST>",
"MCP_HTTP_PORT": "<MCP_HTTP_PORT>",
"MCP_HTTP_ENDPOINT_PATH": "<MCP_HTTP_ENDPOINT_PATH>"
}
}
}
}Replace <…> with your own values. 1 more environment variable is in the server README
Platform CLI
gemini mcp add -e MCP_LOG_LEVEL=<MCP_LOG_LEVEL> -e GIT_BASE_DIR=<GIT_BASE_DIR> -e MCP_HTTP_HOST=<MCP_HTTP_HOST> -e MCP_HTTP_PORT=<MCP_HTTP_PORT> -e MCP_HTTP_ENDPOINT_PATH=<MCP_HTTP_ENDPOINT_PATH> git-mcp-server npx -y @cyanheads/git-mcp-serverReplace <…> with your own values. 1 more environment variable is in the server README
Step by step, with commands for each platform: How to add an MCP server to Claude Code, Codex, Cursor, VS Code, Gemini CLI and more
Questions about git-mcp-server
How do I install git-mcp-server in Claude Code?
Run claude mcp add git-mcp-server -- npx -y @cyanheads/git-mcp-server in your terminal.
What does git-mcp-server do?
It connects 28 Git commands to your coding assistant, covering commits, diffs, branch merges, remote synchronization, and worktree directories.
Which runtime and transport options are supported?
It runs on Node.js (version 20.0.0 or newer) and Bun (version 1.2.0 or newer), communicating via stdio or Streamable HTTP on a designated port.