Give Claude Code your whole codebase
Three commands to ground Claude Code in your real source: hybrid search, symbol definitions, repo maps — served from a local index over MCP. Five minutes, no cloud.
Why Claude Code needs a retrieval server
Claude Code reads files on demand, but on any real repository its context window is a fraction of the codebase — so the quality of every answer depends on what its searches surface first. Back it with a measured retrieval engine and the difference shows up immediately: fewer hallucinated APIs, edits that account for callers, answers that cite the file you'd have opened.
Open Context Engine indexes your repo once (and keeps the index live), then serves it to Claude Code over the Model Context Protocol. Setup is three commands:
step 1 · 1 minInstall
npm install -g @dhaxor/open-context # Node 22+
Everything runs locally: in-process MiniLM embeddings by default (no API key), keyword-only degradation if the vector extension is unavailable, and the whole index in local SQLite.
step 2 · 1–3 minIndex your repository
cd /path/to/your/repo oce index
This parses your code with tree-sitter (13 languages), chunks along AST boundaries, embeds, and builds the BM25 + code-graph structures. It then watches the workspace — edits re-index automatically, and identical code never re-embeds thanks to the content-hash cache. On big repos, oce bench shows you the throughput.
step 3 · 30 sRegister the MCP server
claude mcp add oce -- oce mcp
That's the whole integration. Claude Code launches oce mcp over stdio per session and discovers the tools:
codebase-retrieval— hybrid search with symbol expansionrepo-map— the codebase's structure in a few thousand tokensfind-symbol-definition/find-symbol-references— compiler-grade with a language server, AST-grade withoutread-file,list-files,index-status
step 4 · 1 minVerify the grounding
# in a Claude Code session: > where do we validate JWTs, and who calls it?
A grounded Claude Code calls codebase-retrieval first and answers with real file paths and symbols — not guesses. If you want to see what the model knew at each step, run oce trace: the evidence rail shows every retrieved chunk, its score, and what was pinned or evicted.
Optional: shared index for Cursor, CI, and scripts
oce mcp --http --port 8940 --auth-token $TOKEN # Cursor / HTTP clients → http://127.0.0.1:8940/mcp
One server process serves every MCP client on the same index. Teams can go further: build the index in CI, publish it as an artifact, and have teammates oce pull-index so only their local diff re-embeds.
Where to go next
Claude Code sessions through OCE also gain durable memory — memory_remember, memory_recall, memory_forget — so preferences and codebase facts survive across sessions.
For Cursor and other clients, the MCP server guide; for the retrieval concepts underneath, the code RAG guide and semantic code search; for task-based setup and troubleshooting, the docs. Task-based alternatives are compared on the comparison page.
Frequently asked questions
What tools does Claude Code get?
codebase-retrieval, repo-map, find-symbol-definition, find-symbol-references, read-file, list-files, and index-status — all backed by the local index.
Does my code leave my machine?
OCE never uploads anything — indexing, embeddings, and storage are local, and the MCP server runs on stdio. Retrieved snippets enter Claude Code's context, which travels to your LLM provider as part of any normal session; OCE adds nothing extra on the wire.
Does the index stay current as I edit?
Yes — file watching re-indexes on save by default (--no-watch for static), and the content-hash embedding cache means unchanged code never re-embeds.
How large a repo can it handle?
Parallel worker-thread indexing kicks in automatically on large repos; oce bench measures yours. For teams, CI-built shared indexes keep local setup instant.
Can I use it with Cursor too?
Yes — run the HTTP endpoint (oce mcp --http) and point Cursor at http://127.0.0.1:8940/mcp. Same index, same tools.