
Code Index
io.github.achreftliliPublished by GitHub account achreftliliv1.0.6Updated Oct 24, 2026
SQLite-backed hybrid (vector + FTS) code search index for Claude Code over MCP.
Overview
Local SQLite-backed hybrid vector and full-text code index that lets an assistant search symbols, outlines and call graphs in a repository instead of grepping.
- What you can do
- Search code by concept with hybrid vector plus full-text search, or look up exact symbol names
- Outline files and whole directory subtrees, and locate the enclosing symbol for a file position
- Fetch symbol bodies individually or in batches
- Trace call graphs: callers, callees, references, transitive traces, and file imports
- List files touched in recent git commits and propose same-file renames as an edit list
- Administer the index: build or refresh it, check setup, install the auto-reindex hook, show stats and verify integrity
- When to use it
- Useful when an assistant works in a medium or large repository and should answer questions like where a function is defined, what calls it, or where a concept lives, without reading whole files. Best for Python, TypeScript/JavaScript, Go and Rust codebases where fast offline retrieval beats blind file reads.
- Requirements
- Runs locally over stdio as a PyPI package (mcp-code-index), typically launched with uvx or installed with pip. Needs Python 3.10+ with loadable SQLite extension support for sqlite-vec, and about 600 MB of disk for the embedding model, which is downloaded from Hugging Face on first init. No API keys or accounts. Optional environment variables such as CODE_INDEX_DB, CODE_INDEX_EMBED_DEVICE and CODE_INDEX_EMBED_BATCH tune the index path and embedding device.
Installation
In SourceWeft
- Open Code Index in the dashboard and add it to a workspace.
- Enable the server for the chats that should use its tools.
Desktop only via STDIO. STDIO servers start a local process, so they need the SourceWeft desktop host.
Other MCP clients
Follow the launch instructions in the repository.
README
code-index
A local, SQLite-backed code index for Claude Code, exposed over MCP. It
replaces blind Read / Grep / Glob exploration with targeted retrieval —
"where is parseAuthToken defined", "what calls Indexer.reindex_all", "find
the rate-limiting code" — answered in milliseconds against an offline index.
No API keys. No external services. The embedder runs locally on your machine.
How it works (30-second tour)
- Parse your repo with tree-sitter (Python, TypeScript/JavaScript, Go, Rust).
- Chunk code per symbol and expand identifiers (
getUserAuthToken→get user auth token) so search matches both styles. - Embed each chunk locally with
jina-embeddings-v2-base-code(768-dim) via sentence-transformers. - Store symbols, chunks, vectors, and call/import edges in
.claude/index.db(SQLite + sqlite-vec + FTS5). - Serve 14 retrieval tools + 1 admin tool over MCP (see Tools).
- Stay fresh via an optional
PostToolUsehook that incrementally re-indexes touched files.
Tools
Retrieval
Admin
embed_query_debug is a dev-only ranking diagnostic, hidden from list_tools
unless CODE_INDEX_DEBUG=1 is set.
All tools return bounded JSON; large bodies use get_symbol_body rather than
inlining whole files.
Requirements
- Python 3.10+ with loadable SQLite extension support (required by
sqlite-vec).- Python 3.13 has this enabled by default.
- On 3.10–3.12, install via the python.org installer or via pyenv with
PYTHON_CONFIGURE_OPTS=--enable-loadable-sqlite-extensions pyenv install 3.12.x. - Homebrew Python often ships without the extension hook — use one of the two methods above instead.
uv/uvx(install) — recommended runner. Orpipif you prefer a permanent install.- ~600 MB free disk for the embedding model on first init.
Quick start (Claude Code)
One command, no API keys:
Then open Claude Code in any repo and ask:
"Build the code index for this repo."
Claude calls the init MCP tool, which writes .claude/index.db. From then on,
ask things like "where is parseAuthToken defined?" or "what calls
Indexer.reindex_all?" — Claude routes them through symbol_lookup /
callers / code_search instead of grepping.
What
--refreshdoes — fetches the latest PyPI release on every Claude Code launch. Convenient during preview; drop it once you want to pin a version (saves ~1s of startup).Project-only install — drop
-s userto register the server in the current project's.claude/settings.jsoninstead of the global~/.claude.json.First-run model download — the first
initpullsjina-embeddings-v2-base-code(~600 MB) into~/.cache/huggingfaceand caches it forever. Subsequent runs are fully offline. If your network blocks Hugging Face, pre-warm the cache from a machine that has access.Already installed without
--refresh? Runclaude mcp remove code-indexfirst, then re-run the command above.
Alternative: permanent install (no uvx)
Optional: keep the index live as you edit
Without a hook, the index drifts when files change outside the agent (mv,
git checkout, IDE saves) until you call init again. With one, every
Edit / Write / MultiEdit Claude performs triggers an incremental reindex
of the touched file.
Easiest path: ask Claude. On first use in a new project, ask "set up the
code-index" — Claude calls setup_check → install_hook → init. The hook
command is derived from how the MCP server was launched (uvx-aware), so it
uses the same Python toolchain. Hook output goes to .claude/code-index-hook.log
so failures are debuggable.
Manual install — add this block to the project's .claude/settings.json
under hooks.PostToolUse (the version you want depends on how you launch the
server — install_hook derives the right one for you):
In other MCP-compatible agents
The server speaks standard MCP over stdio, so any client that supports MCP
servers works (Cursor, Continue, Cody, Zed, etc.). Configure the client to
launch uvx --refresh --from mcp-code-index code-index-mcp (or
code-index-mcp after pip install mcp-code-index). Once connected, call the
init tool from inside the client to bootstrap the index. Drop --refresh
when you want to pin to a stable version instead of always pulling latest.
From source (development)
Configuration
All settings are optional — the defaults work out of the box. Override them via
environment variables. Inside Claude Code, set them in the env block of your
code-index server entry in ~/.claude.json (then reconnect the MCP server).
Common knobs (most users only ever touch these):
Advanced (rarely needed):
Troubleshooting
init fails with MPS backend out of memory on Apple Silicon. A large
file produced a chunk batch bigger than your GPU's free VRAM. Quickest fix —
re-run on CPU (slower but bulletproof):
To stay on the GPU, shrink the batch instead: "CODE_INDEX_EMBED_BATCH": "8".
Reconnect the MCP server (/mcp → reconnect, or restart Claude Code) so the
new env takes effect. init is incremental — already-embedded files are
skipped on the retry.
init fails with a Hugging Face network error on first run. Your network
is blocking model downloads. Pre-warm the cache on a machine that has access:
sqlite3.OperationalError: not authorized or sqlite-vec fails to load.
Your Python build doesn't have loadable SQLite extensions. See
Requirements — install via python.org or a pyenv build with
PYTHON_CONFIGURE_OPTS=--enable-loadable-sqlite-extensions.
code_search / symbol_lookup returns stale paths after a refactor or
branch checkout. The auto-reindex hook only fires on Claude's Edit /
Write / MultiEdit. After bulk file moves outside the agent (mv,
git checkout, IDE rename), re-run init (it's incremental). Or wire up the
hook so the index keeps up with
agent edits automatically.
Layout
Source: README.md at commit 27a6bf8
Tools
0Version history
1- v1.0.6LatestSep 16, 2026
Score
50% of the applicable checks met
How complete this listing is, computed from the registry entry, the endpoint and public sources. Not a rating of the server and not a statement that it is safe or working today: reachability is a dated check, and no installs or reviews go into the score.
- Reached in the last 30 days25 pts
Keep the endpoint answering the MCP handshake; SourceWeft probes it every 30 days.
- Auth declared10 pts
Declare the credential headers in the registry entry, or keep the endpoint answering the probe so its auth can be classified.
- Tools listed15 pts
Answer tools/list without a credential, or ship a package that starts in a sandbox without one.
- DescriptionRequired15 pts
- Logo10 pts
- Documentation15 pts
- License10 pts