Converts ebooks into clean Markdown chapters to enable deterministic RAG and quote verification for AI clients.
다른 이름 Terobyte/librarian-cli, librarian-cli
- 스타
- 2
- Tools
- —
- 다운로드, 30일
- 169
- 최신 버전
- 0.1.1
- 마지막 커밋
- 2026년 9월 1일
- 라이선스
- MIT
Librarian MCP란?
Librarian은(는) MCP server입니다. Converts ebooks into clean Markdown chapters to enable deterministic RAG and quote verification for AI clients.
프로젝트 README에서 생성된 요약
Librarian MCP server 정보
Converting ebooks into clean Markdown chapters for deterministic RAG is what Librarian enables for developers using AI clients. It transforms various formats like EPUB, FB2, DOCX, and text-layer PDFs into a structured library of chapters with precise token counts. This process happens entirely locally without any network access, embeddings, or API keys, ensuring that the same input always produces byte-identical output.
Users can connect this server to Claude Desktop or Claude Code via a stdio MCP connection. Once configured with a library path, the server provides six read-only tools including list_books, find, and verify_quote. These tools allow an AI to browse a catalog, perform full-text searches using BM25, and retrieve specific chapters within a defined token budget. It is specifically designed to help AI models verify their own quotes against the original source text to prevent hallucinations.
활용 사례
- 1Search ebook librariesPerform full-text searches across all titles and authors in a local collection.
- 2Retrieve text within token limitsPull consecutive chapters from a book while staying under a specific token budget.
- 3Audit book qualityEvaluate the structure and encoding quality of ingested ebook files.
프로젝트의 README를 바탕으로 작성되었습니다. 모든 활용 사례는 해당 내용의 인용문과 대조하여 확인합니다.
Librarian MCP 설치 방법
형식 확인: 2026년 11월 10일Cursor에 추가Goose에 추가Claude Code에 Librarian MCP 설치
$ claude mcp add librarian-cli -- uvx librarian-cliCursor에 Librarian MCP 설치
~/.cursor/mcp.json
{
"mcpServers": {
"librarian-cli": {
"command": "uvx",
"args": [
"librarian-cli"
]
}
}
}VS Code에 Librarian MCP 설치
.vscode/mcp.json
{
"servers": {
"librarian-cli": {
"type": "stdio",
"command": "uvx",
"args": [
"librarian-cli"
]
}
}
}VS Code CLI에 Librarian MCP 설치
$ code --add-mcp '{"name":"librarian-cli","type":"stdio","command":"uvx","args":["librarian-cli"]}'Claude Desktop에 Librarian MCP 설치
claude_desktop_config.json
{
"mcpServers": {
"librarian-cli": {
"command": "uvx",
"args": [
"librarian-cli"
]
}
}
}Codex에 Librarian MCP 설치
$ codex mcp add librarian-cli -- uvx librarian-cliCodex config.toml에 Librarian MCP 설치
~/.codex/config.toml
[mcp_servers.librarian-cli] command = "uvx" args = ["librarian-cli"]
Gemini CLI에 Librarian MCP 설치
$ gemini mcp add -s user librarian-cli uvx -- librarian-cliGemini settings.json에 Librarian MCP 설치
~/.gemini/settings.json
{
"mcpServers": {
"librarian-cli": {
"command": "uvx",
"args": [
"librarian-cli"
]
}
}
}구성
LIB_HOMELibrary root directory (default ./library)
| 이름 | 설명 | 유형 |
|---|---|---|
| LIB_HOME | Library root directory (default ./library) |
자동 검사
2026년 11월 14일에 실행됨전체 보고서 →자동 검사를 통과했습니다. 이는 보안 감사가 아닙니다. 코드를 직접 읽고 서버에 필요한 최소한의 권한만 부여하십시오. 검사 방식
- 소스 저장소 연결 및 접근 가능terobyte/librarian-cli is public and reachablegithub.com/terobyte/librarian-cli ↗통과
- 패키지가 이 저장소를 소스로 명시librarian-cli names terobyte/librarian-cli as sourcepypi.org/project/librarian-cli/ ↗통과
- 빌드 출처(Sigstore 증명)Sigstore attestation for librarian-clipypi.org/project/librarian-cli/ ↗통과
- 오픈 소스 라이선스 (OSI)MITspdx.org/licenses/MIT.html ↗통과
- 최근 1년 내 커밋 또는 릴리스Last commit or release 2026-09-01github.com/terobyte/librarian-cli ↗통과
- OpenSSF Scorecard검사되지 않음
- 패키지 이름이 인기 패키지와 유사하지 않음No popular package one edit away from librarian-cli통과
- 패키지 및 해당 종속성에 중요한 보안 권고 없음70 resolved dependencies checked; no critical advisoryosv.dev ↗통과
- 모델에 대한 숨겨진 지침 없음0 tool descriptions and the README read; no override phrases, credential paths or hidden characters통과
- 파괴적인 도구에 라벨 표시됨검사되지 않음
- 원격 엔드포인트가 MCP 핸드셰이크에 응답검사되지 않음
README
GitHub에서 보기📚 librarian
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
uv tool install librarian-cli
# or: pipx install librarian-cli
Offline contract: install and runtime need no network (the tokenizer's vocabulary is vendored in the package).
Quick start
lib ingest examples/*.epub
lib list
lib find curiouser
lib get <book-id> --budget 3000
Commands
| Command | Purpose |
|---|---|
lib ingest <files…> [--force] [--no-keep-source] [--config cfg.toml] [--verbose] |
Process books into the library; prints a file · id · status · score table. |
lib list [<book-id>] |
No argument — all books; with an id — that book's chapters (n, title, tokens, summary). |
lib get <book-id> <spec> |
Print chapters by range (1-3,7) to stdout. |
lib get <book-id> --budget N [--from K] |
Greedily print consecutive chapters from K while the token sum stays ≤ N. |
lib find <query> [--limit 10] [--book <id>] [--reindex] [--json] |
Full-text search across chapters and titles/authors library-wide (bm25, snippets, RU/EN stemming). |
lib info <book-id> |
JSON: book metadata + quality metrics. |
lib doctor [<book-id>] |
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 <book-id> |
Delete a book and rebuild the index. |
lib serve [--library <path>] |
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 <path> (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 mcp add librarian --env LIB_HOME=$HOME/books -- uvx librarian-cli
Claude Desktop (claude_desktop_config.json):
{
"mcpServers": {
"librarian": {
"command": "uvx",
"args": ["librarian-cli"],
"env": { "LIB_HOME": "/path/to/books" }
}
}
}
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 <id>): 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 — "which book is this from?" The quote needs at least 5 significant words (stop words don't count), or the check is skipped withverdict: null.
lib verify "Рукописи не горят" --book bulgakov-master-i-margarita
lib verify "рукописи не горят никогда"
| verdict | meaning |
|---|---|
exact |
matches after normalization (punctuation/case/ё/typography don't count) |
close |
similarity ≥ 0.95 — near-exact, differences shown as a word-diff |
distorted |
similarity ≥ 0.75 — the right place, but the quote is misremembered |
not_found |
similarity < 0.75 — nothing like it in the book/library |
null |
check wasn't run: empty quote, or a short quote without --book |
Exit codes (grep-style semantics, a deliberate departure from the project's usual
"1 = runtime error" — see docs/MILESTONES.md deviation 38):
| exit | case | stdout |
|---|---|---|
| 0 | exact / close — quote confirmed |
full report / JSON |
| 1 | distorted / not_found — not confirmed |
full report / JSON |
| 1 | runtime error (unknown book id, no search index, locked index) | empty |
| 2 | usage error: empty/short quote (verdict: null), --limit < 1 |
empty (message on stderr) |
Script discriminator: exit 1 with non-empty stdout means "checked, not confirmed"; exit
1 with empty stdout means an error (diagnostics went to stderr instead). Exit 0
includes close — a strict CI gate must check verdict == "exact" in the --json
output, not the exit code alone.
Quality
Every book gets a score from five metrics (coverage, structure, garbage, encoding,
dehyphenation): ok (score ≥ 0.90, no hard triggers) — saved silently; review
(0.60 ≤ score < 0.90, or triggers present) — saved with a warning, details via
lib doctor <id>; failed (score < 0.60) — not saved. Scans and password-protected PDFs
honestly fail (OCR and DRM removal are out of scope).
Determinism
The pipeline has no network access, no LLM calls, and no randomness — the same input file
always produces byte-identical output. That makes ingestion reproducible and cacheable, and
it's what makes lib serve's RAG deterministic: no embeddings to drift, no model calls to
vary between runs.
Limitations
- PDF: works well on typographically normal books; complex layouts may land in
review. - DRM is not circumvented; source legality is the user's responsibility.
- Networked filesystems (NFS/SMB) are not supported (the advisory lock isn't reliable there).
- MOBI/DJVU and text-less scans are not supported (v3 candidates: OCR, calibre).
- CLI messages are currently in Russian; English output is planned.
lib verify: quotes spanning a chapter boundary are not supported (v1) — the best you'll get isdistortedon one half.lib verify:closeon a single-word replacement is realistic from ~150 characters of quote; shorter quotes with a replaced word honestly land indistorted— a third of a three-word quote really is a distortion.lib verifyshelf mode (no--book) needs the FTS5 search index; book mode (--book <id>) works without it in the CLI.lib serveas a whole still requires FTS5 — it syncs the index at startup regardless of which tool gets called.lib verifyin book mode scans the whole chapter text in pure Python; a long book can take a few seconds of CPU. The MCP tool runs it in a worker thread so it doesn't block the rest of the server.
Русская версия
See README.ru.md for the Russian documentation.
Librarian MCP 질문
Librarian MCP를 Claude Code에 추가하려면 어떻게 하나요?
터미널에서 claude mcp add librarian-cli -- uvx librarian-cli를 실행합니다. 모든 프로젝트에서 사용할 수 있게 하려면 --scope user를 추가합니다.
Librarian MCP를 Cursor에 추가하려면 어떻게 하나요?
~/.cursor/mcp.json를 열고 mcpServers 아래에 서버를 추가합니다. 위 설치 섹션에 표시된 Cursor 구성을 사용합니다.
Does Librarian require an internet connection or API keys?
No, it operates entirely offline with no network access, no LLM calls, and no API keys required.
What ebook formats are supported?
The tool supports FB2, EPUB, DOCX, HTML, TXT/MD, and text-layer PDF formats.
How does the quote verification work?
It checks if a quote appears verbatim in your library, providing verdicts like exact, close, distorted, or not found.
Is the output consistent?
Yes, the pipeline is deterministic, meaning the same input always produces byte-identical output.