mcp-leann

Create semantic search indexes for code and documents with AST-aware chunking.

31|3|Updated Dec 23, 2025
One-click install
npx skills add https://github.com/MichelKerkmeester/Opencode_Dev_Environment --skill mcp-leann
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: mcp-leann
Source: https://github.com/MichelKerkmeester/Opencode_Dev_Environment/tree/main/.opencode/skill/mcp-leann
Command: npx skills add https://github.com/MichelKerkmeester/Opencode_Dev_Environment --skill mcp-leann

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) and scripts (resource) components.

What problem does it solve?

LEANN provides ultra-efficient semantic search for code and documents within MCP environments, delivering up to 97% storage savings through graph-based selective recomputation. It enables fast, meaning-focused discovery without relying on external APIs or full embeddings.

Core Features & Use Cases

  • 97% storage savings by avoiding full embedding storage
  • Intent-based semantic search for code and documents
  • AST-aware chunking for improved search quality
  • RAG-style Q&A built-in to answer questions from retrieved context
  • Local-first operation with Ollama and multi-backend support

Quick Start

leann_build({ index_name: "my-project", docs: "./src" })

Frequently Asked Questions about mcp-leann

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I perform semantic search on my codebase without external APIs?

Semantic search for code retrieves documents by meaning rather than keywords. LEANN enables local-first semantic search using MCP, supporting index creation, intent-based queries, and RAG Q&A entirely offline with Ollama integration and optional HNSW or DiskANN backends.

What storage overhead does semantic search typically require?

Traditional semantic search stores full embeddings, consuming significant disk space. LEANN achieves 97% storage savings through graph-based selective recomputation, making large-scale code and document indexing practical without sacrificing search quality.

Can I use semantic search with AST-aware code chunking?

Yes. LEANN uses AST-aware chunking to split code intelligently based on syntax structure, improving search relevance beyond naive text splitting. This enhances retrieval accuracy when querying code repositories.

How do I build and query an index for my project?

Use leann_build({ index_name: "my-project", docs: "./src" }) to create an index from your source directory. Once built, perform semantic searches by meaning and ask questions using integrated RAG without external API calls.

Does LEANN work with existing MCP tool ecosystems?

Yes. LEANN is native MCP tooling with graph-based selective recomputation. It integrates as an MCP component supporting build, search, and ask commands, compatible with standard MCP environments and optional backend storage systems.