repomind
MCP server for codebase intelligence. Point it at any public GitHub repo to ask questions about code with cited answers, search code, files, symbols, and repo stats.
README
RepoMind — Codebase Intelligence Agent
▶ Live demo: https://repomind-teal.vercel.app · MCP endpoint · CI: typecheck + tests + eval gate + build
The live demo boots with a pre-indexed sample service (
demo/acme-service) so you can ask questions immediately — try "How is authentication implemented?" Paste any public repo (e.g.honojs/hono) to index your own.
Point it at any public GitHub repo. It ingests the code with AST-aware chunking, indexes it with hybrid retrieval (dense vectors + lexical BM25 fused with Reciprocal Rank Fusion, in one SQL query over pgvector), and lets you chat with an agentic tool loop that answers architecture, "where is X", and how-does-this-work questions — every claim carrying a clickable citation back to the exact file and line.
The same repo tools are exposed as an MCP server over Streamable HTTP, so Claude Desktop / Cursor can use the deployed backend directly. Retrieval quality is defended by an eval harness (recall@k · MRR · nDCG) wired as a CI regression gate.
Runs with zero API keys. Missing keys degrade gracefully — an in-process Postgres (PGlite + pgvector) replaces Neon, and a deterministic local embedding + extractive answerer replace OpenAI. Add keys to upgrade quality, not to boot. This is why the CI suite and the Vercel demo work with no secrets.
Why this project
It's built to show the surface area of a senior AI/ML engineer, end to end:
| Capability | What's actually implemented |
|---|---|
| Retrieval engineering | Dense (pgvector HNSW) + lexical (Postgres tsvector) hybrid search fused with RRF inside a single SQL statement, then an optional LLM reranker. Not a managed black box — the retrieval stack is owned. |
| RAG quality technique | Contextual Retrieval (Anthropic's method): each chunk is enriched with an LLM-generated situating summary before embedding, which lifts recall. Generated once at ingest. |
| AST-aware chunking | Splits code on real symbol boundaries (functions/classes/types) across TS/JS/Python/Go/Rust/Java/…, so chunks are semantically whole and citations name real symbols. |
| Agentic tool use | A bounded agent loop (AI SDK v5) with search_code, read_file, list_symbols, repo_stats. Streams its tool trace and tokens live. |
| MCP | The exact same tools re-exposed as a Model Context Protocol server — one implementation, two transports. |
| Evaluation | Golden Q&A set scored with recall@k / MRR / nDCG, an ablation (dense-only vs lexical-only vs hybrid), and a CI gate that fails the build on regression. |
| Production concerns | Prompt-injection screening, semantic cache (embedding-similarity answer reuse), rate limiting, and token/cost tracing on a live observability dashboard. |
| Data engineering | GitHub tarball streaming ingest (one request, not one-per-file), content-hash incremental reindex (only changed chunks re-embed; deleted chunks pruned). |
| Dual backend | Identical SQL over Neon serverless Postgres (prod) and PGlite (local/CI). Backend-agnostic app code. |
Architecture
flowchart LR
subgraph Ingest
GH[GitHub tarball] --> CH[AST chunker<br/>symbol boundaries]
CH --> CTX[Contextual<br/>enrichment]
CTX --> EMB[Embeddings<br/>OpenAI / local]
EMB --> PG[(pgvector + tsvector<br/>Neon / PGlite)]
end
subgraph Query
Q[Question] --> GUARD[Injection screen<br/>+ rate limit]
GUARD --> CACHE{Semantic<br/>cache?}
CACHE -- hit --> ANS
CACHE -- miss --> HYB[Hybrid retrieve<br/>dense + lexical → RRF]
HYB --> RR[Rerank<br/>LLM / fusion order]
RR --> AGENT[Agent loop<br/>tools + streaming]
AGENT --> ANS[Cited answer]
ANS --> LOG[(Telemetry)]
end
PG --- HYB
AGENT -. same tools .-> MCP[[MCP server<br/>/api/mcp]]
Retrieval benchmark
From npm run eval (hermetic: fixture repo, local hashing embeddings, PGlite). The ablation is the point — hybrid RRF fusion beats either arm alone on every metric:
| Configuration | Recall@5 | MRR | nDCG@10 | Hit@5 |
|---|---|---|---|---|
| dense-only | 96.4% | 0.929 | 91.8% | 100% |
| lexical-only | 96.4% | 0.893 | 88.5% | 100% |
| hybrid (RRF) | 96.4% | 1.000 | 95.5% | 100% |
14 golden questions spanning paraphrase (dense) and exact-token (lexical) queries. The CI gate fails the build if hybrid drops below recall@5 0.75 / MRR 0.60 / nDCG 0.65. With real OpenAI embeddings the absolute numbers rise further; these are a regression floor, not a ceiling.
Run it locally
npm install
npm run dev # http://localhost:3000 — works with no keys
Then paste a repo like tiangolo/fastapi (or click a sample) and ask questions.
npm test # 22 tests: chunker, embeddings, metrics, + PGlite integration
npm run eval # print the retrieval benchmark, write evals/results.json
npm run eval -- --ci # same, but exit non-zero on regression (used in CI)
npm run typecheck # strict TS, no errors
npm run build # production build
Optional configuration (.env.local)
Everything is optional — see .env.example.
| Var | Effect |
|---|---|
OPENAI_API_KEY |
Switches embeddings to text-embedding-3-small and enables the full LLM agent loop, contextual enrichment, and LLM reranking. |
DATABASE_URL |
Neon serverless Postgres (needs the vector extension). Unset ⇒ in-process PGlite. |
GITHUB_TOKEN |
Raises GitHub rate limits and allows private repos. |
MCP_BEARER_TOKEN |
If set, the MCP endpoint requires Authorization: Bearer <token>. |
Use it from Claude Desktop / Cursor (MCP)
The deployment is a live MCP server. Add to your client config:
{
"mcpServers": {
"repomind": { "url": "https://<your-deployment>.vercel.app/api/mcp" }
}
}
Tools exposed: list_repos, search_code, read_file, list_symbols, repo_stats.
Deploy to Vercel
- Push to GitHub, import the repo in Vercel (framework auto-detected).
- It deploys and runs with no env vars (PGlite on
/tmp, local models). - For durable, multi-instance storage and real LLM answers, add
DATABASE_URL(Neon) andOPENAI_API_KEYin Project → Settings → Environment Variables, then redeploy.
Layout
src/lib/db/ dual-backend Postgres (client, schema, vector helpers)
src/lib/ingest/ github tarball stream · AST chunker · contextual enrichment · pipeline
src/lib/retrieval/ hybrid RRF search (one SQL query) · reranker
src/lib/agent/ tools · agent engine · guardrails · semantic cache · rate limit
src/lib/eval/ IR metrics · harness (with ablation)
src/lib/obs/ token/cost accounting · telemetry
src/app/api/ chat · ingest · mcp · repos · stats · observability · eval · file
src/components/ premium streaming UI (chat, citations, code drawer, dashboards)
evals/ fixture repo · golden set · committed results.json
test/ vitest suites (unit + PGlite integration)
Built with Next.js 16, AI SDK v5, @modelcontextprotocol/server + mcp-handler, @neondatabase/serverless, @electric-sql/pglite + pgvector.
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。