index1: MCP Server that saves 90%+ context tokens with hybrid search

Resolved 💬 2 comments Opened Feb 6, 2026 by robotmem Closed Mar 6, 2026

What is index1?

An MCP Server that gives Claude Code BM25 + vector hybrid search with dramatically lower context window usage.

The Problem: Context Window Waste

Claude Code's built-in Grep is fast (4ms) and precise, but it returns every matching line across the entire project. For common queries, this floods the context window:

| Query | Grep Results | Context Tokens |
|-------|-------------|---------------|
| search | 881 lines | ~35,895 |
| watch | 457 lines | ~35,147 |
| embedding | 217 lines | ~5,803 |

With 20 broad searches in a session, Grep can consume 300k tokens — 150% of a 200k context window, forcing early compression and losing conversation history.

index1: Same Queries, 90–99% Less Context

index1 returns ranked top-k results instead of everything:

| Query | Grep Tokens | index1 Tokens | Savings |
|-------|------------|---------------|---------|
| search | 35,895 | 411 | 99% |
| watch | 35,147 | 467 | 99% |
| embedding | 5,803 | 514 | 91% |

20 searches per session:

| Approach | Total Tokens | % of 200k Window |
|----------|-------------|-----------------|
| Grep only | 300,000 | 150% (overflows!) |
| index1 only | 9,200 | 5% |
| Mixed | 100,000 | 50% |

Semantic + Cross-Language Search

Beyond context savings:

1. Understands query intent

Query: "how to configure watch paths"
Grep:  needs 3 separate searches + manual cross-referencing
index1: single query → top 5 ranked results

2. Cross-language queries

Query: "搜索是怎么工作的" (Chinese: "how does search work?")
Grep:  0 useful results (can't match Chinese → English code)
index1: returns search.py, mcp_server.py ranked by relevance

Quick Start (2 minutes)

pip install index1

.mcp.json:

{
  "mcpServers": {
    "index1": {
      "command": "index1",
      "args": ["serve"]
    }
  }
}
index1 index .

Done. Claude Code calls docs_search automatically.

When to Use What

Known identifier (function/class name)  → Grep (4ms, precise)
Exploratory question ("how does X work") → index1 (semantic)
Cross-language query (CJK → English)     → index1 (only option)
Common keyword (50+ expected matches)    → index1 (saves 90%+ tokens)

They're complementary. Grep is the precision missile, index1 is the semantic radar.

Architecture

  • Hybrid search: BM25 (FTS5) + vector (sqlite-vec), fused with RRF
  • 5 MCP tools: search / get / status / reindex / config
  • Structure-aware chunking: Markdown / Python / Rust / JS / Text
  • Graceful degradation: No Ollama → BM25-only automatically
  • Cache: L1/L2 query cache, < 1ms for repeated queries
  • Single SQLite file: Zero external database dependencies

Links

Would love any feedback from the Claude Code team or community!

View original on GitHub ↗

This issue has 2 comments on GitHub. Read the full discussion on GitHub ↗