# Git MCP — Version Control Server for AI Agents > MCP server that gives AI agents full Git capabilities. Git MCP enables Claude Code and Cursor to manage repositories, branches, commits, diffs, and history via tool calls. ## Install Merge the JSON below into your `.mcp.json`: ## Quick Use ```json // claude_desktop_config.json or .cursor/mcp.json { "mcpServers": { "git": { "command": "uvx", "args": ["mcp-server-git", "--repository", "/path/to/repo"] } } } ``` ```bash # Or install directly pip install mcp-server-git mcp-server-git --repository /path/to/repo ``` Now ask your AI agent: ``` "Show me the git log for the last week" "What changed in the last 3 commits?" "Create a branch called feature/auth and commit the staged changes" ``` ## What is Git MCP? Git MCP is a Model Context Protocol server that gives AI agents structured access to Git repositories. Instead of running raw shell commands, agents use typed tools for git operations — log, diff, status, branch, commit, and more. It provides clean, parseable output that agents can reason about effectively. **Answer-Ready**: Git MCP is an MCP server for AI agent Git access. Provides typed tools for log, diff, status, branch, commit, and blame operations. Clean structured output for agent reasoning. Part of the official MCP server collection. Works with Claude Code and Cursor. **Best for**: AI agents needing structured Git repository access. **Works with**: Claude Code, Claude Desktop, Cursor, any MCP client. **Setup time**: Under 1 minute. ## Core Tools ### 1. git_status Get working tree status — staged, modified, untracked files. ### 2. git_log View commit history with filtering by author, date, path. ``` Agent: git_log(max_count=10, since="2026-04-01") → Returns structured commit objects with hash, author, date, message ``` ### 3. git_diff Show changes between commits, branches, or working tree. ``` Agent: git_diff(ref1="main", ref2="feature/auth") → Returns structured diff with file paths, additions, deletions ``` ### 4. git_show View contents of a specific commit. ### 5. git_branch List, create, delete, and switch branches. ### 6. git_commit Create commits with message and optional file selection. ### 7. git_blame Annotate file lines with commit information. ## Configuration Options ```json { "mcpServers": { "git": { "command": "uvx", "args": [ "mcp-server-git", "--repository", "/path/to/repo", "--read-only" ] } } } ``` | Flag | Purpose | |------|---------| | `--repository` | Path to git repo | | `--read-only` | Disable write operations | ## Use Cases | Use Case | Tools Used | |----------|-----------| | Code Review | git_log + git_diff + git_show | | Branch Management | git_branch + git_status | | History Analysis | git_log + git_blame | | Automated Commits | git_status + git_commit | ## FAQ **Q: Is it read-only by default?** A: No, it supports both read and write operations. Use `--read-only` flag to restrict to read-only if needed. **Q: Can it handle multiple repos?** A: Configure multiple Git MCP instances with different repository paths. **Q: How does it differ from Claude Code's built-in git?** A: Claude Code has built-in git access via Bash. Git MCP provides structured tool output that is easier for agents to parse and reason about. ## Source & Thanks > Part of the official [Model Context Protocol Servers](https://github.com/modelcontextprotocol/servers) collection. > > [modelcontextprotocol/servers/git](https://github.com/modelcontextprotocol/servers) — Official MCP server ## Quick Use ```json {"mcpServers": {"git": {"command": "uvx", "args": ["mcp-server-git", "--repository", "."]}}} ``` Let AI agents operate Git through MCP tool calls. ## What is Git MCP? An MCP server providing structured Git access for AI agents. Typed tools replace raw shell commands, with structured output that's easier to reason about. **TL;DR**: Git MCP server. AI agents operate log/diff/status/branch/commit/blame via tool calls. Structured output. Part of the official MCP servers collection. **Best for**: AI agent users who need structured Git access. ## Core Tools 1. git_status — Working tree status 2. git_log — Commit history 3. git_diff — Change comparison 4. git_branch — Branch management 5. git_commit — Create commits 6. git_blame — Line-level attribution ## FAQ **Q: Read-only by default?** A: No — it supports read/write. Use `--read-only` to restrict. ## Source & Thanks > [modelcontextprotocol/servers](https://github.com/modelcontextprotocol/servers) — Official MCP servers --- Source: https://tokrepo.com/en/workflows/git-mcp-version-control-server-ai-agents-85eacf96 Author: MCP Hub