Overview
XERJ is an open-source search engine written in Rust that ships as a single static binary. Its headline feature is autoindex: point `xerj autoindex` at a folder and it sniffs every file, works out what each one is, and creates one index per dataset it finds, with no schema to write and no pipeline to configure. Source code goes through tree-sitter, so it arrives with its symbols and line numbers rather than as flat text; CSV, JSON, YAML, SQLite, PDF, DOCX, HTML, mail and common log formats are handled too.
The project is aimed squarely at AI coding agents. Instead of an agent grepping and then reading whole files into its context, it queries XERJ and gets back ranked passages with file and line. The README's main use case is what it calls reference coding: the agent clones and indexes the open-source repositories closest to its task, then retrieves how they solved a problem before writing its own code. The project reports a controlled study in which this cut a coding agent's output tokens 2.7x compared with a grep-driven agent at the same solve rate, and notes the benefit is largest on private or niche code the model has not memorised.

Under the hood XERJ implements the Elasticsearch REST API — indices, documents, bulk, search, aggregations, mappings, kNN, scroll and the `_cat` endpoints — so existing Elasticsearch clients and Kibana can connect to it, and the project publishes an ES YAML conformance suite that runs on every commit. The same binary is also an MCP server, exposing search, semantic, vector and hybrid search plus durable agent memory (`/_memory/{namespace}`) and a second-brain link index as tools. It is licensed Apache-2.0.
What it does
- `xerj autoindex <folder>` infers datasets and builds typed indices from code, docs, logs, PDFs, SQLite, CSV and more, with no schema
- Tree-sitter, AST-aware code indexing plus CLI commands such as `xerj search` (ranked passages with file:line) and `xerj def` (go-to-definition)
- Full-text BM25, vector kNN and hybrid search through Elasticsearch-compatible query syntax
- Speaks the Elasticsearch REST API, so official clients and Kibana connect unchanged
- Built-in MCP server (`xerj mcp`) with ten tools covering search, agent memory and a knowledge-graph link index
- Single static binary for Linux, macOS and Windows on x86-64 and arm64, with an offline default embedder and an opt-in neural one
Getting started
XERJ installs as one binary. The quickstart below runs a local development node with TLS and auth turned off — the README stresses this is only for a single user on a dev machine, since every caller that can reach the port becomes a superuser. A fresh node binds 127.0.0.1 only.
Install the binary
The install script picks the prebuilt binary for your platform (by default into ~/.local/bin). On Windows use the PowerShell installer: `irm https://xerj.org/get.ps1 | iex`.
curl -fsSL https://xerj.org/get | shStart a local node and index a folder
Start the server, wait until http://localhost:9200 responds, then point autoindex at a project. XERJ creates one index per dataset it detects.
xerj --insecure --data-dir ./data &
xerj autoindex ~/my-project
Search from the CLI or any Elasticsearch client
Use the built-in commands for ranked passages and definitions, or query the Elasticsearch API directly.
xerj search "how do we rotate the WAL segment"
xerj def "euler_to_rotationmatrix"
curl localhost:9200/_cat/indices
curl "localhost:9200/ax-*/_search?q=checkout+error"Wire it into your coding agent
`xerj init` sets XERJ up for Claude Code or Cursor (MCP plus a skill). For other MCP hosts, run `xerj mcp` as a stdio server and point it at the node with an absolute path to the binary.
{
"mcpServers": {
"xerj": {
"command": "/home/you/.local/bin/xerj",
"args": ["mcp"],
"env": { "XERJ_URL": "http://localhost:9200" }
}
}
}Run with auth on for anything shared
Without --insecure, auth is on and an admin key is minted on first boot. Pass it to autoindex via XERJ_API_KEY (it is not read from xerj.toml).
xerj --data-dir ./data &
export XERJ_API_KEY="$(cat ./data/admin.key)"
xerj autoindex ~/my-projectCommands and code are distilled from the project's own documentation — always check the official repo for the latest.
When to use it
- Reach for it when a coding agent keeps reading whole files into context and you want it to retrieve the exact passage with file and line instead
- Reach for it for reference coding: index the open-source projects nearest your problem so the agent looks up how they solved it before writing code
- Reach for it to run a security audit or codebase Q&A across a large tree of mixed file types with one index command
- Reach for it when you want a lightweight, single-binary drop-in for Elasticsearch clients, logs and dashboards on a laptop or small host
How XERJ compares
XERJ alongside other open-source code indexing & search tools AI/TLDR tracks, ranked by GitHub stars.
| Tool | Stars | What it does |
|---|---|---|
| CodeGraph | ★ 74.3k | Builds a local SQLite knowledge graph of a codebase with a Rust tree-sitter kernel, keeps it in sync through a file watcher, and serves symbols, call paths and blast radius to coding agents over MCP. |
| GitNexus | ★ 47.9k | Indexes a codebase into a knowledge graph of dependencies, call chains and execution flows, then exposes it to Claude Code, Cursor and Codex through MCP tools. |
| codebase-memory-mcp | ★ 46.7k | A native MCP server that indexes a repository into a persistent tree-sitter knowledge graph of functions, call chains and routes, queried by agents through 15 tools. |
| code-review-graph | ★ 32.2k | A local-first code intelligence graph built with Tree-sitter that serves precise, incrementally-updated structural context to AI coding tools over MCP, so they read only the code a task needs. |
| Claude Context | ★ 12.6k | An MCP server that indexes your codebase into a vector database so AI coding agents can find relevant code by meaning instead of loading whole folders. |
| Graft | ★ 10.2k | Builds a persistent knowledge graph of your codebase as linked markdown files, then feeds the matching nodes to coding agents so they stop re-exploring the repo on every task. |
| XERJ | ★ 7k | A local, Elasticsearch-compatible search engine that auto-indexes any folder so coding agents query instead of grep |
| Semble | ★ 6.2k | A CPU-only code search library and MCP server that indexes a repository with tree-sitter chunking, Model2Vec embeddings and BM25, so an agent retrieves the few relevant snippets instead of grepping and reading whole files. |