Git MCP Server

Runs everyday git work on local repositories, from clone and commit to rebase, worktrees and push

By Casey Hand (individual) TypeScript Local · stdio Git and code hostingDeveloper tools

62 popularity score ★ 245 ↓ 4.3k/wk

Connect your client

Local (npm)

Add in one click

Opens the app, which asks before it adds the server.

Or add it by command or config

Claude CodeTerminal
claude mcp add git -- npx -y @cyanheads/git-mcp-server@latest
Claude Desktopclaude_desktop_config.json
{
  "mcpServers": {
    "git": {
      "command": "npx",
      "args": [
        "-y",
        "@cyanheads/git-mcp-server@latest"
      ]
    }
  }
}
Cursor~/.cursor/mcp.json
{
  "mcpServers": {
    "git": {
      "command": "npx",
      "args": [
        "-y",
        "@cyanheads/git-mcp-server@latest"
      ]
    }
  }
}
VS Code.vscode/mcp.json
{
  "servers": {
    "git": {
      "type": "stdio",
      "command": "npx",
      "args": [
        "-y",
        "@cyanheads/git-mcp-server@latest"
      ]
    }
  }
}
Codex~/.codex/config.toml
[mcp_servers.git]
command = "npx"
args = ["-y", "@cyanheads/git-mcp-server@latest"]
Gemini CLITerminal
gemini mcp add --scope user git npx -- -y @cyanheads/git-mcp-server@latest

Settings 12

GIT_BASE_DIR Optional: Absolute path that all git operations are confined to; unset means no restriction.
GIT_AUTHOR_NAME Optional: Author name for commits (aliases GIT_USERNAME, GIT_USER); falls back to global git config.
GIT_AUTHOR_EMAIL Optional: Author email for commits (aliases GIT_EMAIL, GIT_USER_EMAIL); falls back to global git config.
GIT_SIGN_COMMITS Optional: GPG/SSH signing of commits, merges, rebases, cherry-picks and tags; true by default.
MCP_TRANSPORT_TYPE Optional: stdio (default) or http.
MCP_HTTP_PORT Optional: Port for HTTP mode; 3015 by default.
MCP_HTTP_HOST Optional: Host for HTTP mode; 127.0.0.1 by default.
MCP_AUTH_MODE Optional: none (default), jwt or oauth for HTTP mode.
MCP_RESPONSE_FORMAT Optional: json (default), markdown or auto.
MCP_RESPONSE_VERBOSITY Optional: minimal, standard (default) or full.
GIT_WRAPUP_INSTRUCTIONS_PATH Optional: Markdown file with custom wrap-up workflow instructions.
MCP_LOG_LEVEL Optional: debug, info (default), warn or error.

What it does

Git MCP Server, from the developer cyanheads, gives an assistant a set of git commands that run against repositories on your own machine. It covers setting up and cloning repositories, staging and committing, reading history (log, show, blame, reflog), branching, merging, rebasing and cherry-picking, working with remotes (fetch, pull, push), plus tags, stashes, resets and worktrees. A session working directory can be set once with git_set_working_dir so later calls need no path. There is also a git://working-directory resource and a Git Wrap-up prompt that walks through reviewing, documenting, committing and tagging at the end of a session.

It calls the installed git program with checked arguments rather than through a shell. Results come back as JSON by default or as Markdown, with three verbosity levels. It speaks stdio by default and can also serve Streamable HTTP (port 3015 on 127.0.0.1 by default), where JWT or OAuth sign-in can be switched on.

The code at v2.15.3 registers exactly the 28 tools the README lists. It adds guards the README only touches on: git_clean refuses to run unless force or dryRun is set to true (src/mcp-server/tools/definitions/git-clean.tool.ts), and git_push takes a confirmed flag that must be true before a force push or branch deletion on protected branches such as main, master or production (git-push.tool.ts).

What it needs

RuntimeNode.js 20+

Node.js 20 or later (for npx), or Bun 1.2 or later (for bunx). The git command line program must be installed and on PATH, since every tool runs through it. Commit signing is on by default and uses your existing GPG or SSH signing setup; the author name and email come from GIT_AUTHOR_NAME/GIT_AUTHOR_EMAIL or fall back to your global git config. Pushing to or pulling from private remotes uses whatever git credentials are already set up on the machine.

Limits

Works only on repositories git can reach on the machine where the server runs; there is no GitHub or other code-host API support (a GitHub API provider is only listed as a maybe on the roadmap, and a pure-JS provider for Cloudflare Workers and other edge platforms is planned, not shipped). When commit signing fails it quietly falls back to an unsigned commit and reports this only through the signed/signingWarning fields of the response. Without GIT_BASE_DIR the tools are not limited to one directory tree. The README's client snippet runs npx without -y, which can stop at an install prompt; the snippet here adds -y.

Who it suits

Suits developers who want an assistant to carry out full local git workflows, including history rewriting (rebase, reset, cherry-pick) and pushing, with guards on destructive steps and optional confinement to one folder with GIT_BASE_DIR. It runs locally and needs no account or key of its own. Pick a code-host server instead if you need issues, pull requests or repositories you have not cloned; this one only drives git itself. Teams that only want read access should note that most tools can change the repository or a remote.

Tools 28

git_init
Create a new git repository in a folder.
git_clone
Copy a remote repository to a local folder.
git_status
Show the current branch and staged, unstaged and untracked files.
git_clean
Delete untracked files; needs force or a dry run to preview.
git_add
Stage files for the next commit.
git_commit
Record staged changes as a commit, signed by default.
git_diff
Compare changes between the working tree, index or commits.
git_log
List commit history.
git_show
Display a commit, tag or other git object.
git_blame
Show who last changed each line of a file.
git_reflog
List where branch tips and HEAD have pointed.
git_changelog_analyze
Collect git history and guidance for drafting changelog notes.
git_branch
List, create, rename or delete branches.
git_checkout
Switch branches or restore files.
git_merge
Join another branch into the current one.
git_rebase
Replay commits onto another base.
git_cherry_pick
Apply chosen commits onto the current branch.
git_remote
List, add or remove remotes.
git_fetch
Download new objects and refs from a remote.
git_pull
Fetch from a remote and integrate the changes.
git_push
Send commits or tags to a remote, with checks on protected branches.
git_tag
List, create, delete or verify tags.
git_stash
Set aside and restore uncommitted changes.
git_reset
Move HEAD and optionally discard changes.
git_worktree
Manage extra working trees for one repository.
git_set_working_dir
Set the session folder used when a call gives no path.
git_clear_working_dir
Forget the session folder.
git_wrapup_instructions
Return the end-of-session workflow steps, optionally from a custom file.

Similar servers