calibre-mcp
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@calibre-mcpsearch for books by Isaac Asimov"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
calibre-mcp
A local MCP server (stdio) that lets an LLM host — Claude Desktop, Claude Code, or any MCP-compatible client — manage a Calibre ebook library conversationally: search, edit metadata, add, convert, deduplicate, remove, and email books, all with human-in-the-loop safety.
Most Calibre MCP servers are read-only — they search and list. This one writes — and does it safely. Editing metadata, adding, converting, and deleting books is where a tool can actually corrupt or lose your library, so every mutation here goes through a design built to make that impossible to do by accident:
Plan → confirm on every destructive action. The first call returns a human-readable diff and a
confirmation_token; nothing changes until you re-call with that exact token.Automatic
metadata.dbbackup before every write (rolling, last 20).Recoverable deletes — trash copy and Calibre recycle bin, never a hard delete.
Reads can't corrupt anything — the SQLite connection is opened
mode=ro.
Built to stop clicking around the Calibre GUI and manage a library from a chat instead — and deliberately engineered as a showcase of how to design a tool that's allowed to delete a user's files: hybrid I/O design, an explicit failure taxonomy, human-approval gates on every destructive action, and a test suite that never touches real user data. See PRODUCT.md for what it does and why, and ARCHITECTURE.md for the full design writeup.
Why the hybrid design
Reads (
search,list,view, duplicate-finding) querymetadata.dbdirectly, read-only — fast, and structurally incapable of corrupting the library (the SQLite connection is openedmode=ro).Writes (
edit,add,remove,convert,email) go through Calibre's own CLI tools (calibredb,ebook-convert,calibre-smtp) — never raw SQL — so Calibre stays authoritative over its own database.Every write is preceded by an automatic
metadata.dbbackup (rolling, keeps the last 20).Removal is recoverable: files are copied to a managed trash folder and the book is sent to Calibre's recycle bin — never a permanent delete.
Every mutating or outward-facing tool is two-step (plan → confirm): the first call returns a human-readable review plus a
confirmation_token; nothing changes — and nothing is sent — until you re-call with that exact token.
Full rationale, module boundaries, and the decision log behind these choices live in ARCHITECTURE.md.
Related MCP server: calibre-manager
Requirements
Calibre installed, with
calibredbandebook-converton yourPATH(calibredb --version).calibre-smtpis also required if you wantemail_book.Python ≥ 3.12 and
uv.
Install
Zero-clone (recommended) — uv builds and runs it straight from
the repo, no manual checkout:
uvx --from git+https://github.com/gustavofsousa/calibre-mcp calibre-mcpFrom a local checkout (for development, or to pin a specific state):
git clone https://github.com/gustavofsousa/calibre-mcp calibre-mcp
cd calibre-mcp
uv syncConfigure
The server manages one library, set via environment variable:
Variable | Required | Default | Purpose |
| yes | — | Path to your Calibre library directory (the folder containing |
| no |
| Where pre-write backups and trashed files are stored. |
The server fails fast at startup with a clear error if CALIBRE_LIBRARY_PATH is unset or the
directory has no metadata.db.
email_book additionally needs SMTP relay credentials (loaded lazily — the server boots fine
without them, and only email_book fails if they're missing):
Variable | Required | Default | Purpose |
| for email | — | SMTP relay host. |
| for email | — | SMTP username. |
| for email | — | SMTP password. Never logged, never returned in any tool output. |
| for email | — | Sender address. |
| no |
| SMTP port. |
| no |
| One of |
Claude Desktop / Claude Code
Add to your MCP config (e.g. claude_desktop_config.json). Zero-clone — runs straight from the
repo via uvx:
{
"mcpServers": {
"calibre": {
"command": "uvx",
"args": ["--from", "git+https://github.com/gustavofsousa/calibre-mcp", "calibre-mcp"],
"env": {
"CALIBRE_LIBRARY_PATH": "/absolute/path/to/your/Calibre Library"
}
}
}
}Or, from a local checkout:
{
"mcpServers": {
"calibre": {
"command": "uv",
"args": ["--directory", "/absolute/path/to/calibre-mcp", "run", "calibre-mcp"],
"env": {
"CALIBRE_LIBRARY_PATH": "/absolute/path/to/your/Calibre Library"
}
}
}
}Run manually
CALIBRE_LIBRARY_PATH="/path/to/Calibre Library" uv run calibre-mcp
# or equivalently:
CALIBRE_LIBRARY_PATH="/path/to/Calibre Library" uv run python -m calibre_mcpThe server communicates over stdio (JSON-RPC); it prints nothing to stdout except MCP framing — all logs go to stderr, on purpose (see ARCHITECTURE.md).
Tools
Tool | What it does | Gate |
| Resolve a Calibre search query ( | read-only |
| Paginated, sortable listing — works even when the Calibre GUI holds a write lock. | read-only |
| Full metadata for one book id. | read-only |
| Advisory report of likely-duplicate books by normalized (title, author). Never merges. | read-only |
| Edit a whitelisted field set (title, authors, tags, series, rating, comments, …). | plan → confirm |
| Broadcast a field change to N books in one batch ( | plan → confirm (batch) |
| Add a book from a local file path; surfaces duplicates honestly. | single-step (backed up) |
| Recursively import every ebook file found under a directory. | additive (backed up) |
| Convert to a new format ( | single-step (backed up) |
| Convert N books to one target format in one call. | additive (backed up) |
| Recoverable removal: trash copy + Calibre recycle bin, never a hard delete. | plan → confirm |
| Email a book's file via | plan → confirm |
Plus one MCP resource, calibre://library/stats — an aggregate library profile (totals,
format/language mix, metadata completeness, data-quality flags) readable without any tool call.
Every tool's full contract (edge cases, error conditions, exact field whitelist) is documented in
its docstring in server.py — those docstrings are what the LLM host
sees, so they double as the API reference.
Development
uv run ruff check src tests # lint
uv run pytest # full suite (unit + integration + e2e)
uv run pytest -m unit # fast unit tests only137 tests across three tiers (unit, integration, e2e); write tests never touch a real
library — see ARCHITECTURE.md.
Project layout
src/calibre_mcp/
├── server.py # FastMCP tool surface — the only stdio/MCP-aware module
├── library.py # CalibreLibrary facade — orchestrates every tool's business logic
├── sqlite_reader.py # Read-only metadata.db access (the only sqlite3 call site)
├── calibredb_runner.py # calibredb subprocess wrapper (search/edit/add/remove/add_format)
├── ebook_convert_runner.py # ebook-convert subprocess wrapper
├── calibre_smtp_runner.py # calibre-smtp subprocess wrapper
├── backup.py # metadata.db snapshots + recoverable trash
├── confirmation.py # plan→confirm token derivation/verification
├── config.py # env-driven startup config, fail-fast validation
└── errors.py # the failure taxonomy every layer maps toRoadmap
Shipped: full read/curate/distribute loop (search, list, view, edit, add, remove, convert,
dedupe, email). What's next — library self-knowledge, bulk operations, cover/metadata enrichment,
device sync — is tracked in .specs/ROADMAP.md, including the reasoning for
sequencing and what's explicitly out of scope.
Contributing
See CONTRIBUTING.md for the dev workflow, the invariants a PR must preserve, and how the spec-driven process behind this repo works.
License
MIT © Gustavo F Sousa.
This server cannot be deployed
Maintenance
Related MCP Connectors
Read-only MCP server exposing a user ORANO library to their own AI agent.
Agentic search over your Dewey document collections from any MCP-compatible client.
OCR, transcription, file extraction, and image generation for AI agents via MCP.
Shared memory and actions for Claude, Kiro, OpenAI, Cursor, and other MCP-compatible AI clients.
Related MCP Servers
- AlicenseNot gradedqualityDmaintenanceEnables searching, reading, and managing a Calibre ebook library through natural language, with features like metadata search, full-text search, content extraction, and library management.107 npmApache 2.0
- AlicenseAqualityDmaintenanceAn MCP server to manage and organize a Calibre ebook library, enabling metadata editing, search, conversion, and more through AI assistants.175MIT
- AlicenseNot gradedqualityAmaintenanceEnables semantic search over local Calibre libraries via MCP, allowing AI assistants to query books, annotations, and export bibliographies while keeping data private.7MIT
- AlicenseAqualityAmaintenanceConnects MCP clients to a Calibre ebook library for semantic search, metadata curation, and library management via natural language.14107 npm15MIT