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.
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:
- Ensure Node.js or Bun is installed on your system
- Node.js: install from https://nodejs.org/
- Bun: install from https://bun.sh/
- 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
- 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
- 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
mcp-graphql
Model Context Protocol server for GraphQL
Remote
A type-safe solution to remote MCP communication, enabling effortless integration for centralized management of Model Context.
mcp -odoo
A Model Context Protocol (MCP) server that enables AI assistants to securely interact with Odoo ERP systems through standardized resources and tools for data retrieval and manipulation.
mcp-ts-template
TypeScript template for building Model Context Protocol (MCP) servers. Ships with declarative tools/resources, pluggable auth, multi-backend storage, OpenTelemetry observability, and first-class support for both local and edge (Cloudflare Workers) runtimes.
ContextPods
Model Context Protocol management suite/factory. An MCP that can generate and manage other local MCPs in multiple languages. Uses the official SDKs for code gen.
mcp-chain-of-draft
Chain of Draft Server is a powerful AI-driven tool that helps developers make better decisions through systematic, iterative refinement of thoughts and designs. It integrates seamlessly with popular AI agents and provides a structured approach to reasoning, API design, architecture decisions, code reviews, and implementation planning.