cindex
Click on "Install Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@cindexsearch for where we handle file uploads"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
cindex
Local, offline semantic code search: tree-sitter AST chunks → local GGUF embeddings (Qwen3-Embedding-0.6B via llama-server) → SQLite → brute-force vector search → CLI + MCP tool for coding agents. No network calls, no API keys. The index is content-addressed, so unchanged code is never re-embedded — reformatting a repo or moving files/functions costs zero inference.
What gets indexed: Python, C++, JavaScript (AST chunks: functions, class skeletons with bodies stripped, merged top-level blocks), Markdown (heading sections), plain text (100-line windows). Other file types are currently skipped (see roadmap).
Setup
macOS
git clone <this-repo> && cd code-indexer
uv sync # install python deps from the lockfile
brew install llama.cpp # provides llama-serverLinux
git clone <this-repo> && cd code-indexer
curl -LsSf https://astral.sh/uv/install.sh | sh # if uv is not installed
uv sync
# llama.cpp: use a prebuilt release from https://github.com/ggml-org/llama.cpp/releases
# or build from source:
git clone https://github.com/ggml-org/llama.cpp && cd llama.cpp
cmake -B build -DCMAKE_BUILD_TYPE=Release
cmake --build build --config Release -j
sudo cp build/bin/llama-server /usr/local/bin/ # or add build/bin to PATH
cd ..Model weights (both platforms, one time, ~630 MB, gitignored)
uv tool install "huggingface_hub[cli]"
hf download Qwen/Qwen3-Embedding-0.6B-GGUF Qwen3-Embedding-0.6B-Q8_0.gguf --local-dir models/Related MCP server: CodeGrok MCP
Starting it
Terminal 1 — the inference server. Leave it running; Ctrl-C stops it.
uv run cindex serveAlways start llama-server through cindex serve: it pins flags the client depends
on (--pooling last -ub 4096 -b 4096; without -ub the server crashes on long
inputs — details in docs/llama-server-pinned.md).
Terminal 2 — build the index, then query.
uv run cindex init # create the database (one time)
uv run cindex index # embed the repo; re-run any time, only changes cost inference
uv run cindex query "where do we decide if a file needs re-embedding" -k 5Every command fails fast with the fix in the message (server down, no index yet, model/config mismatch), so if something's wrong the output says what to run.
Using it
uv run cindex query "natural language question" # top 8 by meaning
uv run cindex query "..." -k 3 # fewer results
uv run cindex query "..." --path src/ # restrict to a subtree
uv run cindex query "..." --no-instruct # raw query embedding (A/B)
uv run cindex index # refresh after editing codeResults are score file:start-end [chunk-type] symbol plus the live snippet read
from disk. Stale results self-heal: if a file changed since indexing, the hit is
re-indexed inline and correct line numbers are returned.
Multiple indexes (one config = one root = one database)
The default config.toml indexes this repo. To index any other tree, copy
documents.toml's pattern — set root (relative to the config file) and a
distinct db — and pass --config:
uv run cindex --config documents.toml index # workspace-wide index
uv run cindex --config documents.toml query "..." --path 6106 # scope to one projectQuerying the default config only searches this repo; if you expected results from
a sibling project, you queried the wrong index — add --config.
Agents (MCP)
Opening this repo in Claude Code auto-registers the search_code tool via the
committed .mcp.json (approve the server when prompted). AGENTS.md instructs
agents to prefer it over grep for meaning-based lookup. Requirements: cindex serve
running; the MCP server creates/updates the index itself at session start and
repairs stale files lazily at query time.
To give agents in ANY directory a workspace-wide index, register at user scope:
claude mcp add cindex --scope user -- uv --directory /abs/path/to/code-indexer run cindex --config documents.toml mcpAgents can pass path_prefix to search_code to stay inside one subproject.
Upcoming improvements
More languages — TypeScript, Go, Rust, Java: each is one tree-sitter wheel + one walker extension entry + one chunker
LangSpec.Catch-all indexing — unknown text file types as blob windows so nothing is invisible, just coarser.
Chunker versioning — stamp
chunker_versionin meta and force re-chunk on upgrade (today an unchanged file keeps its old chunking).Finer prose chunking — paragraph windows for
.txtinstead of 100-line blobs.ANN search (sqlite-vec) once brute-force matmul exceeds ~50 ms (~10⁶ chunks).
int8 quantization — the
encodingcolumn is already reserved for it.Watcher daemon — filesystem events instead of explicit
cindex index.Hybrid ranking — path/symbol signal fused at rank time (never into content vectors), plus optional reranker.
Bench harnesses — speed + recall regression tracking with tagged baselines.
GPU offload flags — config-only change when needed.
Layout
src/cindex/ config db walker hasher chunker embedder indexer search resolver cli mcp_server
docs/ llama-server-pinned.md — the pinned inference server contract
config.toml default index (this repo) · documents.toml — example second index
.mcp.json wires Claude Code to `cindex mcp` · AGENTS.md — usage instruction for agentsAvailable Tools
1 toolsearch_codeA
Semantic search over this repo's code and docs. Finds code by meaning (e.g. "where do we refuse a mismatched database"), not just exact text — use it before falling back to grep. Returns JSON: file_path, start/end lines, symbol, score, snippet. Optional path_prefix restricts results to a subtree (e.g. "src/").
| Name | Required | Description | Default |
|---|---|---|---|
| k | No | ||
| query | Yes | ||
| path_prefix | No |
Output Schema
| Name | Required | Description |
|---|---|---|
| result | Yes |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
No annotations provided, so the description carries the burden. It discloses that the tool returns JSON with specific fields (file_path, start/end lines, symbol, score, snippet) and supports optional path_prefix. No destructive behaviors implied; it is a read-only search, which is clear from context.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
Three sentences: first states purpose, second explains how it differs from grep, third describes output and optional features. No wasted words, front-loaded with main action.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
For a search tool, the description covers the essential: what it searches, how it differs from alternatives, what it returns, and optional parameters. Even though the output schema is mentioned as present in context, the description itself adequately describes the return format. No major gaps.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Schema description coverage is 0%, so the description must compensate. It explains the query parameter (the search term), path_prefix with an example ('src/'), but does not mention the k parameter (integer, default 8). The return fields described are not parameters, so partial coverage.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description clearly states the tool performs semantic search over code and docs, distinguishes itself from exact text search (grep), and provides a concrete example query. The verb 'search' and resource 'code and docs' are specific.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
Explicitly advises use before falling back to grep, establishing a clear ordering between tools. Also explains the path_prefix parameter to restrict results to a subtree, guiding when to use that.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections. Dates show when Glama detected each change.
1 tool update
v0.1.0- First observed
search_code
TDQS
With only one tool, there is no possibility of ambiguity between tools. The tool is clearly and uniquely defined.
The single tool name 'search_code' follows a clear verb_noun pattern (snake_case), which is consistent within the server.
One tool is on the lower end of appropriateness. While the server's purpose (semantic code search) is narrow, a single tool may feel thin for a typical MCP server; however, it is not extreme.
The single tool covers semantic search over code and docs, which appears to be the server's complete purpose. Minor gaps like index management are absent, but not necessarily required based on the description.
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Related MCP Connectors
Code intelligence for coding agents: semantic, AST, graph, and full-text search. 279+ languages.
Shared memory for coding agents. Stop re-explaining your codebase every session.
Project memory, semantic code search, and grounded agent context.
Code intelligence for LLMs. Analyze, search, and retrieve code from any public git repository.
Related MCP Servers
- FlicenseNot gradedqualityDmaintenanceProvides semantic code search capabilities that run 100% locally using EmbeddingGemma embeddings. Enables finding code by meaning across 15 file extensions and 9+ programming languages without API costs or sending code to the cloud.236-
- AlicenseNot gradedqualityFmaintenanceEnables semantic code search for AI assistants by indexing codebases with embeddings and Tree-sitter, returning relevant snippets via natural language queries.15MIT
- AlicenseAqualityDmaintenanceProvides semantic code search over codebases using local embeddings with natural language queries. Supports hybrid search, file watching, and respects .gitignore.115MIT
- FlicenseNot gradedqualityDmaintenanceEnables local semantic code search across repositories using natural language, with AST-aware chunking and hybrid vector/FTS5 retrieval.-
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/aarontrmartin/code-indexer'
If you have feedback or need assistance with the MCP directory API, please join our Discord server