git-mcp
- Type
- MCP server
- Scanned
- Nov 12, 2026
- Version
- c487a29895dc
- Files read
- 126
GitMCP is a remote or self-hosted MCP server and web chat app that lets AI coding assistants fetch and search documentation and code from GitHub repositories. Users of the hosted server face prompt-injection data exfiltration through an unrestricted URL-fetching tool even when pinned to a single repository, while self-hosters face unauthenticated server-side request forgery on /api/chat and browser-entered AI API keys being sent to a hardcoded third-party worker.
What it can reach
- Network
- Fetches documentation and code search results from GitHub, GitHub Pages, Three.js docs, and any arbitrary URL passed to the URL-fetching tools; also connects to AI model providers and a third-party chat worker.
- Secrets
- Reads GITHUB_TOKEN and AI provider keys (OPENAI_API_KEY, ANTHROPIC_API_KEY, GROQ_API_KEY, XAI_API_KEY) from server environment variables when self-hosted, and stores user-entered AI API keys in browser localStorage for the web chat.
- Other
- Reads and writes Cloudflare KV cache, R2 object storage, Queues, Vectorize indexes, and AutoRAG bindings when deployed on Cloudflare Workers.
Findings
-
HighUnauthenticated
/api/chatendpoint allows SSRF and server API key abuseWhen running GitMCP locally or self-hosting it,
POST /api/chatrequires no authentication, permits cross-origin preflight requests from any website (Access-Control-Allow-Origin: *), and prioritizes server-configuredOPENAI_API_KEY,ANTHROPIC_API_KEY,GROQ_API_KEY, andXAI_API_KEYsecrets. Unlike the browser UI, the server action does not validatemcpServersURLs in the JSON body and callsmcp.connect(url)on any supplied URL, letting network attackers or visited websites probe internal services via SSRF and run arbitrary prompts at the server owner's expense.Fix: Require authentication and Origin validation on
/api/chat, and strictly restrictmcpServersURLs on the server side to trustedhttps:hosts while blocking loopback and private IP ranges. -
MediumWeb chat sends user API keys and messages to a hardcoded third-party worker
app/chat/components/chat.tsx:14
In the built-in web chat, the API key settings dialog tells users their OpenAI, Anthropic, Groq, and xAI keys are stored in their browser's local storage, and the README encourages self-hosting for privacy. However, the chat component hardcodes
https://chat-api-worker.idosalomon.workers.dev/api/chatinstead of calling the local/api/chatroute, sending every chat message and all saved provider API keys to an external Cloudflare Worker controlled by the project author.Fix: Use a relative
/api/chatURL (or a configurable environment variable) so self-hosted deployments keep chat traffic and API keys on their own server, and only send the API key for the selected model provider. -
MediumUnrestricted URL fetching breaks repository pinning and allows SSRF
The README states that connecting to a Specific Repository endpoint (
gitmcp.io/{owner}/{repo}) enhances security by preventing access to unintended repositories, yetgetMcpToolsalways attachesfetch_generic_url_content(markedreadOnlyHint: true), andfetch_threejs_urls_inside_docsaccepts anyhttpURL without checking the domain orrobots.txt. If an AI agent reads prompt-injected text in a repository or issue, it can be tricked into calling these tools to exfiltrate sensitive workspace data in URL query parameters to an attacker's server, or—on local and self-hosted instances whererobots.txtchecks fail open on error—fetchhttp://localhost,127.0.0.1, cloud metadata (169.254.169.254), or private network services.Fix: Enforce
https:, block loopback, link-local, and private IP addresses before callingfetch, restrictfetch_threejs_urls_inside_docstothreejs.org, and scope or disablefetch_generic_url_contenton Specific Repository endpoints. -
MediumGitHub API query and path injection escapes pinned repos and exposes
GITHUB_TOKENscopesrc/api/utils/githubClient.ts:256
githubApiRequestattachesAuthorization: token ${env.GITHUB_TOKEN}by default. InsearchCode,queryis passed to GitHub's search parser without strippingrepo:,org:, oruser:qualifiers (allowingsearch_<repo>_codeon a pinned repository to search other repositories), and in Generic modeownerandrepoare interpolated intoapi.github.comURLs without validation or URL-encoding, enabling query injection,../path traversal across GitHub API endpoints, and enumeration of private repositories accessible to a self-hoster'sGITHUB_TOKEN.Fix: Validate
ownerandrepoagainst/^[A-Za-z0-9._-]+$/, striprepo:/org:/user:qualifiers fromquery, and avoid using aGITHUB_TOKENwith private-repository permissions or caching authenticated responses publicly. -
LowEnd-to-end test configuration runs MCP Inspector with authentication disabled
The Playwright E2E test configuration launches
@modelcontextprotocol/inspectoron localhost port 6277 withDANGEROUSLY_OMIT_AUTH=true. Installed users never run this, but if a developer runspnpm run test:e2e, disabling Inspector authentication exposes the local Inspector proxy (which can spawn local commands) to cross-origin requests from websites open in the browser during the test run.Fix: Remove
DANGEROUSLY_OMIT_AUTH=trueand pass an generated session token to the Playwright test runner instead.
