Sponsored by Deepsite.site

Git MCP

Created By
The Self Agency LLC14 days ago
Exposes the full Git workflow to any MCP-compatible AI agent — inspect, write, branch, remote, stash, rebase, LFS, git-flow, documentation lookup, and more. Designed to be safe by default, composable, and fast.
Overview

git-mcp

CI codecov NPM Version

A Git MCP server that doesn't suck

Exposes the full Git workflow to any MCP-compatible AI agent — inspect, write, branch, remote, stash, rebase, LFS, git-flow, documentation lookup, and more. Designed to be safe by default, composable, and fast. Powered by simple-git.

Built for coding agents in tools like GitHub Copilot, Claude Code, Cursor, and OpenAI Codex, while remaining compatible with any MCP client that can call tools and resources.


Features

  • 11 grouped tools with 60+ actions covering everyday Git workflows and advanced recovery operations
  • Safety-first — destructive operations require explicit confirmation; force push and hook bypass are opt-in via server config
  • GPG/SSH signing for commits and tags, with server-level auto-sign support
  • Git LFS — track patterns, manage objects, install hooks, migrate history
  • Git Flow — git-flow-next-style workflow support with preset init, overview, config CRUD, generalized topic actions, finish recovery, optional hook/filter parity, and classic feature/release/hotfix/support aliases, without requiring the external CLI
  • Documentation lookup — search git-scm.com and fetch man pages directly from the LLM
  • MCP Resources — URI-addressable read-only views of status, log, branches, and diff
  • Bundled agent skillskills/git-mcp-workflow/ documents MCP-first Git workflows, recovery, worktrees, releases, and advanced operations for AI agents and coding agents; installable via skills-npm and skill.sh
  • Multi-repo — pass repo_path per-call or configure a server-level default
  • Cross-platform — macOS, Linux, Windows (Git for Windows)

Quick Start

npx (no install)

npx @selfagency/git-mcp --repo-path /path/to/your/repo

Install globally

npm install -g @selfagency/git-mcp
git-mcp --repo-path /path/to/your/repo

Claude Desktop

Add to ~/Library/Application Support/Claude/claude_desktop_config.json:

{
  "mcpServers": {
    "git": {
      "command": "npx",
      "args": ["-y", "@selfagency/git-mcp", "--repo-path", "/path/to/your/repo"]
    }
  }
}

VS Code (Copilot)

Add to .vscode/mcp.json in your project:

{
  "servers": {
    "git": {
      "command": "npx",
      "args": ["-y", "@selfagency/git-mcp", "--repo-path", "${workspaceFolder}"]
    }
  }
}

Configuration

All configuration is via environment variables. Pass them in your MCP client config:

VariableDefaultDescription
GIT_REPO_PATHDefault repository path (also: --repo-path CLI arg)
GIT_ALLOW_NO_VERIFYfalseAllow --no-verify on commit/push (bypasses hooks)
GIT_ALLOW_FORCE_PUSHfalseAllow --force on push
GIT_ALLOW_FLOW_HOOKSfalseAllow git_flow hooks and filters to execute
GIT_AUTO_SIGN_COMMITSfalseAutomatically sign every commit
GIT_AUTO_SIGN_TAGSfalseAutomatically sign every tag
GIT_SIGNING_KEYDefault GPG key ID or SSH key path
GIT_SIGNING_FORMATSigning format: openpgp, ssh, or x509

Tool Reference

Tools are grouped by domain. Each root tool takes an action parameter that selects the operation. Where an action is marked as default, omitting action will use it.

Context (git_context)

ActionDescription
summary(default) Full repo snapshot: branch, upstream, pending changes, in-progress operations
searchSearch commit history and working tree content
get_configRead a Git config value
set_configWrite a Git config value
aliasesList all configured git aliases

Status (git_status)

ActionDescription
status(default) Working tree and branch status
diffUnstaged, staged, or ref-to-ref diff
diff_mainChanges from branch divergence point vs main (or configurable base branch)

History (git_history)

ActionDescription
log(default) Commit log with filtering, pagination, revision ranges, and pathspecs
showInspect a single commit
blameLine-by-line attribution for a file
reflogFull reflog — the recovery ledger
lgCompact graph log (--oneline --graph --decorate --all)
whoContributor shortlog (supports optional file_path)

Commits (git_commits)

ActionDescription
addStage files or hunks
restoreDiscard working tree changes
unstageRemove files from the staging area
commitCreate a commit with message, signing, and author flags
amendAmend the last commit without editing the message
wipStage all changes and commit with message WIP
revertCreate a revert commit for a given ref
undoSoft-reset the last commit (reset --soft HEAD~1)
resetReset HEAD with configurable mode (soft/mixed/hard)
nukeHard-reset the last commit — requires confirm=true

Branches (git_branches)

ActionDescription
list(default) Local and remote branch listing
createCreate a branch
deleteDelete a branch
renameRename a branch
checkoutSwitch to a branch or ref
set_upstreamSet or update tracking upstream
recentRecent branches sorted by committer date

Remotes (git_remotes)

ActionDescription
list(default) List configured remotes
manageAdd, remove, or rename a remote
fetchFetch from a remote
pullPull (fetch + merge/rebase)
pushPush to a remote; force_with_lease supported

Workspace (git_workspace)

ActionDescription
stashStash and pop/apply/drop/list/show stash entries
stash_allStash tracked and untracked changes in one operation
rebaseStart, continue, abort, or skip a rebase
cherry_pickApply one or more commits; supports continue/abort/skip
mergeMerge branches with full flag control
bisectBinary search for a regression (start, good, bad, reset, log)
tagCreate, list, delete, or push tags; supports GPG/SSH signing
worktreeAdd, list, remove, or prune linked worktrees
submoduleAdd, update, sync, init, deinit, and list submodules

Git Flow (git_flow)

Preset git-flow-next workflow without requiring the external CLI.

OperationDescription
initInitialize a repository with git-flow branch conventions
overviewShow the current flow state and active branches
configRead or write git-flow configuration values
topicGeneralized topic branch action (start, finish, publish, track)
controlFlow control: resume interrupted finish, abort, or recover

LFS (git_lfs)

ActionDescription
trackAdd a tracking pattern to .gitattributes
untrackRemove a tracking pattern
ls-filesList tracked LFS files
statusShow LFS status
pullPull LFS objects
pushPush LFS objects
installInstall LFS hooks in the repository
migrate-importMigrate existing history to LFS
migrate-exportMigrate LFS history back to plain objects

Documentation (git_docs)

ActionDescription
searchSearch git-scm.com for documentation
manFetch and return a Git man page

Health Check (git_ping)

Returns server status. Useful for confirming the server is reachable.


MCP Resources

URI-addressable read-only snapshots (subscribe-capable):

Resource URIContent
git+repo://status/{repo_path}Working tree status (JSON)
git+repo://log/{repo_path}Recent commit log (JSON)
git+repo://branches/{repo_path}Branch list (JSON)
git+repo://diff/{repo_path}Unstaged + staged diff (JSON)

Bundled Agent Skill

git-mcp ships a bundled agent skill at skills/git-mcp-workflow/ that teaches any skills-npm-compatible agent to use the MCP tool surface instead of running raw git CLI commands. The skill covers:

  • Why LLMs must not use the Git CLI (quoting hazards, silent failures)
  • Inspect-before-mutate workflow rules
  • Safety order for undo and recovery operations
  • Full registered tool surface with action reference
  • Workflow playbooks: feature branch, rebase, recovery, worktree, backport, release tagging, Git Flow, merge
  • Git concept explanations anchored to MCP tools

Installing the skill

If your agent supports skills-npm:

npm install @selfagency/git-mcp   # or pnpm/yarn
npx skills-npm

Or add to your project's package.json so it runs automatically:

{
  "scripts": {
    "prepare": "skills-npm"
  }
}

Then add to .gitignore:

skills/npm-*

Safety

  • All mutating tools have destructiveHint: true in their MCP annotations
  • git_commits action=reset mode=hard requires confirm=true
  • git_commits action=nuke requires confirm=true
  • Force push (--force) is disabled unless GIT_ALLOW_FORCE_PUSH=true; force_with_lease is always available
  • Hook bypass (--no-verify) is disabled unless GIT_ALLOW_NO_VERIFY=true
  • git_flow hook and filter execution is disabled unless GIT_ALLOW_FLOW_HOOKS=true
  • Paths are validated against the repository root — traversal attempts are rejected
  • Credentials and tokens are never included in responses

License

MIT © Daniel Sieradski

Server Config

{
  "mcpServers": {
    "git": {
      "command": "npx",
      "args": [
        "-y",
        "@selfagency/git-mcp@latest"
      ],
      "env": {
        "GIT_REPO_PATH": "/path/to/your/repo"
      }
    }
  }
}
Recommend Servers
TraeBuild with Free GPT-4.1 & Claude 3.7. Fully MCP-Ready.
DeepChatYour AI Partner on Desktop
Amap Maps高德地图官方 MCP Server
RedisA Model Context Protocol server that provides access to Redis databases. This server enables LLMs to interact with Redis key-value stores through a set of standardized tools.
CursorThe AI Code Editor
Visual Studio Code - Open Source ("Code - OSS")Visual Studio Code
EdgeOne Pages MCPAn MCP service designed for deploying HTML content to EdgeOne Pages and obtaining an accessible public URL.
Serper MCP ServerA Serper MCP Server
Baidu Map百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
MCP AdvisorMCP Advisor & Installation - Use the right MCP server for your needs
Howtocook Mcp基于Anduin2017 / HowToCook (程序员在家做饭指南)的mcp server,帮你推荐菜谱、规划膳食,解决“今天吃什么“的世纪难题; Based on Anduin2017/HowToCook (Programmer's Guide to Cooking at Home), MCP Server helps you recommend recipes, plan meals, and solve the century old problem of "what to eat today"
Jina AI MCP ToolsA Model Context Protocol (MCP) server that integrates with Jina AI Search Foundation APIs.
AiimagemultistyleA Model Context Protocol (MCP) server for image generation and manipulation using fal.ai's Stable Diffusion model.
MiniMax MCPOfficial MiniMax Model Context Protocol (MCP) server that enables interaction with powerful Text to Speech, image generation and video generation APIs.
ChatWiseThe second fastest AI chatbot™
Playwright McpPlaywright MCP server
Tavily Mcp
WindsurfThe new purpose-built IDE to harness magic
Y GuiA web-based graphical interface for AI chat interactions with support for multiple AI models and MCP (Model Context Protocol) servers.
BlenderBlenderMCP connects Blender to Claude AI through the Model Context Protocol (MCP), allowing Claude to directly interact with and control Blender. This integration enables prompt assisted 3D modeling, scene creation, and manipulation.
Zhipu Web SearchZhipu Web Search MCP Server is a search engine specifically designed for large models. It integrates four search engines, allowing users to flexibly compare and switch between them. Building upon the web crawling and ranking capabilities of traditional search engines, it enhances intent recognition capabilities, returning results more suitable for large model processing (such as webpage titles, URLs, summaries, site names, site icons, etc.). This helps AI applications achieve "dynamic knowledge acquisition" and "precise scenario adaptation" capabilities.