AccuroAI
Book a demo

Resources / MCP Server Risk Directory / Git MCP Server (mcp-server-git)

Is the Git MCP Server (mcp-server-git) safe? Risks, permissions and safe setup

Developers letting a local coding agent inspect history, stage changes and commit in a working repository. Here is what an AI agent can do through it, its published vulnerabilities and how to set it up safely.

Baseline risk

30Medium
  • Capabilities: 20 of 40
  • Read-plus-exfiltrate: no
  • Hidden instructions (publicly verified): none known
  • Third-party publisher: +10

Before your own factors: version pinning, number of users and policy coverage. How we score

Maker
Model Context Protocol project (modelcontextprotocol/servers)
Publisher
MCP project reference server
Runs
Local (runs on the device)
Transport
stdio, streamable-http
Authentication
none (local process permissions); optional --repository confinement
Tools
14
Built-in limits
--repository (-r) confines all tools to one repository; no read-only flag documented
License
MIT
Source
github.com/modelcontextprotocol/servers/tree/main/src/git
Last verified
2026-11-23

What an agent can do through it

Writes to code repositories · 15Reads local files · 5
ToolTypeWhat it does
git_showReadShows a commit, or a file or directory at a revision
git_diffReadDiffs the working tree against a branch or commit, or a revision range
git_logReadShows commit history with optional date filters
git_addWriteStages files
git_commitWriteRecords staged changes as a commit (hooks skipped)
git_checkoutWriteSwitches branches, changing working tree files
git_mergeWriteMerges a branch into the current branch
git_resetWriteUnstages all staged changes

Known vulnerabilities

IDIssuePublishedFixed in
GHSA-5cgr-j3jf-jw3v / CVE-2025-68143
Moderate (CVSS 4.0 6.5)
Unrestricted git_init tool allows repository creation at arbitrary filesystem locations in mcp-server-git Affected: < 2025.9.25.2025-12-172025.9.25
GHSA-9xwc-hfwc-8w59 / CVE-2025-68144
Moderate (CVSS 4.0 6.3)
Argument injection in git_diff and git_checkout functions for mcp-server-git allows overwriting local files Affected: < 2025.12.18.2025-12-172025.12.18
GHSA-j22h-9j4x-23w5 / CVE-2025-68145
Moderate (CVSS 4.0 6.4)
Missing path validation when using --repository flag in mcp-server-git Affected: < 2025.12.18.2025-12-172025.12.18
GHSA-vjqx-cfc4-9h6v / CVE-2026-27735
Moderate (CVSS 4.0 6.4)
Path traversal in git_add allows staging files outside repository boundaries in mcp-server-git Affected: < 2026.1.14.2026-02-252026.1.14
GHSA-w766-5x43-whvw
Moderate (CVSS 5.3)
mcp-server-git: nested gitdir file bypasses --repository confinement Affected: < 2026.10.28.2026-10-282026.10.28
GHSA-q74p-4wrc-q7w6
Moderate (CVSS 5.3)
mcp-server-git: Incomplete Fix for GHSA-w766-5x43-whvw in validate_opened_repo() Allows --repository Confinement Bypass Affected: >= 2026.10.28, < 2026.11.11.2026-11-112026.11.11
GHSA-6hqx-gqrx-c5r2
High (CVSS 7.8)
mcp-server-git: arbitrary command execution via a repository's own Git configuration (core.fsmonitor) during read-only tools Affected: < 2026.11.11.2026-11-112026.11.11
GHSA-h2g3-rwxm-xfm3
High
mcp-server-git 2026.11.11: git_merge runs gc.recentObjectsHook from the repository's own config Affected: >= 2026.11.4, < 2026.11.18.2026-11-182026.11.18
GHSA-87qg-cmw8-jc5m
High (CVSS 7.8)
mcp-server-git: a repository's promisor configuration runs a program during a lazy fetch Affected: < 2026.11.18.2026-11-182026.11.18
GHSA-9vjp-x34c-xg6v
High (CVSS 7.8)
mcp-server-git: a config include created by the merged branch runs a command during git_merge Affected: >= 2026.11.4, < 2026.11.18.2026-11-182026.11.18
GHSA-pm7p-vphh-2cg7
High (CVSS 7.8)
mcp-server-git: a repository's own config runs a command, because the hardening misses an empty driver name Affected: < 2026.11.18.2026-11-182026.11.18
GHSA-r2q8-f657-4r56
Moderate
mcp-server-git 2026.11.11: a crafted .git/index makes read-only tools return files outside the --repository boundary Affected: < 2026.11.18.2026-11-182026.11.18
GHSA-8wv7-r664-7594
High (CVSS 7.8)
mcp-server-git: a submodule's own configuration still runs programs on git_diff (with diff.submodule=diff) and on git_checkout / git_add Affected: < 2026.11.18.2026-11-182026.11.18

Main risks

Untrusted repositories run commands through their own Git config

ASI05 Unexpected Code Execution

Six High advisories in November 2026 show a cloned repo's config (core.fsmonitor, promisor settings, config includes, submodule config, gc hooks) running programs during tool calls, even read-only ones. Versions before 2026.11.18 are affected.

Confinement escapes outside --repository

ASI02 Tool Misuse and Exploitation

Nested gitdir files, crafted .git/index entries and path traversal in git_add have each let tools reach files outside the configured repository. Without --repository the server reads and writes any repo the process can reach.

Prompt injection in commit messages, diffs or file contents

LLM01:2025 Prompt Injection

git_log, git_show and git_diff return text authored by anyone who contributed to the repo. Injected instructions can push the agent to commit, check out or merge branches it should not.

Unpinned uvx install misses fast-moving security fixes

ASI04 Agentic Supply Chain Vulnerabilities

The official uvx example has no version, and fixes shipped in 2026.10.28, 2026.11.11 and 2026.11.18 in quick succession, with one incomplete fix. Cached or old environments can stay on vulnerable builds.

How to set it up safely

  1. Upgrade to mcp-server-git 2026.11.18 or later and pin it (uvx mcp-server-git==2026.11.18 or newer).
  2. Always set --repository to a single repo; the README says to do so whenever prompts or content are not fully trusted.
  3. Do not point it at repositories you just cloned from untrusted sources, since their config and submodules have repeatedly been an execution path.
  4. Keep the HTTP transport on its default 127.0.0.1:3001 bind and never set HOST=0.0.0.0.
  5. Avoid the Docker image for untrusted repos, since it trusts every mounted repository (safe.directory '*').
  6. Review commits before pushing; the server has no push tool, so keep pushing as a human step.
  7. Set user.name and user.email in the repo, since the server falls back to the OS user and host name for commit identity.

How we score

Baseline scores use the method from our guide to scoring every MCP server on employee laptops. Score the servers in your own environment with the free MCP Server Risk Checklist.

1. What the server can do (capped at 40)

  • Sends messages externally: 15
  • Fetches arbitrary URLs: 15
  • Writes to code repositories: 15
  • Reads and writes databases: 15
  • Writes or deletes local files: 10
  • Automates a browser: 10
  • Reads and writes SaaS data: 10
  • Reads local files: 5
  • Runs code or commands: 15 (added for this directory)
  • Changes cloud infrastructure: 15 (added for this directory)
  • Moves money or changes payments: 15 (added for this directory)

2. What we found

  • Read-plus-exfiltrate: reads sensitive data and can also send data out: 20
  • Hidden instructions in a tool description (publicly verified): 30, and always Critical
  • Third-party: not published by the maker of the system it connects to: 10

3. Band

0–24 Low · 25–49 Medium · 50–74 High · 75–100 Critical.

This is a baseline. The full method also adds points for unpinned package versions, how many employees use the server and whether a policy covers it; those depend on your setup, so check them in your own environment.

How AccuroAI helps

The AccuroAI Endpoint Agent finds the MCP servers configured in AI clients on managed devices and lists the tools each local server exposes. Each server gets a risk level with its capabilities, and you can block a server once in the console to enforce the block on every device: Claude Code and Cursor refuse calls to it, and for other clients the agent stops the server process. Tool calls from coding agents can be graded by risk, then allowed, confirmed with the employee or blocked.

MCP security · MCP server inventory · How to red team an MCP server

Questions about the Git MCP Server (mcp-server-git)

Is the Git MCP Server (mcp-server-git) safe to use?

It can be, with the right setup. At baseline it scores 30 (Medium) in the AccuroAI method because an agent using it can writes to code repositories, reads local files. Limit its scopes or tools, keep a person in the loop for write actions and pin the version you reviewed.

Does the Git MCP Server (mcp-server-git) have known vulnerabilities?

Yes. 13 published issues are listed on this page with the affected versions and the fix, as of 2026-11-23. Update to a fixed version and check the maker's advisories before approving a new release.

How do I restrict the Git MCP Server (mcp-server-git)?

Use the controls the maker provides: --repository (-r) confines all tools to one repository; no read-only flag documented. Then grant the narrowest token or account, approve the server centrally and block other copies of it.

Related servers

Context7 MCP Server · GitHub MCP Server · GitLab MCP server · Sentry MCP Server · All servers

Sources

Facts were verified on 2026-11-23 against the server’s own repository and documentation and public vulnerability records. Servers change often: check the maker’s latest release notes before approving a new version. This page is general security guidance, not a guarantee about any product.

MCP Security
Find every copy of Git MCP Server (mcp-server-git) on your fleet

AccuroAI finds the MCP servers configured in AI clients on managed devices, gives each a risk level and blocks a server across the fleet.

Book a demoStart a free pilot

Finds MCP servers on managed devices · Risk level per server · Block a server across the fleet