← MCP server and skill grades

git-mcp

idosal/git-mcp

C
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

1 high3 medium1 low
  1. HighUnauthenticated /api/chat endpoint allows SSRF and server API key abuse

    app/routes/api.chat.ts:32

    When running GitMCP locally or self-hosting it, POST /api/chat requires no authentication, permits cross-origin preflight requests from any website (Access-Control-Allow-Origin: *), and prioritizes server-configured OPENAI_API_KEY, ANTHROPIC_API_KEY, GROQ_API_KEY, and XAI_API_KEY secrets. Unlike the browser UI, the server action does not validate mcpServers URLs in the JSON body and calls mcp.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 restrict mcpServers URLs on the server side to trusted https: hosts while blocking loopback and private IP ranges.

  2. 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/chat instead of calling the local /api/chat route, 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/chat URL (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.

  3. MediumUnrestricted URL fetching breaks repository pinning and allows SSRF

    src/api/utils/cache.ts:260

    The README states that connecting to a Specific Repository endpoint (gitmcp.io/{owner}/{repo}) enhances security by preventing access to unintended repositories, yet getMcpTools always attaches fetch_generic_url_content (marked readOnlyHint: true), and fetch_threejs_urls_inside_docs accepts any http URL without checking the domain or robots.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 where robots.txt checks fail open on error—fetch http://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 calling fetch, restrict fetch_threejs_urls_inside_docs to threejs.org, and scope or disable fetch_generic_url_content on Specific Repository endpoints.

  4. MediumGitHub API query and path injection escapes pinned repos and exposes GITHUB_TOKEN scope

    src/api/utils/githubClient.ts:256

    githubApiRequest attaches Authorization: token ${env.GITHUB_TOKEN} by default. In searchCode, query is passed to GitHub's search parser without stripping repo:, org:, or user: qualifiers (allowing search_<repo>_code on a pinned repository to search other repositories), and in Generic mode owner and repo are interpolated into api.github.com URLs without validation or URL-encoding, enabling query injection, ../ path traversal across GitHub API endpoints, and enumeration of private repositories accessible to a self-hoster's GITHUB_TOKEN.

    Fix: Validate owner and repo against /^[A-Za-z0-9._-]+$/, strip repo:/org:/user: qualifiers from query, and avoid using a GITHUB_TOKEN with private-repository permissions or caching authenticated responses publicly.

  5. LowEnd-to-end test configuration runs MCP Inspector with authentication disabled

    playwright.config.ts:70

    The Playwright E2E test configuration launches @modelcontextprotocol/inspector on localhost port 6277 with DANGEROUSLY_OMIT_AUTH=true. Installed users never run this, but if a developer runs pnpm 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=true and pass an generated session token to the Playwright test runner instead.