repomind

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.

Category
Visit Server

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

  1. Push to GitHub, import the repo in Vercel (framework auto-detected).
  2. It deploys and runs with no env vars (PGlite on /tmp, local models).
  3. For durable, multi-instance storage and real LLM answers, add DATABASE_URL (Neon) and OPENAI_API_KEY in 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.

Recommended Servers

playwright-mcp

playwright-mcp

A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.

Official
Featured
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.

Official
Featured
Local
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.

Official
Featured
Local
TypeScript
VeyraX MCP

VeyraX MCP

Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.

Official
Featured
Local
graphlit-mcp-server

graphlit-mcp-server

The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.

Official
Featured
TypeScript
Kagi MCP Server

Kagi MCP Server

An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.

Official
Featured
Python
E2B

E2B

Using MCP to run code via e2b.

Official
Featured
Neon Database

Neon Database

MCP server for interacting with Neon Management API and databases

Official
Featured
Exa Search

Exa Search

A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.

Official
Featured
Qdrant Server

Qdrant Server

This repository is an example of how to create a MCP server for Qdrant, a vector search engine.

Official
Featured