AI coding agents needsurgical context
Pre-index your repo. Serve precise subgraphs over MCP to Cursor, Claude Code, OpenCode, and more — no cloud, no external database. Surgical context, fewer tool calls, blast-radius awareness, 100% local.
Index once.
Query smarter.
MCP-Native Server
85+ tools for search, impact analysis, call graphs, ontology, and architecture visualization. Works with Claude, Cursor, OpenCode, Gemini, and Kilo. Connect instantly—no configuration required.
Semantic + Keyword Search
HNSW embeddings for dense-vector retrieval with cross-encoder reranking. Keyword + semantic + ontology search in one query. Find code by intent, not just syntax.
Impact Radius Before You Change
Compute blast radius with confidence and severity ratings. Build call graphs with IMPORTS, CALLS, TESTED_BY, and HTTP edges. Know exactly what breaks.
Procedural Ontology Auto-Update
Edit ontology/workflows.yaml while serving. Watcher auto-syncs so kg_trace_workflow returns corrected steps without restart. Source of truth YAML.
Local-First + Team Deploy
SQLite by default for individuals. Multi-project RocksDB for teams. Docker with embedded http MCP. 100% local execution—no cloud, no external database.
Token-Aware Payloads
TOON responses compress subgraphs by ~40%. Targeted MCP payloads match AI token budgets. Precise context instead of full-file dumps.
Community Detection & Architecture
Leiden clustering with per-cluster skill context. Map team topology and service dependencies. Export as Mermaid, DOT, GraphML, or Neo4j.
The numbers speak
for themselves.
Vector-engine A/B gate (100 synthetic agent tasks). Unified agent A/B (19 cases vs grep baseline). Load test on ~100K nodes. Full methodology: docs/benchmark.md
| Metric | LeanKG | Without LeanKG | Winner |
|---|---|---|---|
| Token Reduction | −65.0% | 0% | ≥ 60% floor |
| Tool-Call Reduction | −84.6% | 0% | ≥ 80% floor |
| Speedup | 2.50× | 1× | ≥ 2× floor |
| 1M SQ8 ANN P95 Latency | ~0.055 ms | N/A | < 50 ms |
| Insert Throughput | ~57K/sec | — | 100K nodes |
| Retrieve Throughput | ~419K/sec | — | Cold → warm 345-461× |
Token Reduction
−65%
synthetic agent workload
Tool-Call Reduction
−84.6%
fewer round-trips
Speedup
2.50×
vs grep baseline
Find Code by Intent
Not by Syntax
Dense-vector embeddings with cross-encoder reranking help AI tools find exactly what they need. Query by intent, get results by semantic relevance.
Top Results for: Find authentication patterns
Dense Embeddings
384-dimensional vectors capture semantic meaning
HNSW Indexing
Hierarchical Navigable Small World for fast similarity search
Cross-Encoder Reranking
Fine-grained relevance ranking for precise results
Why LeanKG
LeanKG is built for AI agents in teams. MCP-native. Indexed once, served precise subgraphs. No cloud, no external database. Works with Claude, Cursor, OpenCode, Gemini, Kilo, Codex.
Fewer Tool Calls, Surgical Context
Targeted subgraph retrieval instead of file-by-file search. −84.6% fewer tool calls. TOON payloads ~40% smaller. Your AI gets exactly what it needs.
85 MCP Tools, Always Fresh
Search, impact radius, call graphs, ontology, architecture. Procedural workflow auto-sync. Watcher mode keeps graph live as code changes.
Local-First, No Cloud Lock-In
SQLite for individuals. RocksDB for teams. Docker with HTTP MCP. 100% local execution. Multi-repo support with zero external databases.
Why Choose LeanKG
- ✓You pay per token - −65% token reduction, −84.6% tool calls
- ✓You use Claude, Cursor, OpenCode, Gemini, Kilo - instant MCP setup
- ✓You need impact radius before shipping - blast-radius analysis with confidence
- ✓You want local-first no cloud lock-in - SQLite, RocksDB, Docker
Built on Proven Tech
- Language Support: Rust, Go, C/C++, Java, Kotlin, TypeScript, Python, Ruby, PHP, Dart, Terraform, YAML
- Storage: Rust + CozoDB + tree-sitter. SQLite or RocksDB backend
- Protocol: MCP stdio (editor agents) or MCP HTTP (Docker, teams)
- Deployment: Binary, Docker, or build-from-source. All open-source
Feature Comparison
| Tool | MCP Tools | Token Format | Android | Microservices | Procedural |
|---|---|---|---|---|---|
| LeanKG | 85 | TOON | ✓ | ✓ | ✓ |
| codebase-memory-mcp | 15 | Standard | — | — | — |
| GitNexus | 17 | Standard | — | — | — |
| graphify | Std | Budget | — | — | — |
| codegraph | 1 | Standard | — | — | — |
Built on proven tech
Rust + CozoDB + tree-sitter. Local-first. No SaaS lock-in. Runs as an MCP HTTP server on :9699 or over stdio.
Works with your
entire codebase.
Full semantic type resolution for Python, TypeScript, Go, Rust, Java, Kotlin, C#, PHP, and C/C++. Syntactic parsing for 158+ languages.
Python
FullImports, dataclasses, generics, @property, async/await, Pydantic
TypeScript/JavaScript
FullGenerics, JSX, JSDoc inference, .d.ts, re-exports, method chaining
Go
FullGenerics, embedded structs, interface satisfaction, package resolution
Rust
Fulluse declarations, impl blocks, generics, trait bounds, UFCS, std prelude
Java
FullImports, class hierarchies, generics, annotations, lambdas, JDK stdlib
Kotlin
FullClasses, objects, extensions, data classes, scope functions, stdlib
C#
FullGlobal usings, records, LINQ, async Task, generics, BCL stdlib
PHP
FullNamespaces, traits, late-static-binding, PHPDoc inference
C/C++
FullMacros, typedef chains, templates, namespaces, auto inference
+ 149 more
SyntaxTree-sitter parsing support for all major languages
Why multiple language levels?
Full support means semantic type resolution powered by Hybrid LSP — the graph understands imports, generics, inheritance, and stdlib types just like an IDE would. Syntax support means tree-sitter parsing captures structure and declarations. Both give you accurate call graphs and dependency tracking.
Three simple steps.
Targeted context. Not full scans.
1# macOS / Linux2curl -fsSL https://raw.githubusercontent.com/FreePeak/LeanKG/main/scripts/install.sh | bash -s -- cursor34# Or for Claude Code5bash -s -- claude67# For teams / Docker8bash -s -- docker
85 MCP tools.
The broadest surface.
More atomic tools than any competitor (1-17). Query with surgical precision instead of blunt grep. Works with Claude, Cursor, OpenCode, Gemini, and more.
One-line install for any AI tool: