calibre-mcp

calibre-mcp

A read-only MCP server for an existing Calibre ebook library, enabling metadata search, full-text search, and category browsing via the Model Context Protocol.

Category
访问服务器

README

Calibre MCP

CI Python MCP Calibre Licence: MIT

A read-only Model Context Protocol server for an existing Calibre ebook library.

Calibre MCP lets MCP-compatible clients search book metadata, query Calibre's full-text index, inspect book details, browse library categories, and discover related books. It uses Calibre's supported calibredb command-line interface rather than reading metadata.db directly.

Features

  • Metadata search using Calibre's search language
  • Full-text search with matching snippets
  • Detailed metadata for individual books
  • Recently added books
  • Authors, tags, series, publishers, and language categories
  • Related-book discovery
  • MCP resources for books, searches, and library status
  • Optional Calibre Content Server links
  • In-memory TTL cache
  • Streamable HTTP transport
  • Podman Quadlet deployment
  • No metadata-changing MCP tools

Available tools

Tool Purpose
server_info Show server, Calibre, cache, and library configuration
library_status Show book count and full-text indexing status
search_books Search Calibre metadata
search_fulltext Search inside indexed ebooks and return snippets
get_book_metadata Return all available metadata for one book
list_recent_books List books most recently added
list_categories Browse authors, tags, series, publishers, and languages
find_related_books Find books with overlapping authors, series, or tags
clear_cache Clear the in-memory read cache

MCP resources

URI Purpose
calibre://library/status Library and full-text index status
calibre://book/{book_id} Detailed metadata for a book
calibre://search/{query} Metadata search results

Requirements

  • A Calibre library with metadata.db
  • Calibre 9.x
  • Python 3.11 or newer
  • An MCP client supporting Streamable HTTP
  • Podman and systemd for the included Quadlet deployment

The full-text tools require Calibre's full-text index to be enabled and completed.

Quick start with Podman Quadlet

1. Clone the repository

git clone https://github.com/monch1962/calibre-mcp.git
cd calibre-mcp

2. Confirm your Calibre library

The supplied Quadlet assumes:

/tank/media/Books

Confirm that the library database exists:

test -f /tank/media/Books/metadata.db && echo "Calibre library found"

3. Determine the library owner

stat -c 'uid=%u gid=%g owner=%U:%G' /tank/media/Books

Edit quadlet/calibre-mcp.container and set User= to the returned numeric UID and GID:

User=1000:1000

Also change the host library path if yours is different:

Volume=/tank/media/Books:/books

4. Build the image

sudo podman build \
  --build-arg CALIBRE_VERSION=9.11.0 \
  -t localhost/calibre-mcp:1.0.0 .

5. Install the Quadlet

sudo mkdir -p /etc/containers/systemd

sudo cp quadlet/calibre-mcp.container \
  /etc/containers/systemd/calibre-mcp.container

sudo systemctl daemon-reload
sudo systemctl start calibre-mcp.service

Do not run systemctl enable calibre-mcp.service. The generated service is transient; the Quadlet's [Install] section creates the boot dependency.

6. Verify the deployment

sudo systemctl status calibre-mcp.service --no-pager
sudo journalctl -u calibre-mcp.service -n 100 --no-pager
sudo podman ps --filter name=calibre-mcp

Verify Calibre inside the container:

sudo podman exec calibre-mcp \
  calibredb list \
  --with-library /books \
  --for-machine \
  --fields title \
  --limit 1

sudo podman exec calibre-mcp \
  calibredb fts_index status \
  --with-library /books

The default endpoint is:

http://localhost:8008/mcp

Test with MCP Inspector

npx @modelcontextprotocol/inspector

Select Streamable HTTP and connect to:

http://YOUR_SERVER:8008/mcp

Example metadata search:

{
  "query": "author:asimov",
  "limit": 10
}

Example full-text search:

{
  "query": "zero trust architecture",
  "limit": 10
}

Example restricted full-text search:

{
  "query": "encryption",
  "limit": 10,
  "restrict_to": "search:tags:security"
}

Connect an MCP client

Use the Streamable HTTP endpoint exposed by the server:

http://YOUR_SERVER:8008/mcp

Client configuration formats vary. Consult your client's MCP documentation and select Streamable HTTP rather than stdio or legacy SSE.

Calibre search examples

search_books accepts Calibre search expressions:

author:asimov
title:"i robot"
tags:history
series:"Discworld"
publisher:penguin
languages:eng
rating:>=4

An empty query returns all books, subject to the result limit.

Optional Content Server links

Set the URL of your existing Calibre Content Server in the Quadlet:

Environment=CALIBRE_CONTENT_SERVER_URL=http://mini-nas:8083

When configured, metadata results include browser and format-download links.

Configuration

Environment variable Default Description
CALIBRE_LIBRARY_PATH /books Calibre library inside the container
CALIBREDB calibredb Path to the Calibre CLI
CALIBRE_COMMAND_TIMEOUT 120 Command timeout in seconds
CALIBRE_MAX_RESULTS 100 Maximum results returned by a tool
CALIBRE_CACHE_TTL 300 Cache lifetime in seconds; set to 0 to disable
CALIBRE_CACHE_SIZE 256 Maximum cached entries
CALIBRE_CONTENT_SERVER_URL unset Optional Content Server base URL
MCP_HOST 0.0.0.0 MCP HTTP bind address
MCP_PORT 8000 MCP port inside the container
HOME /tmp/calibre-home Writable location for Calibre configuration

Why the library mount is writable

Calibre checks whether the library filesystem is case-sensitive by briefly creating and deleting a probe file in the library root. Consequently, the bind mount cannot be mounted read-only.

This server remains functionally read-only because it exposes no tools that call Calibre commands such as:

  • add
  • remove
  • set_metadata
  • add_format
  • remove_format

Run the container as the same unprivileged UID and GID that owns the library. Do not run it as root unless your environment specifically requires that.

Security

  • Keep port 8008 restricted to trusted LAN or Tailscale clients.
  • Do not expose the endpoint directly to the public Internet.
  • Streamable HTTP does not add authentication in this deployment.
  • Place an authenticated reverse proxy in front of the service before broader exposure.
  • Pin release versions rather than using a moving container tag.
  • Review SECURITY.md before reporting a vulnerability.

Local development

Create a virtual environment:

python3 -m venv .venv
source .venv/bin/activate
python -m pip install --upgrade pip
python -m pip install -e .
python -m pip install pytest ruff

Run the tests:

pytest

Run lint checks:

ruff check .

Start the server locally:

export CALIBRE_LIBRARY_PATH="/path/to/Calibre Library"
python server.py

Project status

Version 1.0.0 is suitable for personal and trusted-network deployments. The public API may gain additional tools and resources in future minor releases, while existing tool names and argument shapes will be kept stable where practical.

Contributing

Issues and pull requests are welcome. See CONTRIBUTING.md.

Licence

Released under the MIT Licence.

推荐服务器

Baidu Map

Baidu Map

百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。

官方
精选
JavaScript
Playwright MCP Server

Playwright MCP Server

一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。

官方
精选
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。

官方
精选
本地
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。

官方
精选
本地
TypeScript
VeyraX

VeyraX

一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。

官方
精选
本地
graphlit-mcp-server

graphlit-mcp-server

模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。

官方
精选
TypeScript
Kagi MCP Server

Kagi MCP Server

一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。

官方
精选
Python
e2b-mcp-server

e2b-mcp-server

使用 MCP 通过 e2b 运行代码。

官方
精选
Neon MCP Server

Neon MCP Server

用于与 Neon 管理 API 和数据库交互的 MCP 服务器

官方
精选
Exa MCP Server

Exa MCP Server

模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。

官方
精选