Git

v2.15.1Version Controlstable

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 managem

aienterprise-readygitgit-servergit-tools
Share:
217
Stars
0
Downloads
0
Weekly
0/5

What is Git?

Git is a Model Context Protocol (MCP) server that allows AI assistants like Claude, Cursor, and VS Code to 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, p...

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 managem

This server falls under the Version Control category on MCPgee, the world's largest MCP server directory with 33,000+ servers.

Features

  • git_status
  • git_diff_unstaged
  • git_diff_staged
  • git_diff
  • git_commit

Use Cases

Clone, commit, and manage repositories
Execute git operations with AI
Automate version control workflows
cyanheads

Maintainer

LicenseApache 2.0
Languagetypescript
Versionv2.15.1
UpdatedMay 19, 2026
Statushealthy
Maintenanceactive

Works with

ClaudeOpenAIwindowsmacoslinux

Installation

NPM

npx -y @cyanheads/git-mcp-server

Manual Installation

npx -y @cyanheads/git-mcp-server

Configuration

Configuration Details

Config File

claude_desktop_config.json

Performance

Response Metrics

Response Time< 200ms
ThroughputMedium

Resource Usage

Memory UsageLow
CPU UsageLow

How to Set Up and Use Git

@cyanheads/git-mcp-server is a comprehensive Git integration for AI agents and LLMs, exposing 28 Git tools through the Model Context Protocol. It covers the full Git workflow: initializing and cloning repositories, staging and committing changes, branching, merging, rebasing, cherry-picking, remote operations (push/pull/fetch), tagging, stashing, worktree management, and a changelog analysis tool. It is designed for enterprise use cases where AI agents need reliable, auditable, and configurable access to version control without shell injection risks.

Prerequisites

  • Node.js 18+ or Bun runtime
  • Git installed and accessible in system PATH
  • An MCP-compatible client such as Claude Desktop, Cursor, or VS Code
  • Optional: GIT_USERNAME and GIT_EMAIL env vars for commit author attribution
1

Install and run via npx (no installation required)

The server can be run directly using npx without a global install. This is the recommended approach for most users.

npx -y @cyanheads/git-mcp-server@latest
2

Configure the MCP client

Add the server to your MCP client configuration file. The server runs as a stdio process launched by npx.

{
  "mcpServers": {
    "git": {
      "command": "npx",
      "args": ["-y", "@cyanheads/git-mcp-server@latest"],
      "env": {
        "GIT_USERNAME": "Your Name",
        "GIT_EMAIL": "[email protected]",
        "GIT_BASE_DIR": "/path/to/allowed/repos"
      }
    }
  }
}
3

Set environment variables for author attribution

Configure the author identity used for commits. GIT_BASE_DIR restricts which directories the server can access, which is recommended for security.

export GIT_USERNAME="Your Name"
export GIT_EMAIL="[email protected]"
export GIT_BASE_DIR="/home/user/projects"
4

Set a working directory using git_set_working_dir

After connecting, tell the server which repository to operate on by calling the git_set_working_dir tool with the path to your repository. This persists for the session.

5

Configure transport and logging (optional)

For HTTP transport or verbose logging, set the additional environment variables. The default transport is stdio which works for all standard MCP clients.

export MCP_TRANSPORT_TYPE=stdio
export MCP_LOG_LEVEL=info

Git Examples

Client configuration

Claude Desktop config with author attribution and a restricted base directory for security.

{
  "mcpServers": {
    "git": {
      "command": "npx",
      "args": ["-y", "@cyanheads/git-mcp-server@latest"],
      "env": {
        "GIT_USERNAME": "Your Name",
        "GIT_EMAIL": "[email protected]",
        "GIT_BASE_DIR": "/Users/yourname/projects",
        "MCP_LOG_LEVEL": "info"
      }
    }
  }
}

Prompts to try

These prompts work once the server is connected and git_set_working_dir has been called with a valid repo path.

- "Show me the git status and a diff of all unstaged changes in this repository"
- "Create a new branch called feature/auth and switch to it"
- "Stage all modified files and commit with the message 'fix: resolve authentication timeout'"
- "Generate a changelog from the last 20 commits and summarize what changed"
- "Rebase the current branch onto main and resolve any conflicts"
- "List all stashes and apply the most recent one"

Troubleshooting Git

Server refuses to access a repository with 'outside base directory' error

The GIT_BASE_DIR env var restricts accessible paths. Either set GIT_BASE_DIR to a parent directory that includes your repo, or remove the variable entirely to allow unrestricted access (not recommended in shared environments).

Commits succeed but show wrong author name or email

Set GIT_USERNAME and GIT_EMAIL in the env block of your MCP client config. These override the values in the system .gitconfig for commits made through the MCP server.

git_push fails with authentication error for remote repositories

The server uses the Git credential store already configured on your system. Run 'git push' manually once in the repository to cache credentials via your OS keychain or credential helper, then retry through MCP.

Frequently Asked Questions about Git

What is Git?

Git is a Model Context Protocol (MCP) server that 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 managem It connects AI assistants to external tools and data sources through a standardized interface.

How do I install Git?

Install via npm with the command: npx -y @cyanheads/git-mcp-server. Then add the server configuration to your AI client's JSON config file (e.g., claude_desktop_config.json or .cursor/mcp.json).

Which AI clients work with Git?

Git works with all major MCP-compatible AI clients including Claude Desktop, Claude Code, Cursor, VS Code (GitHub Copilot), Windsurf, and Cline.

Is Git free to use?

Yes, Git is open source and available under the Apache 2.0 license. You can use it freely in both personal and commercial projects.

Browse More Version Control MCP Servers

Explore all version control servers available in the MCPgee directory. Each server includes setup guides for Claude, Cursor, and VS Code.

Quick Config Preview

{ "mcpServers": { "git": { "command": "npx", "args": ["-y", "@cyanheads/git-mcp-server"] } } }

Add this to your claude_desktop_config.json or .cursor/mcp.json

Read the full setup guide →

Ready to use Git?

Browse our complete directory of 33,000+ MCP servers, read setup guides for your editor, and start building with the Model Context Protocol.

33,000+ ServersFree & Open SourceStep-by-Step Guides