by geropl
Provides a set of tools that enable Large Language Models to read, search, and manipulate Git repositories, supporting both read‑only and write operations through a Model Context Protocol server written in Go.
Git Mcp Server is a Model Context Protocol (MCP) server that exposes common Git commands as callable tools for AI assistants. It can monitor one or multiple repositories, execute operations via the native Git CLI or the pure‑Go go-git
library, and optionally allow write‑access for actions such as git push
.
go build -o git-mcp-go .
) or download a pre‑built binary from the GitHub Releases page.serve
sub‑command, specifying repository paths with -r/--repository
or as positional arguments. Example:
./git-mcp-go serve -v -r=/path/to/repo1,/path/to/repo2 --mode shell
Add --write-access
to enable remote‑modifying tools like git_push
.setup
sub‑command; it copies the binary to the assistant’s MCP directory and creates a registration script. Example:
./git-mcp-go setup -r=/path/to/repo1,/path/to/repo2 --auto-approve=allow-read-only
git_status
, git_diff
, git_commit
, etc., passing optional repo_path
when multiple repositories are configured.shell
(default) – runs native Git commands.go-git
– uses the Go library for faster, dependency‑free operations where possible.--write-access
flag required for any operation that changes remote state.git_diff
and git_log
to summarize changes.git_add
, git_commit
, and git_push
without manual CLI interaction.shell
mode relies on the Git CLI; the go-git
mode only requires Go libraries.repo_path
, the first repository in the list is used as the default.shell
offers full Git compatibility; go-git
is faster and avoids external dependencies but may lack some edge‑case features.--auto-approve=allow-read-only
, allow-local-only
, or provide a comma‑separated list of tool names.A Model Context Protocol (MCP) server for Git repository interaction and automation, written in Go. This server provides tools to read, search, and manipulate Git repositories via Large Language Models.
This MCP server provides the following Git operations as tools:
--write-access
flag)You can download prebuilt binaries for your platform from the GitHub Releases page.
# Clone the repository
git clone https://github.com/geropl/git-mcp-go.git
cd git-mcp-go
# Build the server
go build -o git-mcp-go .
go install
go install github.com/geropl/git-mcp-go@latest
The Git MCP Server uses a command-line structure with subcommands:
git-mcp-go
├── serve [flags] [repository-paths...]
│ ├── --repository, -r <paths> # Repository paths (multiple ways to specify)
│ ├── --mode <shell|go-git>
│ ├── --write-access
│ └── --verbose, -v
└── setup [flags] [repository-paths...]
├── --repository, -r <paths> # Repository paths (multiple ways to specify)
├── --mode <shell|go-git>
├── --write-access
├── --auto-approve <tool-list|allow-read-only|allow-local-only>
└── --tool <cline,roo-code>
The Git MCP Server can now monitor and operate on multiple repositories simultaneously. You can specify repositories in several ways:
-r/--repository
flag:
-r=/path/to/repo1,/path/to/repo2
-r=/path/to/repo1 -r=/path/to/repo2
serve /path/to/repo1 /path/to/repo2
When using multiple repositories, the server will default to the first repository for operations where a specific repository is not specified.
serve
CommandThe serve
command starts the Git MCP server:
# Run with verbose logging
./git-mcp-go serve -v /path/to/repo1 /path/to/repo2 /path/to/repo3
# Run with go-git implementation
./git-mcp-go serve --mode go-git -r=/path/to/repo1,/path/to/repo2
# Enable write access for remote operations
./git-mcp-go serve -r=/path/to/repo1,/path/to/repo2 --write-access
The --mode
flag allows you to choose between two different implementations:
The --write-access
flag enables operations that modify remote state (currently only the push operation). By default, this is disabled for safety.
setup
CommandThe setup
command sets up the Git MCP server for use with an AI assistant. It copies itself to ~/mcp-servers/git-mcp-go
and modifies the tools config (cline: cline_mcp_settings.json
) to use that binary.
# Set up for Cline with a single repository
./git-mcp-go setup -r /path/to/git/repository
# Set up with repositories as arguments
./git-mcp-go setup /path/to/repo1 /path/to/repo2 /path/to/repo3
# Set up with write access enabled
./git-mcp-go setup -r=/path/to/repo1,/path/to/repo2 --write-access
# Set up with auto-approval for read-only tools
./git-mcp-go setup -r=/path/to/repo1,/path/to/repo2 --auto-approve=allow-read-only
# Set up with specific tools auto-approved
./git-mcp-go setup -r=/path/to/repo1,/path/to/repo2 --auto-approve=git_status,git_log
# Set up with write access and auto-approval for read-only tools
./git-mcp-go setup -r=/path/to/repo1,/path/to/repo2 --write-access --auto-approve=allow-read-only
The --auto-approve
flag allows you to specify which tools should be auto-approved (not require explicit user approval):
git_list_repositories
ToolThis tool lists all available Git repositories that the server is monitoring. It shows:
Example output:
Available repositories (3):
1. repo1 (/path/to/repo1)
2. repo2 (/path/to/repo2)
3. another-project (/path/to/another-project)
When running commands that require a repository path:
repo_path
is provided in the command, it will be used.repo_path
is provided and multiple repositories are configured, the first repository will be used as the default.The easiest way to install and register the Git MCP server with Cline is to use the setup command:
# Download linux binary for the latest release
RELEASE="$(curl -s https://api.github.com/repos/geropl/git-mcp-go/releases/latest)"
DOWNLOAD_URL="$(echo $RELEASE | jq -r '.assets[] | select(.name | contains("linux-amd64")) | .browser_download_url')"
curl -L -o ./git-mcp-go $DOWNLOAD_URL
chmod +x ./git-mcp-go
# Setup the mcp server with a single repository
./git-mcp-go setup -r /path/to/git/repository --tool=cline --auto-approve=allow-local-only
# Setup the mcp server with multiple repositories
./git-mcp-go setup -r=/path/to/repo1,/path/to/repo2 --tool=cline --auto-approve=allow-local-only
rm -f ./git-mcp-go
The setup command will:
Alternatively, you can manually add this to your claude_desktop_config.json
:
"mcpServers": {
"git": {
"command": "/path/to/git-mcp-go",
"args": ["serve", "-r=/path/to/repo1,/path/to/repo2", "--mode", "shell"]
}
}
"mcpServers": {
"git": {
"command": "/path/to/git-mcp-go",
"args": ["serve", "-r", "/path/to/git/repository"]
}
}
This server is implemented using:
go-git
mode)For operations not supported by go-git, the server falls back to using the Git CLI.
The server includes comprehensive tests for all Git operations. The tests are designed to run against both implementation modes:
# Run all tests
go test ./pkg -v
# Run specific tests
go test ./pkg -v -run TestGitOperations/push
The test suite creates temporary repositories for each test case and verifies that the operations work correctly in both modes.
This project uses GitHub Actions for continuous integration and deployment:
v*
is pushedTo create a new release:
# 1. Update the version in pkg/server.go (line ~26)
# Edit the version string in NewGitServer function
# 2. Commit the version change
git add pkg/server.go
git commit -m "Bump version to v1.3.1"
# 3. Push the commit
git push origin main
# 4. Tag the current commit
git tag v1.3.1
# 5. Push the tag to GitHub (this triggers the release)
git push origin v1.3.1
This project is licensed under the MIT License.
Please log in to share your review and rating for this MCP.
Explore related MCPs that share similar capabilities and solve comparable challenges
by zed-industries
A high‑performance, multiplayer code editor designed for speed and collaboration.
by modelcontextprotocol
Model Context Protocol Servers
by modelcontextprotocol
A Model Context Protocol server for Git repository interaction and automation.
by modelcontextprotocol
A Model Context Protocol server that provides time and timezone conversion capabilities.
by cline
An autonomous coding assistant that can create and edit files, execute terminal commands, and interact with a browser directly from your IDE, operating step‑by‑step with explicit user permission.
by continuedev
Enables faster shipping of code by integrating continuous AI agents across IDEs, terminals, and CI pipelines, offering chat, edit, autocomplete, and customizable agent workflows.
by upstash
Provides up-to-date, version‑specific library documentation and code examples directly inside LLM prompts, eliminating outdated information and hallucinated APIs.
by github
Connects AI tools directly to GitHub, enabling natural‑language interactions for repository browsing, issue and pull‑request management, CI/CD monitoring, code‑security analysis, and team collaboration.
by daytonaio
Provides a secure, elastic infrastructure that creates isolated sandboxes for running AI‑generated code with sub‑90 ms startup, unlimited persistence, and OCI/Docker compatibility.