git_add
Stage files for commit. Add file contents to the staging area (index) to prepare for the next commit.
Give an agent the git it needs to finish a session — stage, commit, rebase, stash, tag and manage worktrees — with a session working directory so the repo path stops being an argument on every call.
LABSCO SUMMARY
Everything that destroys work sits behind its own flag — clean needs force, reset and push need confirmation — so an agent cannot hard-reset a tree by omission. The two least git-like tools shape how the server actually gets used: git_wrapup_instructions returns an acceptance-criteria checklist the agent has to satisfy before a session counts as shipped, and git_changelog_analyze gathers the commits, tags and review framing to write against, leaving the changelog file itself to be read separately. One thing to check on day one: signing is on by default and falls back to unsigned rather than failing, so read the signed field in the response if signed commits are a requirement.
A server over git itself: 28 tools covering the working tree, history, remotes, tags and worktrees, plus a session working directory that later calls inherit.
Git installed locally, and Node.js 20 or Bun 1.2 upwards — the runtime is detected for you. Either call git_set_working_dir once or pass a path on every call. Worth setting before the first commit: GIT_AUTHOR_NAME and GIT_AUTHOR_EMAIL, which otherwise fall back to your global git config, and GIT_BASE_DIR, which confines every operation to one directory tree. Over HTTP it listens on port 3015 with MCP_AUTH_MODE deciding between none, jwt and oauth. Apache-2.0.
One command — npx @cyanheads/git-mcp-server@latest
USE CASES
Fix the working directory once so the rest of the calls inherit it, read what changed, stage it and commit with a message written as a JSON string.
Read the history you are about to rewrite, replay it onto the current base, and pull across the one commit from elsewhere that belongs in the series.
Gather the commits and tags since the last release with the review framing to work from, tag the release point, and push the tag with the branch.
Read the reference log for where the branch tip used to be, check that state out, and park anything in the working tree that is in the way.
Blame the file over a bounded line range, then open the commit that last touched it to read the change in full.
Add a second worktree for the parallel task instead of stashing and switching, then remove it when the work lands.
Counted once with only startup setup. Other versions, modes or optional credentials may expose a different list.
git_addStage files for commit. Add file contents to the staging area (index) to prepare for the next commit.
git_blameShow line-by-line authorship information for a file, displaying who last modified each line and when. For large files, use startLine/endLine to limit output.
git_branchManage branches: list all branches, show current branch, create a new branch, delete a branch, or rename a branch.
git_changelog_analyzeGather git history context (commits, tags) and structured review instructions to support LLM-driven changelog analysis. Changelog file should be read separately; this tool provides the supporting git data and analysis framework. Pass one or more review types to control what kind of analysis to perform.
git_checkoutSwitch branches or restore working tree files. Can checkout an existing branch, create a new branch, or restore specific files.
git_cherry_pickCherry-pick commits from other branches. Apply specific commits to the current branch without merging entire branches.
git_cleanRemove untracked files from the working directory. Requires force flag for safety. Use dry-run to preview files that would be removed.
git_clear_working_dirClear the session working directory setting. This resets the context without restarting the server. Subsequent git operations will require an explicit path parameter unless git_set_working_dir is called again.
git_cloneClone a repository from a remote URL or local path. Accepts HTTP(S), SSH, git://, file://, and bare filesystem paths, with optional shallow cloning.
git_commitCreate a new commit with staged changes in the repository. Records a snapshot of the staging area with a commit message.
Commit Message Format: Pass commit messages as JSON string parameters. Multi-line messages are supported using standard JSON string escaping.
Examples:
Note: Do not use bash heredoc syntax. Literal escape sequences ( , \t) in the message string are automatically normalized to their actual characters.
git_diffView differences between commits, branches, or working tree. Shows changes in unified diff format.
git_fetchFetch updates from a remote repository. Downloads objects and refs without merging them.
git_initInitialize a new Git repository at the specified path. Creates a .git directory and sets up the initial branch.
git_logView commit history with optional filtering by author, date range, file path, or commit message pattern.
git_mergeMerge branches together. Integrates changes from another branch into the current branch with optional merge strategies.
git_pullPull changes from a remote repository. Fetches and integrates changes into the current branch.
git_pushPush changes to a remote repository. Uploads local commits to the remote branch.
git_rebaseRebase commits onto another branch. Reapplies commits on top of another base tip for a cleaner history.
git_reflogView the reference logs (reflog) to track when branch tips and other references were updated. Useful for recovering lost commits.
git_remoteManage remote repositories: list remotes, add new remotes, remove remotes, rename remotes, or get/set remote URLs.
git_resetReset current HEAD to specified state. Can be used to unstage files (soft), discard commits (mixed), or discard all changes (hard).
git_set_working_dirSet the session working directory for all git operations so subsequent calls can omit the path parameter. Always returns a repository snapshot (status, recent commits, recent tags, remotes) to orient the caller.
git_showShow details of a git object (commit, tree, blob, or tag). Displays commit information and the diff of changes introduced.
git_stashManage stashes: list stashes, save current changes (push), restore changes (pop/apply), or remove stashes (drop/clear).
git_statusShow the working tree status including staged, unstaged, and untracked files.
git_tagManage tags: list all tags, create a new tag, delete a tag, or verify a signed tag. Tags are used to mark specific points in history (releases, milestones). Verify runs git tag -v and returns a structured result distinguishing unsigned tags, missing trust configuration, bad signatures, and valid signatures.
git_worktreeManage multiple working trees: list worktrees, add new worktrees for parallel work, remove worktrees, or move worktrees to new locations.
git_wrapup_instructionsReturns a Git wrap-up protocol: an acceptance-criteria checklist the agent must satisfy before the session is considered shipped. Uses the operator's custom instructions if configured, otherwise emits a generic goals-strict/mechanism-generic default. Enriches the response with a repository snapshot (status, recent commits, recent tags) so the agent has immediate orientation for the commit and release steps.
BEFORE YOU INSTALL
28 tools when we connected. git_clean and git_reset --hard require explicit confirmation flags. git://working-directory is a resource and Git Wrap-up is a prompt, not tools.
npx on PATH
Both documented setups run the server on your machine.
CONTEXT COST
Rated by the size of the 28 tool definitions that ride along on every turn, not by how many there are
INSTALLATION
npx @cyanheads/git-mcp-server@latest{
"mcpServers": {
"git-mcp-server": {
"type": "stdio",
"command": "npx",
"args": [
"@cyanheads/git-mcp-server@latest"
],
"env": {
"MCP_TRANSPORT_TYPE": "stdio",
"MCP_LOG_LEVEL": "info",
"GIT_SIGN_COMMITS": "true"
}
}
}
}{
"mcpServers": {
"git-mcp-server": {
"type": "stdio",
"command": "bunx",
"args": [
"@cyanheads/git-mcp-server@latest"
],
"env": {
"MCP_TRANSPORT_TYPE": "stdio",
"MCP_LOG_LEVEL": "info"
}
}
}
}