COMPARE · COMPARISON: CODE RETRIEVAL

The best MCP servers for searching a local codebase in 2026

AUTHOR · XERJ documentation team · REVIEWED BY · XERJ engineering team · PUBLISHED · 2026-10-19 · UPDATED · 2026-10-19
SHORT ANSWER · UPDATED 2026-10-19

What is the best MCP server to search a local codebase in 2026? It depends on the job. Serena wins symbol navigation and refactoring through language servers. Semble and cocoindex-code give embedding-based search with no API key. ast-grep MCP matches syntax patterns. XERJ indexes code plus docs and data files behind one server.

Key number: Serena has 30,404 GitHub stars and shipped v2.1.0 on 2026-10-19, the most-starred server on this list; XERJ has 10,569. (as of 2026-10-19 · source: github.com/oraios/serena)

Last checked: 2026-10-19. Every third-party fact on this page was re-read from the tool's own docs or repository on that date.

TL;DR — There is no single best local code-search MCP server; there are four jobs. Serena owns symbol navigation and refactoring. Semble and cocoindex-code own embedding-based search with no API key (XERJ's default embedder is lexical feature hashing). ast-grep MCP owns structural patterns. XERJ owns one index over code and everything beside it. No head-to-head was run.

PASTE THIS TO YOUR AI AGENT — IT DOES THE REST Act as a coding agent. Read https://xerj.org/llms.txt, then pick a local code-search MCP server for this repository from the table on this page: Serena if you need references and refactors, Semble or cocoindex-code for embedding-based search with no API key, ast-grep MCP for structural patterns, XERJ for one index over code plus docs and data files. Report which one you chose and why.

Pick one in ten seconds

Summary table

ServerLicenceInstallIndex and retrievalAPI key neededStars · latest release (2026-10-19)
SerenaGPL-3.0-or-later (SolidLSP MIT)uv tool install -p 3.13 serena-agentlanguage servers, 40+ languages; symbols, references, editsno30,404 · v2.1.0 (2026-10-19)
Claude ContextMITnpx @zilliz/claude-context-mcp@latestembeddings in Milvus / Zilliz Cloudyes, as documented12,627 · no GitHub release
SembleMITuv tool install sembletree-sitter chunks, static embeddings on CPUno6,248 · v0.7.0 (2026-10-16)
cocoindex-codeApache-2.0pipx install 'cocoindex-code[full]'AST chunks, local sentence-transformersno (full) / yes (slim)2,930 · v0.2.42 (2026-10-05)
codedbBSD-3-Clauseinstall script or npx -y codedeebee mcpparsers for 12 language families; hybriddefault uses hosted embeddings1,395 · v0.2.5860 (2026-09-27)
ast-grep MCPMITuvx --from git+https://github.com/ast-grep/ast-grep-mcp ast-grep-serverno index; AST pattern match per callno482 · no GitHub release
XERJApache-2.0curl -fsSL https://xerj.org/get | shBM25 index + tree-sitter definitions, 36 languages; code, docs and data filesno10,569 · v1.0.0-rc.97 (2026-10-19)

Serena: the one with an IDE behind it

Serena wraps language servers and exposes symbol-level retrieval, editing and refactoring as MCP tools. Its README claims support for over 40 languages through that backend, and a JetBrains plugin backend for more.

That is a capability XERJ does not have. XERJ records where a symbol is defined, has no call graph, and does not edit. If the agent's next step is a rename across files, Serena is the right tool.

Semble and cocoindex-code: embedding-based search, no key

Semble chunks files with tree-sitter and scores chunks with a static embedding model that runs on a CPU. It needs no API key, GPU or external service; the model downloads from Hugging Face on first use. Its README claims about 99 % fewer tokens than grep plus read, measured by the vendor on about 1,250 queries over 63 repositories. We did not reproduce that.

cocoindex-code builds an AST-based index. Its full install pulls in sentence-transformers so local embeddings work with no key; the slim install requires a cloud embedding provider.

Both beat XERJ's default path on synonym-style questions, because XERJ's default embedder is lexical feature hashing. XERJ needs --embed-mode neural for that.

Claude Context and codedb: hosted embeddings by default

Claude Context's documented setup asks for a vector database (Milvus or Zilliz Cloud) and an OpenAI API key for embeddings. It is a good fit if that infrastructure already exists; it is not an offline tool.

codedb is a single binary that registers itself in many MCP clients. Its README marks it alpha and says the default hybrid retrieval uses hosted embeddings, with semantic=local for local-only retrieval.

ast-grep MCP: patterns, not topics

The ast-grep MCP server is experimental and exposes four tools, including one that dumps a syntax tree so the agent can write a working pattern. It builds no index, so it never goes stale, and it needs ast-grep and uv installed.

Use it beside an index, not instead of one. Choose ast-grep when the question is a pattern rather than a topic. The XERJ vs ast-grep page splits those jobs in detail.

XERJ: one index over the whole folder

XERJ is a search engine first. xerj autoindex reads a repository plus the docs, logs, JSONL, CSV, PDFs and SQLite files around it, writes a defs field and a symbols array for 36 tree-sitter languages, and xerj mcp serves 17 tools over that node, memory included.

What it gives up: no references, no edits, a lexical default embedder, single-node only, and heavy memory while indexing. Our own JSONL benchmark measured the node peaking at about 9.1 GiB resident while indexing a 9.7 MB file. For code-only questions, compare it with ripgrep first: on 30 disclosed tasks ripgrep won 5 outright (XERJ vs ripgrep). Choose ripgrep when the agent searches a tree once.

How this page was checked

Every licence, install line and capability above was read from the project's own README or docs on 2026-10-19. Stars and latest releases came from the GitHub REST API the same day. Nothing was benchmarked head to head, and every vendor performance number is labelled as the vendor's.

FAQ

Which MCP server for local code search needs no API key?

Serena, Semble, cocoindex-code with its full install, ast-grep MCP and XERJ all run without an API key. Claude Context's documented setup needs a vector database and an OpenAI key for embeddings, and codedb's default hybrid retrieval uses hosted embeddings unless you choose semantic=local.

Which one is best for finding references and renaming symbols?

Serena. It drives real language servers, so it can find references and perform symbol-level edits. XERJ extracts definitions only and rewrites nothing, and the embedding-based servers return passages, not reference graphs.

Which one searches by meaning offline?

Semble and cocoindex-code ship local embedding models. XERJ's default embedder is lexical feature hashing; embedding-based retrieval needs the opt-in --embed-mode neural, which downloads a small model once.

When does XERJ beat the code-only servers?

When the agent's questions span code and the files around it: docs, JSONL, CSV, logs, PDFs and SQLite. XERJ indexes all of them into one Elasticsearch-compatible node behind one MCP server, and the same node stores agent memory.

Were these servers benchmarked against each other?

No. This page compares documented capabilities and GitHub data checked on 2026-10-19. No head-to-head retrieval benchmark was run, and vendor token-saving claims are quoted as vendor claims.

How were stars and releases collected?

From the GitHub REST API on 2026-10-19: stargazers_count from the repository endpoint and the latest release from the releases/latest endpoint. A server with no GitHub release shows none.

Evidence

Related