Skip to main content
Glama

little-librarian

一个本地 MCP 服务器,用于索引 .epub 文件并提供由 pplx-embed-context-v1(后期分块)和 Qdrant 支持的语义搜索工具。

MCP client (Claude Desktop, Claude Code, …)
     │
     ▼  tool calls via MCP
 server.py
  pplx-embed-context-v1-0.6b  +  Qdrant (local)

文件

文件

角色

server.py

MCP 服务器 — epub 摄入、嵌入、搜索、Qdrant 存储

code_librarian.py

用于代码的独立 MCP 服务器(基于 AST 的分块)


Related MCP server: ragi

为什么选择 pplx-embed-context-v1

使用后期分块 (late chunking):来自同一章节的所有分块都经过单次前向传递,因此每个分块的嵌入都能捕获完整的文档上下文,而无需在推理时添加文档前缀。在 ConTEB 上得分为 81.96 nDCG@10。


快速开始

# 1. install
pip install -e .

# 2. ingest your library (runs embedding, then exits)
HF_HUB_OFFLINE=0 python server.py --index ./library

# 3. start the MCP server
python server.py

# optional: preload the model at startup
python server.py --preload

MCP 工具

工具

描述

search(query, top_k)

语义搜索,返回带有分数的 top-k 段落

search_groups(query, group_by, limit, group_size)

按 "book" 或 "chapter" 分组搜索 — 最适合跨卷研究

get_passage(book, chapter, max_chars)

检索书籍/章节的全文

list_books()

列出所有已索引的书籍及其章节数

collection_stats()

Qdrant 集合信息(点数、向量大小)

library_stats()

内容完整细分:书籍、章节、每本书的分块数、平均分块长度

get_device()

显示用于嵌入的设备(CPU/GPU)


Claude Desktop 配置

{
  "mcpServers": {
    "little-librarian": {
      "command": "python",
      "args": ["/path/to/server.py"]
    }
  }
}

硬件指南

设置

最小显存

仅 CPU

0 GB

GPU (pplx-embed-0.6b)

~2 GB

Related MCP Connectors

Related MCP Servers

  • F
    license
    Not graded
    quality
    D
    maintenance
    Local MCP server that provides semantic search (RAG) over code repositories, enabling AI clients like Claude and Gemini to access project context without manual re-upload.
    -
  • 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
    13 npm
    MIT
  • A
    license
    Not graded
    quality
    A
    maintenance
    MCP server for local RAG over personal notes, PDFs, and documents, enabling plain-English querying and hybrid search with multi-hop context expansion.
    MIT