📚 librarian
以下摘录自该仓库的 README(片段) · 在 GitHub 读完整 README →
Turn any ebook into clean, token-counted Markdown chapters — let Claude read your
bookshelf over MCP and catch it misquoting your books. Deterministic RAG: no embeddings,
no network, no API keys.
Any input format — FB2, EPUB, DOCX, HTML, TXT/MD, text-layer PDF — becomes a directory of
clean chapters with token counts. No network, no LLM, no randomness: the same input always
produces byte-identical output.
Install
Offline contract: install and runtime need no network (the tokenizer's vocabulary is
vendored in the package).
Quick start
Commands
| Command | Purpose |
|---------|---------|
| lib ingest [--force] [--no-keep-source] [--config cfg.toml] [--verbose] | Process books into the library; prints a file · id · status · score table. |
| lib list [ ] | No argument — all books; with an id — that book's chapters (n, title, tokens, summary). |
| lib get | Print chapters by range (1-3,7) to stdout. |
| lib get --budget N [--from K] | Greedily print consecutive chapters from K while the token sum stays ≤ N. |
| lib find [--limit 10] [--book ] [--reindex] [--json] | Full-text search across chapters and titles/authors library-wide (bm25, snippets, RU/EN stemming). |
| lib info | JSON: book metadata + quality metrics. |
| lib doctor [ ] | No id — books in review and broken directories; with id — that book's report. |
| lib reingest --all [--config cfg.toml] [--verbose] | Rebuild the library from source/ with the current code/config. |
| lib rm | Delete a book and rebuild the index. |
| lib serve [--library ] | Stdio MCP server over the library. |
| lib verify "quote" [--book ID] [--json] [--limit N] | Check a quote against one book or attribute it across the library. |
Library root: --library (or the LIB_HOME env var, default ./library). Data goes
to stdout, diagnostics to stderr. Exit codes: 0 success, 1 runtime error, 2 usage error.
Give Claude your bookshelf
librarian-cli ships a built-in stdio MCP server with 6 read-only tools — list_books,
list_chapters, find, get_chapters, book_info, verify_quote — so Claude can browse
the catalog, search it, pull chapters under a token budget, and check its own quotes against
the source on its own: deterministic RAG with no embeddings, no network, and no API keys.
Claude Code:
Claude Desktop (claude_desktop_config.json):
Verify quotes
*An MCP server that catches Claude misquoting your books.*
lib verify "quote" checks whether a quote actually appears in your library, verbatim —
punctuation, case, ё/е, and markdown formatting don't count. Two modes:
- **Book mode** (--book ): full scan of one book — "does this book actually say
this?" Works without the search index.
- **Shelf mode** (no --book): attribution across the whole library via FTS5 candidates —