mcp/server 1.00

The MCP server for code search

Connect Claude Code, Cursor, or any MCP client to your real codebase: hybrid search, symbol definitions and references, repo maps, and file tools — served from a local index, over stdio or HTTP.

What an MCP server for code search does

An MCP server for code search lets AI agents query your codebase through the Model Context Protocol instead of guessing from filenames. The agent calls tools — search this repo, find where this symbol is defined, show its callers, read this file — and each answer comes back grounded in the actual source. That's the difference between an agent that edits the right function and one that invents an API that doesn't exist.

Most code-search MCP servers wrap grep or plain vector search. OCE's server is backed by a measured retrieval engine: tree-sitter AST-aware chunking across 13 languages, dense vectors fused with BM25 keyword scoring (Reciprocal Rank Fusion), a code graph that rides callers and callees along with results, and an optional language server for compiler-grade symbol lookups. Recall@10 is 0.943 hybrid / 0.886 keyword-only on committed gold sets — published, not claimed.

Connect Claude Code (stdio)

Claude Code speaks MCP over stdio. Three commands and it's grounded:

npm install -g @dhaxor/open-context
oce index                              # build the local index once (auto-updates on save)
claude mcp add oce -- oce mcp          # register the MCP server

That's it. Ask Claude Code "where do we validate JWTs?" and it will call codebase-retrieval before answering. The index lives in local SQLite and re-indexes as files change — nothing is uploaded anywhere.

Connect Cursor & HTTP clients

For clients that speak Streamable HTTP, run the shared endpoint with bearer auth:

oce mcp --http --port 8940 --auth-token $TOKEN
# then point Cursor (or any HTTP MCP client) at:
#   http://127.0.0.1:8940/mcp   with header  Authorization: Bearer $TOKEN

One server process serves any number of MCP clients on the same index — Claude Code, Cursor, a CI review bot, and your own scripts can all query it.

The tools your agent gets

ToolWhat it gives the agent
codebase-retrievalHybrid semantic + keyword search over AST-aware chunks, with symbol expansion pulling referenced definitions along.
repo-mapThe codebase's structure — modules, key symbols — as a budgeted outline the agent can read before diving in.
find-symbol-definitionWhere a function, class, or type is defined. Compiler-grade with the integrated language server; AST-grade without.
find-symbol-referencesEvery call site and mention — so edits account for the callers the agent would otherwise miss.
read-file / list-filesDirect file access within the indexed workspace, so retrieval results can be read in full context.
index-statusIndex freshness, file count, and search mode (hybrid / keyword-only) — the agent knows what it's standing on.

Local and private by default

Everything runs on your machine: in-process MiniLM embeddings need no API key, the index is local SQLite, and degradation is graceful — if vector search is unavailable, keyword-only BM25 keeps the server useful. Over stdio, not a single byte leaves the loop. Over HTTP, the server binds to localhost behind a bearer token. There is no telemetry; a policy system can lock local-only mode org-wide with signatures that can't be loosened locally.

An agentic workflow needs grounding — MCP is the wire

The MCP server is how any agent in an agentic workflow sees your code. Read the agentic workflow guide for why retrieval is the bottleneck, or the docs for search modes, team index sync, and troubleshooting. Task-based MCP setup lives in the docs; pricing is on pricing (MIT core — free forever).

Frequently asked questions

What is an MCP server for code search?

A server that exposes your codebase to AI agents through the Model Context Protocol: hybrid search, symbol definition/reference lookup, repo maps, and file reading. Agents call these tools instead of guessing — answers cite real code. OCE ships one over stdio and HTTP, backed by a local AST-aware index.

How do I connect Claude Code to my codebase?

npm install -g @dhaxor/open-context, then oce index, then claude mcp add oce -- oce mcp. Full steps are in the docs.

How do I connect Cursor?

Run oce mcp --http --port 8940 --auth-token $TOKEN and add http://127.0.0.1:8940/mcp as an MCP entry in Cursor with the bearer token.

Which tools are exposed?

codebase-retrieval, repo-map, find-symbol-definition, find-symbol-references, read-file, list-files, and index-status — see the table above.

Does my code leave my machine?

No. Local embeddings, local SQLite, localhost-only HTTP with bearer auth, no telemetry. Policy locks can enforce local-only mode org-wide.