A Model Context Protocol server that provides comprehensive Git functionality to Large Language Models, enabling them to perform version control operations through a secure and standardized interface.
The Git MCP Server implements the Model Context Protocol (MCP), created by Anthropic, which provides a standardized communication protocol between LLMs and external systems. The architecture consists of:
This architecture creates a secure boundary between LLMs and external systems while enabling controlled access to Git functionality. Through the MCP protocol, the Git server empowers LLMs to perform version control operations, manage repositories, and handle complex Git workflows — all within a secure and validated environment.
git clone https://github.com/cyanheads/git-mcp-server.git
cd git-mcp-server
npm install
npm run build
The server is now ready to be configured and used with your MCP client.
The Git MCP Server requires configuration in your MCP client settings:
{
"mcpServers": {
"git": {
"command": "node",
"args": ["/path/to/git-mcp-server/build/index.js"],
"env": {
"GIT_DEFAULT_PATH": "/optional/default/path/for/git/operations"
}
}
}
}
Variable | Description | Required |
---|---|---|
GIT_DEFAULT_PATH | Default path for Git operations | No |
All paths must be absolute. For example:
/Users/username/projects/my-repo
/Users/username/projects/my-repo/src/file.js
Initializes a new Git repository.
{
"path": string // Path to initialize
}
Clones a repository.
{
"url": string, // Repository URL (required)
"path": string // Clone destination
}
Gets repository status.
{
"path": string // Repository path
}
Executes multiple Git operations in sequence. This is the preferred way to execute multiple operations.
{
"path": string, // Repository path
"actions": [ // Array of operations to execute
{
"type": "stage",
"files": string[] // Optional - if omitted, stages all changes
},
{
"type": "commit",
"message": string
},
{
"type": "push",
"branch": string,
"remote": string // Optional - defaults to "origin"
}
]
}
Manage branches and working tree.
Manage repository tags.
Manage remote repositories.
Manage working directory changes.
# Build the project
npm run build
# Watch for changes
npm run watch
# Run MCP inspector
npm run inspector
The server provides detailed error information:
I welcome contributions! Please follow these steps:
For bugs and feature requests, please create an issue.
Apache License 2.0
Seamless access to top MCP servers powering the future of AI integration.