Git MCP Server
Lets your AI agent run Git in local repos: clone, commit, diff, branch, merge, rebase, stash and worktrees.
245 stars on GitHubby cyanheadsLicense Apache-2.0Updated 2 months ago
How to install
This MCP is local: it runs on your computer.
It works in apps installed on your PC (Claude Desktop, Claude Code, Cursor, VS Codeβ¦). Choose your app:
Paste in the terminal:
claude mcp add git -- npx -y @cyanheads/git-mcp-server run start:stdio
What to fill in
| Name | What it is | Required |
|---|---|---|
MCP_LOG_LEVEL | Sets the minimum log level for output (e.g., 'debug', 'info', 'warn'). | No |
GIT_BASE_DIR | Optional absolute path to restrict all git operations to a specific directory tree. Provides security sandboxing for multi-tenant or shared environments. | No |
Ready! Now test it
Restart the app and paste one of these requests in the chat:
Show me what changed since the last commit.
Create a new branch called fix-login and commit my changes.
What it is
This server gives AI agents 28 Git tools for local repositories, plus a resource for the current working directory and a wrap-up prompt. It works over stdio or streamable HTTP and runs on Node.js or Bun. Destructive actions need explicit confirmation flags.
What it can do
git_status,git_diff,git_log: check and review changesgit_addandgit_commit: stage and commitgit_branch,git_checkout,git_merge,git_rebase: manage branchesgit_push,git_pull,git_fetch: sync with remotesgit_stash,git_tag,git_worktree: stash, tag and manage worktreesgit_cleanandgit_reset: require confirmation
When to use
- βΊWhen you want an AI to commit your changes with a clear message
- βΊWhen you want a branch merged or rebased and conflicts explained
- βΊWhen you want a changelog analysis from your history
What you need
Skills that pair well
MCP or skill?
The MCP gives the agent the hands. The skill teaches the right way to use them. Together, the result is better and uses fewer tokens.
agent-merge-conflict-arbiterSettles a git merge conflict between two agents' branches as a neutral third party, producing one merged result for the repo.git-workflowTeaches your agent Git habits, including Conventional Commits messages, branch naming, pull request flow and merge conflict handling.omh-git-workflowHelps your agent sort out a git merge conflict, a bad commit, or messy branch history, with a safe plan before anything is rewritten.Frequently asked questions
Is it free and open source?
Yes, it is under an open license on GitHub.
Does it sign commits?
GPG or SSH signing is on by default and falls back to unsigned if it fails, with a warning in the response.
Is it safe?
Paths are checked, git runs without a shell, and git clean and git reset --hard need explicit confirmation flags.
Can I limit where it works?
Yes, GIT_BASE_DIR restricts operations to one directory tree.
Which transports work?
stdio by default, or Streamable HTTP on port 3015 when MCP_TRANSPORT_TYPE=http.
Can I set my git name?
Yes, with GIT_AUTHOR_NAME and GIT_AUTHOR_EMAIL, or fall back to your global git config.
If it does not work
- βΊCheck that Node.js 20+ (or Bun 1.2+) and git are installed.
- βΊSet GIT_USERNAME and GIT_EMAIL in the env or configure global git identity.
- βΊIf a commit fails to sign, turn off GIT_SIGN_COMMITS or fix your GPG or SSH setup.
5 new skills a week. 1 minute to read.