Git MCP
MCP server giving AI coding agents full Git workflow access with safety defaults
- Pricing
- Open source
- Platforms
- CLI, vscode, self-hosted
- Runs
- Locally
- Version
- 0.4.2
- Listing updated
- today
Similar MCP servers
About Git MCP
Git MCP is an open-source MCP server for developer tools. It runs locally on your machine and is started by your AI client.
The README says git-mcp exposes a broad Git surface to MCP clients, grouped into about 18 root tools covering status, history, commits, branches, remotes, stash, rebase, bisect, worktrees, submodules, LFS and git-flow. Each root tool selects an operation through an action parameter, so an agent can inspect a repository before it changes anything.
Mutating behaviour is gated by configuration. Force push, hook bypass and git-flow hook execution are off until their environment variables are set, and reset and history-rewrite actions require an explicit confirm flag. Commit and tag signing with GPG or SSH keys can be enabled server-wide. Paths are checked against the repository root, and the project is built on the simple-git library.
It is aimed at people who run coding agents such as Copilot, Claude Code, Cursor or Codex against their repositories and want structured Git operations rather than raw shell commands. It also adds pull request creation and merging across GitHub, GitLab, Forgejo, Gitea and Bitbucket, and repository analytics computed from local history.
Install
Run in a terminal
claude mcp add git-mcp --env GIT_SIGNING_KEY='<GIT_SIGNING_KEY>' -- npx -y @selfagency/git-mcpAdd to claude_desktop_config.json
{
"mcpServers": {
"git-mcp": {
"command": "npx",
"args": [
"-y",
"@selfagency/git-mcp"
],
"env": {
"GIT_SIGNING_KEY": "<GIT_SIGNING_KEY>"
}
}
}
}Add to ~/.cursor/mcp.json
{
"mcpServers": {
"git-mcp": {
"command": "npx",
"args": [
"-y",
"@selfagency/git-mcp"
],
"env": {
"GIT_SIGNING_KEY": "<GIT_SIGNING_KEY>"
}
}
}
}Add to .vscode/mcp.json
{
"servers": {
"git-mcp": {
"type": "stdio",
"command": "npx",
"args": [
"-y",
"@selfagency/git-mcp"
],
"env": {
"GIT_SIGNING_KEY": "<GIT_SIGNING_KEY>"
}
}
}
}Add to ~/.codeium/windsurf/mcp_config.json
{
"mcpServers": {
"git-mcp": {
"command": "npx",
"args": [
"-y",
"@selfagency/git-mcp"
],
"env": {
"GIT_SIGNING_KEY": "<GIT_SIGNING_KEY>"
}
}
}
}Add to your client's MCP settings (most use this shape)
{
"mcpServers": {
"git-mcp": {
"command": "npx",
"args": [
"-y",
"@selfagency/git-mcp"
],
"env": {
"GIT_SIGNING_KEY": "<GIT_SIGNING_KEY>"
}
}
}
}Using several servers? Build one config file with the MCP config generator.
Configuration
GIT_REPO_PATHDefault repository path for all tool requests. Can also be set via the --repo / --repo-path CLI argument. If omitted, each tool call must supply repo_path explicitly.GIT_ALLOW_NO_VERIFYSet to 'true' to expose a no_verify parameter on commit and push tools, passing --no-verify to Git and bypassing pre-commit / pre-push hooks.GIT_ALLOW_FORCE_PUSHSet to 'true' to expose a force parameter on push tools. Remote branch protection rules (GitHub/GitLab) are still enforced server-side regardless.GIT_ALLOW_FLOW_HOOKSSet to 'true' to allow git_flow to execute git-flow-next-compatible hook and filter programs discovered from git config or repository hook locations.GIT_SIGNING_KEYDefault signing key: a GPG key ID, an SSH public key path, or empty to use git's configured user.signingkey. Used when GIT_AUTO_SIGN_COMMITS or GIT_AUTO_SIGN_TAGS is enabled.GIT_SIGNING_FORMATSigning format for commits and tags. Accepted values: openpgp, ssh, x509.GIT_AUTO_SIGN_COMMITSSet to 'true' to automatically sign all commits produced by this server.GIT_AUTO_SIGN_TAGSSet to 'true' to automatically sign all tags produced by this server.
What it does
- Broad Git workflow coverage
- Exposes status, history, commits, branches, remotes, workspace operations and LFS through grouped tools with many actions.
- Safety defaults
- Force push, hook bypass and git-flow hooks stay disabled until enabled, and destructive resets need explicit confirmation.
- Commit and tag signing
- Supports GPG and SSH signing with optional automatic signing for commits and tags.
- Git Flow support
- Drives the git-flow-next CLI for initialisation, topic branches, configuration and finish operations.
- Pull request actions
- Creates, lists and merges pull or merge requests via provider CLIs or REST tokens.
- Repository analytics and history rewrite
- Reports contributors, file churn and activity, and offers reword, squash and backup/restore for history edits.
Good for
- Letting a coding agent inspect working tree state and recent history before proposing changes
- Creating feature branches, committing and opening a pull request from an agent session
- Recovering from a bad reset or rebase using reflog and backup branches
- Managing worktrees and submodules for parallel work on one repository
- Running git-flow release or hotfix workflows through an assistant
Pricing
Open source
Free and MIT licensed, self-hosted via npm.
More servers for the same service
Git MCP FAQ
How is the server installed?
The README shows running it with npx @selfagency/git-mcp and a --repo-path argument, or installing it globally with npm. Example configs are given for Claude Desktop and VS Code.
Are force pushes allowed by default?
No. Force push is disabled unless GIT_ALLOW_FORCE_PUSH is set to true, while force_with_lease is always available.
Which clients does it work with?
The README names GitHub Copilot, Claude Code, Cursor and OpenAI Codex, and says it should work with any MCP client that can call tools and resources.
Does it need git-flow installed?
Only for the git_flow tool, which requires the git-flow-next CLI on PATH or a GIT_FLOW_BINARY override. Other tools use git directly.
Is Git MCP free?
Yes. Git MCP is open source, so you can use and self-host it for free.
How do I add Git MCP to Claude Code?
Run this command in your terminal: claude mcp add git-mcp --env GIT_SIGNING_KEY='<GIT_SIGNING_KEY>' -- npx -y @selfagency/git-mcp
What are the best alternatives to Git MCP?
The closest alternatives to Git MCP are GitEasy MCP, GitHub, Agentic MCP, Fluxgit MCP Server and Advanced GitLab MCP server.
Where this comes from
- Description: written from the project's README and its MCP Registry entry.
- Install steps: from the official MCP Registry entry.
