$ account idosal
GitMCP is a remote Model Context Protocol (MCP) server running on Cloudflare Workers that turns any public GitHub repository (or GitHub Pages site) into live, searchable documentation for AI tools. AI clients like Claude Desktop, Cursor, and MCP Inspector connect to gitmcp.io/{owner}/{repo} over SSE with OAuth and receive repo-specific MCP tools: fetch_<repo>_documentation, search_<repo>_documentation, search_<repo>_code, and fetch_url_content. The ingestion pipeline fetches llms.txt first (falling back to README.md, then landing-page HTML converted via html-to-md), chunks it with markdown-aware chunkers (heading-context-preserving, code-block and list aware), and indexes it into Cloudflare Vectorize using a dependency-free deterministic embedder built from hashing plus term-frequency/keyword extraction, with a hybrid ranking that blends normalized vector similarity (60%) with keyword/proximity/heading heuristics (40%). Robots.txt is parsed, cached, and respected before external fetches - an uncommon discipline for doc scrapers. The codebase also ships a full web chat application (React Router v7, Tailwind, shadcn/ui, AI SDK) with model selection across OpenAI/Anthropic/Groq/XAI, MCP server management, and a streaming chat API endpoint. Architecturally, the MCP server itself is implemented as a Cloudflare Durable Object (MyMCP), with KV caching (TTL with jitter to prevent cache stampedes), R2 storage for pre-generated docs, a queue for background ingestion, Vectorize for semantic search, Analytics Engine for usage metrics, and GitHub API integration with rate-limit tracking and retry/backoff. A notable design pattern is the RepoHandler strategy interface: per-repo families (three.js, react-router) provide customized tool sets, doc-fetch strategies, and search behavior while the generic handler covers all other repos, including a static mapping of library names to their canonical doc repos. Testing is solid: Vitest unit tests cover tool registration, repo handlers, URL parsing, caching, and three.js utilities (with snapshots), and Playwright e2e tests run against a locally-provisioned R2 environment; CI runs both on push/PR. Weaknesses and drift: the embedding layer is explicitly a prototype-grade stand-in ('In a production environment, you would use a proper embedding service like OpenAI') and will produce weak semantic results; badge.ts contains ~96k tokens of hardcoded escaped SVG logo paths (extreme maintenance fragility); several hardcoded host URLs (git-mcp.idosalomon.workers.dev, CHAT_API_URL) baked into source; a generated-type mismatch where Vectorize metadata filters use $gt at runtime but generated types only declare $eq/$ne; vector re-ingestion only deletes the first 100 stale chunks (repos with more chunks accumulate orphans); and the frontend uses React Router v7's unstable_viteEnvironmentApi. These are prototype-velocity marks rather than architectural rot - the core strategy/caching/testing structure is genuinely well-built.