Skip to main content
Glama

lorme

Tests

LORME — Local Offline Retrieval & MCP Engine

An MCP server for semantic search over your local documents. Preprocesses, indexes, and serves any format — PDF, HTML, DOCX, markdown, and more. No cloud, no external database — just a single .db file on your workstation.

What it does

  • Preprocesses source documents in any format (PDF, HTML, DOCX, PPTX, XLSX, EPUB, images, audio, video, CSV, JSON, XML, markdown) into clean markdown

  • Indexes with vector embeddings and full-text search (hybrid FTS5 + vector with RRF fusion)

  • Serves three MCP tools (search_docs, list_indexed_sources, list_collections) for any MCP client

  • Evaluates retrieval quality with built-in RAG evaluation and parameter optimization

  • Runs locally with automatic GPU/API/CPU fallback for embedding generation

Related MCP server: Lexomni MCP

Quickstart

1. Install

From PyPI:

pip install lorme

Install extras by need:

  • pip install lorme — core (markdown only)

  • pip install "lorme[html]" — add HTML support (trafilatura)

  • pip install "lorme[pdf]" — add PDF/DOCX/PPTX support (Docling)

  • pip install "lorme[video]" — add video/audio download from YouTube/platforms (yt-dlp)

  • pip install "lorme[parse]" — all format support

  • pip install "lorme[eval]" — RAG evaluation (RAGAS)

From source:

git clone https://github.com/romainsc/lorme.git
cd lorme
pip install -e ".[parse]"

2. Create a config file

# config.yaml
database:
  path: ./lore.db

embedding:
  model: nomic-ai/nomic-embed-text-v2-moe
  mode: builtin    # builtin, builtin:gpu, builtin:cpu, api

chunking:
  chunk_size: 1024
  chunk_overlap: 128

See docs/configuration.md for all options.

3. Create a manifest

# manifest.yaml
collection: my-docs
level: libre

sources:
  - title: Architecture Guide
    license: Apache-2.0
    orig: architecture.pdf

  - title: API Reference
    orig: api-ref.html

  - url: https://example.com/guide.md

The manifest declares sources abstractly. orig is the source file in its native format. path (output filename) is generated automatically.

4. Preprocess and build

# Preprocess: convert + clean sources
lorme preprocess manifest.yaml \
  --config config.yaml \
  --docs-base-dir /path/to/corpus/ \
  --orig-dir orig \
  --prep-dir prep

# Build: index preprocessed sources
lorme build manifest-prep.yaml \
  --config config.yaml \
  --docs-dir /path/to/corpus/prep/ \
  --output-dir /path/to/output/ \
  --skip-optimize

Or combine both in one step:

lorme build manifest.yaml \
  --config config.yaml \
  --docs-dir /path/to/corpus/orig/ \
  --output-dir /path/to/output/ \
  --preprocess --skip-optimize

5. Start the MCP server

lorme --config config.yaml --transport sse
{
  "mcpServers": {
    "lore": {
      "url": "http://localhost:8000/sse"
    }
  }
}

Option B: subprocess (stdio)

{
  "mcpServers": {
    "lore": {
      "command": "/path/to/.venv/bin/lorme",
      "args": ["--config", "/path/to/config.yaml"]
    }
  }
}

6. Use from your MCP client

search_docs("how to configure authentication")
search_docs("deployment", top_k=10, collection="docs-libre")
list_indexed_sources()
list_collections()

Search uses hybrid retrieval (vector + FTS5 full-text) with Reciprocal Rank Fusion for better keyword matching alongside semantic similarity.

CLI commands

Command

Purpose

lorme

Start MCP server

lorme preprocess

Convert and clean sources

lorme build

Index sources into .db

lorme lint

Analyze source quality

lorme eval

Evaluate retrieval quality

lorme optimize

Auto-optimize parameters

lorme enrich

LLM enrichment (context, Q&A)

lorme state

Manage pipeline state (--list, --purge)

All commands accept --config config.yaml.

Architecture

Uses nomic-ai/nomic-embed-text-v2-moe for embeddings (768 dimensions, multilingual, Apache 2.0) and sqlite-vec for vector storage. Hybrid search combines vector KNN with FTS5 full-text via RRF fusion.

Preprocessing uses trafilatura (HTML, Apache 2.0), Docling (PDF/DOCX, MIT), and markitdown (CSV/JSON/XML, MIT).

See docs/architecture.md for the full design.

Roadmap

Done

  • SQLite + sqlite-vec storage with model validation

  • Embedding with GPU/API/CPU fallback

  • MCP server (search_docs, list_indexed_sources, list_collections)

  • Multi-collection support with license classification

  • Preprocessing tool (multi-format parsing, clean, dedup, PII detection, quality gate)

  • LLM enrichment (contextual retrieval, Q&A mode)

  • Hybrid search (FTS5 + vector + RRF fusion)

  • RAG evaluation and parameter optimization

  • Build workflow (manifest + config → optimized .db + metadata)

  • Unified config.yaml (no env vars)

  • MarkdownTextSplitter (structure-aware chunking)

  • Reranking (cross-encoder, granite reranker)

  • Adjacent-chunk / parent-child retrieval

  • End-to-end parameter optimization

  • CI/CD with GitHub Actions

  • Docker image (Containerfile)

  • Audio ingestion (STT via API)

  • Video ingestion (STT + frame extraction, 4 strategies: scene/interval/hybrid/OCR)

  • Video download from YouTube/platforms (yt-dlp, caption download → skip STT)

  • Resumable pipeline with per-phase hash (config change → auto re-run)

  • Configurable enrichment prompts (prompts.yaml, custom overrides)

  • Smart frame captioning filter (OCR before VLM)

  • Graceful shutdown (Ctrl+C → cleanup)

  • 554+ tests (TDD)

Next

  • pip install lorme (PyPI)

  • STT post-correction (LLM fix of transcription errors)

  • Detailed eval report (markdown)

AI-assisted development

This project is developed with AI assistance (Claude, Anthropic). All AI-assisted content is marked with Assisted-by and Co-Authored-By trailers in commits. Every contribution is reviewed, tested, and validated by a human.

See docs/ai-guidelines.md.

License

AGPL-3.0-or-later — see docs/adr/001-license-gpl-v3.md for the rationale.

Copyright (C) 2026 Romain Chantereau

Available Tools

3 tools
list_collectionsA

List available collections with chunk and file counts.

Only available in multi-collection mode (LORE_DB_DIR set).

Inputs: no named parameters. Returns: result

list_indexed_sourcesA

List all indexed files with chunk counts.

In multi-collection mode, specify a collection name or leave empty to list sources across all collections.

Inputs: collection. Returns: result

search_docsA

Semantic search over indexed documents.

Returns the most relevant passages for the given query, with similarity scores and source files. In multi-collection mode, specify a collection name or leave empty to search across all collections.

Inputs: query (required), top_k, collection. Returns: result

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    A4.2/5.0

    Scored across 3 tools

    Disambiguation5/5

    Each tool has a clear, distinct purpose: search_docs performs semantic search, list_indexed_sources lists indexed files, and list_collections lists collections. No functional overlap or ambiguity.

    Naming Consistency5/5

    All tool names follow a consistent verb_noun pattern in snake_case: search_docs, list_indexed_sources, list_collections. The naming is uniform and predictable.

    Tool Count5/5

    Three tools is well-scoped for a documentation retrieval server, covering search and listing operations without unnecessary bloat.

    Completeness4/5

    The core retrieval workflows are covered: searching documents, listing sources, and listing collections. Minor gaps exist, such as retrieving a full document by ID, but the surface is reasonably complete for a search-focused server.

    Maintenance

    ActivityMaintained
    ResponsivenessNo recent community issues

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      A
      quality
      D
      maintenance
      Local-first RAG indexing and semantic search MCP server. Enables document retrieval and context-aware queries using local embedding models.
      3
      15 npm
      MIT
    • A
      license
      Not graded
      quality
      C
      maintenance
      Provides MCP tools for semantic search over personal knowledge sources using pluggable embeddings and local vector indexing.
      1
      MIT
    • A
      license
      Not graded
      quality
      D
      maintenance
      Enables local semantic and full-text search over Markdown notes through MCP, returning relevant passages ranked by meaning and exact terms without requiring a GPU or hosted APIs.
      MIT