MicroIndex MCP
Click on "Deploy 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., "@MicroIndex MCP Find where JWT authentication is implemented and show me the relevant code chunk"
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.
MicroIndex MCP (v1.0-lite)
Local AST + Vector Code Index & Minimalist FastMCP Server for ~90%+ AI Token Savings.
Stop letting coding agents burn 10,000+ tokens grepping and reading entire files just to find one method. MicroIndex parses your codebase with Tree-sitter ASTs, embeds compact structural chunks locally into LanceDB, and pairs a 2-tool FastMCP server (search_code, get_code_chunk) with Agentic Governance rules.
graph LR
Agent["AI IDE / CLI Agent<br/>(Claude Code, Cursor, Antigravity)"] -->|MCP stdio + PYTHONUNBUFFERED=1| Server["src/mcp_server.py<br/>(FastMCP: search_code, get_code_chunk)"]
Server -->|AST Chunking <= 1500 chars| TS["Tree-sitter<br/>.py / .ts / .tsx / .js / .php / .vue"]
Server -->|Local or Cloud Embeddings| Emb["all-MiniLM-L6-v2 (384d)<br/>or Ollama / OpenAI / Gemini"]
Server -->|INDEXER_DATA_DIR| LDB[("<project>/.lancedb_data<br/>+ index_state.json")]For AI Agents: Auto-Setup Protocol
Sharing this with your AI coding assistant? Paste the prompt below into Claude Code, Cursor, Antigravity, Codex, or Gemini CLI inside your target project — it will set up everything end-to-end.
Set up microindex-mcp for my current project:
1. Clone (or use existing) microindex-mcp at <PATH_TO_MICROINDEX_MCP> and run `make setup` if `.venv` does not exist.
2. Check which programming languages my current project uses. If any language is not yet in `src/languages/registry.py`, follow `templates/ADD_LANGUAGE_PROMPT.md` to add its Tree-sitter extractor first.
3. Index my current project with isolated storage:
`<PATH_TO_MICROINDEX_MCP>/.venv/bin/python -u -m src.indexer --project "$(pwd)" --db-dir "$(pwd)/.lancedb_data"`
4. Add `.lancedb_data/` to my project's `.gitignore` (if not already present).
5. Configure the MCP server for my active IDE/agent using `templates/mcp_config.example.json` (set `INDEXER_DATA_DIR` to `$(pwd)/.lancedb_data`, keep `PYTHONUNBUFFERED=1` and `-u`).
6. Install `templates/AGENT_RULES.md` and `templates/SKILL.md` into the appropriate rules/skills directory for my IDE/agent.
7. Summarize the indexed file/chunk counts and verify `search_code` is ready.Bootstrap shared runtime once: if
<microindex_dir>/.venvdoes not exist yet, ask the user to runmake -C <microindex_dir> setupin their terminal (saves agent tokens and shows live download progress), or run it once without polling.Verify language coverage: inspect
src/languages/registry.py(.py,.ts,.tsx,.js,.jsx,.mjs,.cjs,.php,.vue). Add missing Tree-sitter extractors viatemplates/ADD_LANGUAGE_PROMPT.md.Index target project cleanly:
<microindex_dir>/.venv/bin/python -u -m src.indexer --project "<target_project>" --db-dir "<target_project>/.lancedb_data"Keep target git clean: ensure
.lancedb_data/is in<target_project>/.gitignore.Register MCP stdio server: wire
"command": "<microindex_dir>/.venv/bin/python","args": ["-u", "<microindex_dir>/src/mcp_server.py"],"env": {"PYTHONUNBUFFERED": "1", "HF_HUB_OFFLINE": "1", "INDEXER_DATA_DIR": "<target_project>/.lancedb_data"}.Enforce Agentic Governance: copy
templates/AGENT_RULES.mdandtemplates/SKILL.mdinto the host's rules/skills paths (see Setting Up Agent Rules & Skills).
Related MCP server: Glancey
5-Minute Quickstart (For Humans)
# 1. Create .venv and install dependencies (uses uv automatically if available)
make setup
# 2. Index examples/polyglot-mini (PHP + Vue 3 + Python) and run benchmark
make bench
# 3. Run pytest quality gates (Hit@5, MRR, Token Savings, Latency, Incremental 0-reencode)
make testLinux CPU-only by default: On Linux,
make setupinstalls CPU-only PyTorch automatically (CUDA=0) to skip ~2.5 GB of CUDA wheels. Runmake setup CUDA=1if you want GPU/CUDA wheels.Token-Saving Tip: Prefer running
make setup,make bench, and initialmake indexon large repositories directly in your own terminal rather than through an AI agent — you'll see live progress bars and avoid burning agent context tokens on long install/indexing logs.
Benchmark Results (examples/polyglot-mini/)
Measured via make bench using tiktoken (o200k_base) against a realistic Baseline (Grep + Full-File Read) agent workflow across 6 queries (semantic, symbol, cross_stack):
Provider: local (all-MiniLM-L6-v2) | Files: 4 | AST Chunks: 44 | Queries: 6
Metric | Value |
Hit@5 |
|
MRR |
|
Avg Chunk Precision |
|
Latency (Avg / P50 / P95) |
|
Avg Tokens / Query (MicroIndex) |
|
Avg Tokens / Query (Baseline) |
|
Total Tokens (MicroIndex vs Baseline) |
|
Token Savings vs Baseline |
|
Note:
examples/polyglot-minionly contains 4 small files (~90 lines each). On larger multi-hundred-file repositories, fixedtop_k=5AST retrieval typically reaches 90–97% token savings.
Query ID | Category | Hit@5 | RR | Prec | Latency | AST Tok | Base Tok | Saved |
|
| PASS | 1.00 | 0.40 | 10.7 ms | 386 | 1145 | 66.3% |
|
| PASS | 1.00 | 0.40 | 9.5 ms | 882 | 2902 | 69.6% |
|
| PASS | 1.00 | 0.20 | 8.2 ms | 462 | 1145 | 59.6% |
|
| PASS | 1.00 | 0.20 | 9.1 ms | 878 | 1124 | 21.9% |
|
| PASS | 1.00 | 0.20 | 8.5 ms | 651 | 1778 | 63.4% |
|
| PASS | 1.00 | 0.40 | 8.7 ms | 891 | 2053 | 56.6% |
Real-World Production Case Studies (v1.0-lite, Anonymized)
Tested on three private production codebases using 10 developer-style queries each, synthesized from recent git commits (GEN_PROVIDER=gemini, local all-MiniLM-L6-v2 embeddings on CPU):
Codebase (Anonymized) | Files / AST Chunks | Hit@5 | MRR | Avg Precision | Avg Latency | Tokens / Query (AST vs Base) | Token Savings |
Monorepo A (PHP + Vue 3 + Python) |
|
|
|
|
|
|
|
Service B (PHP + Event-Driven) |
|
|
|
|
|
|
|
Service C (Python / AI Agent) |
|
|
|
|
|
|
|
Honest
v1.0-liteDiagnostic (Whyv2.0-hybridExists): Even with natural developer queries, ~10–20% of commit queries miss top-5 when pure denseall-MiniLM-L6-v2embeddings encounter exactcamelCaseidentifiers, dot-separated event names (chat.message.sent), or split methods that lost their parent classScopeheader. That empirical ceiling is exactly whatv2.0-hybrid(ASTScope/Callspassport + LanceDB BM25+Dense RRF) andv3.0-contextual(System-1 Cross-Encoder reranking) are designed to solve.

Install Once, Index Any Project (Own-Project Deployment)
You do not need to copy src/ into your repositories. Install microindex-mcp once in a shared folder and point it at any codebase using TARGET and INDEXER_DATA_DIR:
1. Index Your Repository
# Stores LanceDB + index_state.json inside /path/to/your-project/.lancedb_data
make -C /path/to/microindex-mcp index TARGET=/path/to/your-projectAdd .lancedb_data/ to your project's .gitignore.
(Optional) Add a 2-line shortcut to your own project's Makefile:
index:
/path/to/microindex-mcp/.venv/bin/python -u -m src.indexer --project "$(CURDIR)" --db-dir "$(CURDIR)/.lancedb_data"2. Connect the MCP Server to Your IDE / CLI Agent
Register a stdio MCP server pointing to the shared microindex-mcp .venv and set INDEXER_DATA_DIR to your project's .lancedb_data. See templates/mcp_config.example.json for ready-to-paste configs:
{
"mcpServers": {
"MicroIndex": {
"command": "/path/to/microindex-mcp/.venv/bin/python",
"args": ["-u", "/path/to/microindex-mcp/src/mcp_server.py"],
"env": {
"PYTHONUNBUFFERED": "1",
"HF_HUB_OFFLINE": "1",
"INDEXER_DATA_DIR": "/path/to/your-project/.lancedb_data"
}
}
}
}Tip for multiple repositories: In global configs (e.g. Antigravity
~/.gemini/antigravity/mcp_config.json), register one entry per repo (MicroIndex-backend,MicroIndex-frontend) with each entry pointingINDEXER_DATA_DIRto that repo's.lancedb_data.
3. Benchmark Your Own Repository (Auto-Generated from Git History)
Want to measure Hit@5 and token savings on your own codebase in 60 seconds? benchmarks/generate_queries.py samples random non-merge commits and builds a query suite compatible with make bench:
# 1-command benchmark on any repository (auto-generates queries + indexes + saves report)
make bench-repo TARGET=/path/to/your-project COUNT=10
# Add SHARE=1 to also generate an anonymized report, LinkedIn/X post text, and a 1200x630 SVG card:
make bench-repo TARGET=/path/to/your-project COUNT=10 SHARE=1
# Or generate a share card from any existing benchmark JSON report:
make share REPORT=benchmarks/reports/.../local__all-MiniLM-L6-v2_....json
# Or synthesize natural-language queries with a local Ollama model:
make bench-repo TARGET=/path/to/your-project COUNT=10 GEN_PROVIDER=ollama MODEL=llama3.1:8bPrivacy Warning: Using cloud LLM providers (
GEN_PROVIDER=openaiorGEN_PROVIDER=gemini) sends sampled commit messages and diff snippets to that external API (an interactive confirmation prompt is shown before any request). For private/NDA repositories, useoffline-template(default) orollama.
AI & Embedding Providers
Embedding Providers (src/embeddings.py)
Switch providers anytime via CLI flags (--provider, --model) or environment variables (MICROINDEX_EMBEDDING_PROVIDER, MICROINDEX_EMBEDDING_MODEL). If you change providers, MicroIndex automatically detects the mismatch in index_state.json and rebuilds vectors cleanly.
Provider | Env / CLI Value | Default Model | Required Env Vars | Notes |
Local (default) |
|
|
| 100% free, private, works offline once cached |
Ollama |
|
|
| Local GPU/CPU Ollama server |
OpenAI / Compatible |
|
|
| Works with OpenAI, OpenRouter, LM Studio, vLLM |
Google Gemini |
|
|
| Gemini Generative Language API |
Example with Ollama:
make index TARGET=/path/to/your-project PROVIDER=ollama MODEL=nomic-embed-textSupported AI Hosts (MCP Clients)
src/mcp_server.py uses standard FastMCP stdio and exposes 2 minimalist tools (search_code, get_code_chunk) to avoid tool-schema overhead across any MCP-compatible host:
Claude Code (
.mcp.json)Cursor (
.cursor/mcp.json)Google Antigravity (
~/.gemini/antigravity/mcp_config.json)VS Code Copilot / Windsurf (
.vscode/mcp.json)Codex CLI / Gemini CLI (global MCP config)
Setting Up Agent Rules & Skills
Indexing alone is only half the win — Agentic Governance forces your AI assistant to query the AST index before calling grep or read_file:
templates/AGENT_RULES.md— 4 strict rules banning blind full-file scans during discovery.templates/SKILL.md— 4-step context-preparation runbook (search_code→get_code_chunk→ boundedstart_line..end_line→ edit & re-index).
AI Client | Where to Copy | Where to Copy |
Claude Code | Append to |
|
Cursor |
|
|
Google Antigravity |
|
|
VS Code Copilot |
|
|
Codex / Gemini CLI | Append to |
|
Adding a New Language in 60 Seconds
Out of the box, MicroIndex supports Python (.py), TypeScript / JavaScript / TSX / JSX (.ts, .tsx, .js, .jsx, .mjs, .cjs), PHP (.php), and Vue 3 SFC (.vue, two-stage HTML + TypeScript parsing with exact line_offset).
Adding Go, Rust, Java, C#, Ruby, or Kotlin takes ~15 lines of Python:
Manual step-by-step guide: see
CONTRIBUTING.md.One-shot AI generator prompt: copy
templates/ADD_LANGUAGE_PROMPT.mdinto your AI assistant to generate, register, and wire tests for any Tree-sitter grammar automatically.
Version Roadmap (Git Tags)
Evolution path across releases (v1.0-lite → v2.0-hybrid → v3.0-contextual → v4.0-ast-edit):
Tag / Milestone | Status | Architecture & Capabilities |
| Released | AST chunking (Tree-sitter, |
| Planned | Deterministic AST passport ( |
| Planned | Two-Stage Retrieval with a lightweight local System-1 Cross-Encoder reranker (narrowing top-20 to top 2–3 chunks) + optional |
| Planned | Surgical MCP AST editing ( |
Community / Language Support | Ongoing | Expanding |
License & Attribution
Released under the MIT License.
Repository: github.com/ingvar-soloma/microindex-mcp
Author: Ihor Solomianyi (ingvarsoloma.dev | LinkedIn)
Open-Source Attribution: If
microindex-mcpsaves you tokens, speeds up your team, or inspires your own tooling, please keep a link back to the original repository and credit the author when sharing benchmarks or derivatives.
Need help rolling this out across a larger team or monorepo?
microindex-mcp is MIT-licensed and free to use. If you're running a multi-team monorepo and want help setting up shared CI base snapshots, custom language/DSL extractors, or automated token-budget gates in your CI/CD pipeline, feel free to reach out via ingvarsoloma.dev or LinkedIn.
Available Tools
2 toolsget_code_chunkGet Code ChunkC
Retrieve indexed AST chunks for a known file path instead of reading the whole file.
Inputs: file_path (required), node_type. Returns: result
search_codeSearch CodeB
Semantic AST code search. Always call this before reading files or running grep.
Inputs: query (required), top_k. Returns: result
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 2 tools
The two tools target different access patterns: search_code is query-driven semantic search, while get_code_chunk is path-driven retrieval of known files. Boundaries are mostly clear, though a caller may occasionally be unsure whether to use search_code results or fetch chunks directly for a file it already knows.
Both names use a consistent snake_case verb_noun pattern (search_code, get_code_chunk). The verbs accurately reflect their actions with no stylistic mixing.
Two tools is thin for a code-index server; the surface feels minimal and leaves no room for index management or inspection operations. It is focused but borderline under-scoped.
The read path is covered (find code, fetch chunks), but there are notable gaps: no indexing/refresh trigger, no index status or listing of indexed files/repos, and no symbol or metadata lookup. Agents can work around these only if the index is populated externally.
Maintenance
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.
Token-efficient search for coding agents over public and private documentation.
Codebase intelligence for AI agents — dead code, blast radius, ownership.
Related MCP Servers
- AlicenseNot gradedqualityCmaintenanceIndexes codebases and lets AI agents retrieve precise code snippets (functions, classes, routes) instead of reading entire files, reducing token usage and improving accuracy.18 npm7MIT
- AlicenseNot gradedqualityDmaintenanceAdds semantic code search to AI coding agents, enabling natural language queries across entire codebases to retrieve relevant code chunks, saving tokens and providing deep context.6 npm1MIT
- AlicenseAqualityBmaintenanceEnables AI coding agents to retrieve only the specific code sections that answer their questions, drastically reducing context usage while running fully locally.11MIT
- AlicenseNot gradedqualityBmaintenanceEnables AI coding agents to search indexed local codebases through AST-aware chunks with BM25 retrieval and CPU reranking, returning whole functions, classes and types instead of arbitrary token windows. It also exposes file outlines, dependency impact radius, related-test mapping, index statistics and reindexing, so agents can navigate and assess blast radius before editing without reading entire files.1MIT