Skip to main content
Glama
calibreweb-mcp

calibreweb-mcp

by ni-c

calibreweb-mcp

CI npm version node license container docs

一个只读的 Model Context Protocol 服务器,用于 Calibre-Web(以及 Calibre-Web Automated),即自托管的电子书库 Web 界面。

Calibre-Web 没有 REST API——其唯一稳定的机器可读接口是它为电子书阅读器应用提供的 OPDS 目录订阅源。此服务器使用该订阅源:通过 HTTP Basic 认证接收 Atom XML,输出结构化的图书数据。可搜索书库、浏览精选视图和书架、获取每种格式的下载链接,并将封面图片直接拉入对话中。它从不写入任何内容:每个工具都是针对 OPDS 路由的 GET 请求。

演示:通过 MCP Inspector CLI 列出工具、搜索书库并读取统计信息

📖 完整文档:calibreweb-mcp.ni-c.de

要求

  • Node.js 22 或更新版本

  • 一个 Calibre-Web 实例(针对当前 linuxserver/calibre-web 镜像开发;Calibre-Web Automated 同样适用)

  • 为服务器创建一个 Calibre-Web 用户。OPDS 订阅源使用常规 Web 登录进行认证——请使用仅具有查看和下载角色的专用账户,不要使用管理员账户。如果实例允许匿名浏览,服务器也可以在没有凭据的情况下运行。

Related MCP server: access-calibre

配置

变量

必需

描述

CALIBRE_WEB_URL

是

实例的根 URL,例如 https://books.example.com。/opds 路径会自动附加。

CALIBRE_WEB_USERNAME

是¹

Calibre-Web 账户的用户名。

CALIBRE_WEB_PASSWORD

是¹

该账户的密码(Web 登录密码)。

CALIBRE_WEB_INSECURE_TLS

否

设置为 true 以接受自签名证书——仅限配置的主机。

¹ 如果实例允许匿名浏览,请将两者都留空;仅设置其中一个属于配置错误。

Claude Code

claude mcp add calibreweb \
  -e CALIBRE_WEB_URL=https://books.example.com \
  -e CALIBRE_WEB_USERNAME=reader \
  -e CALIBRE_WEB_PASSWORD=... \
  -- npx calibreweb-mcp

Claude Desktop

{
  "mcpServers": {
    "calibreweb": {
      "command": "npx",
      "args": ["calibreweb-mcp"],
      "env": {
        "CALIBRE_WEB_URL": "https://books.example.com",
        "CALIBRE_WEB_USERNAME": "reader",
        "CALIBRE_WEB_PASSWORD": "..."
      }
    }
  }
}

Codex

[mcp_servers.calibreweb]
command = "npx"
args = ["calibreweb-mcp"]
env = { CALIBRE_WEB_URL = "https://books.example.com", CALIBRE_WEB_USERNAME = "reader", CALIBRE_WEB_PASSWORD = "..." }

工具

所有工具均为只读(readOnlyHint: true)。

工具

描述

search_books

按标题、作者、丛书、出版社和标签搜索。Calibre-Web 一次性返回所有匹配结果;结果在客户端进行截断(limit,默认 50),并报告实际匹配数量。

list_books

按视图列出图书:new(默认)、hot、rated、discover(随机)、read、unread 或 all(可选择缩小到首字母)。

list_shelves

公共书架以及已配置用户自己的书架。

get_shelf_books

书架上的图书,按书架顺序排列。

get_cover

图书封面,以客户端可显示的图片形式返回。

get_stats

图书总数、作者数、分类数和丛书数。

图书条目包括作者、标签、丛书(含索引)、评分、摘要(有长度限制)、封面 URL 以及每种格式的下载 URL——这些是用户可以打开的现成链接,因为模型本身没有理由下载 EPUB。

分页

订阅源按实例的每页图书数设置(默认 60)进行分页;页面大小不受客户端控制。每个列表在存在更多页面时都会返回 pagination.nextOffset——在下次调用中将其作为 offset 传入。discover 视图是随机选择,不支持分页。

明确排除的范围

  • 无写入操作。 OPDS 订阅源没有写入操作,此服务器也不会添加任何写入操作。

  • 无文件下载。 工具返回下载 URL,而非电子书文件本身。

  • 无分类浏览(作者/丛书/标签/出版社/语言/格式作为独立的索引订阅源)。search_books 涵盖了这些查找;相关路由已存在,如果有实际用例,可以为其添加工具。

安全性

  • 服务器在设计上是只读的——仅发送 GET 请求,不保存任何状态。

  • 图书元数据是来自第三方的不可信数据;每个结果都会说明这一点,控制字符会被剥离,并且 XML 实体处理已被禁用(声明了 DOCTYPE 或实体的文档会被直接拒绝)。

  • 响应在解析前有大小限制(订阅源 8 MB,封面 1 MB),在到达模型前再次限制(每本书和每次响应的预算)。

  • 订阅源中的 href 仅在解析为配置的源站且使用 http(s) 协议时才会被传递——恶意订阅源无法将 javascript:、file: 或跨域 URL 植入结果中。

  • 重定向被拒绝,以确保 Basic 凭据永远不会被重放到其他主机;封面仅在内容类型为真实图片时才被传递。

  • 密码在启动时从进程环境中清除,URL 中的凭据会在出现在任何日志或结果中之前被删除。

容器

docker run -i --rm \
  -e CALIBRE_WEB_URL=https://books.example.com \
  -e CALIBRE_WEB_USERNAME=reader \
  -e CALIBRE_WEB_PASSWORD=... \
  ghcr.io/ni-c/calibreweb-mcp

开发

npm install
npm test            # unit tests against a stubbed OPDS feed, no instance needed
npm run lint
npm run build

参见 CONTRIBUTING.md。

发布

  1. 更新 CHANGELOG.md 并提升 package.json(+ 锁文件)中的版本号。

  2. npm run lint && npm run test:coverage && npm run build

  3. 标记发布版本:git tag -s vX.Y.Z -m "vX.Y.Z" && git push origin vX.Y.Z

许可证

MIT

Available Tools

6 tools
get_coverGet a book coverA
Read-onlyIdempotent

Fetches the cover of a book and returns it as an image. Book ids come from the other tools (books with id null have no cover). Calibre-Web serves the full-size cover; images over 1 MB are refused to protect the context window — use the coverUrl from the book entry instead.

Inputs: book_id (required). Returns: bytes, bookId, mimeType

get_shelf_booksList books on a shelfA
Read-onlyIdempotent

Lists the books on a shelf, in the shelf’s own order. Shelf ids come from list_shelves. Book entries include per-format download URLs and a cover URL; fetch the cover image itself with get_cover.

Inputs: shelf_id (required), offset. Returns: books, notes, source, shelfId, +2 more

get_statsGet library statisticsA
Read-onlyIdempotent

Returns the total number of books, authors, categories (tags) and series in the library.

Inputs: no named parameters. Returns: books, series, authors, categories

list_booksList booksA
Read-onlyIdempotent

Lists books from one of the Calibre-Web views: new (recently added, default), hot (most downloaded), rated (best rated), discover (random selection), read / unread (per-user reading state), or all (the full library ordered by title, optionally narrowed to titles starting with a letter). Page size is a server-side setting; pass the returned pagination.nextOffset as offset to fetch the next page. The discover view is random and not paginated.

Inputs: view, letter, offset. Returns: view, books, notes, source, +2 more

list_shelvesList shelvesA
Read-onlyIdempotent

Lists the shelves visible to the configured user: every public shelf plus the user’s own private ones. Use the returned id with get_shelf_books. isPublic is only reported on English-locale instances (Calibre-Web marks public shelves with a localized title suffix).

Inputs: offset. Returns: notes, source, shelves, untrusted, +1 more

search_booksSearch booksA
Read-onlyIdempotent

Searches the library by title, author, series, publisher and tags. Calibre-Web returns every match in a single response, so broad queries on a large library are truncated client-side — totalFound reports the real match count. Book entries include per-format download URLs and a cover URL; fetch the cover image itself with get_cover.

Inputs: query (required), limit. Returns: books, notes, source, truncated, +2 more

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    A4.4/5.0

    Scored across 6 tools

    Disambiguation5/5

    Each tool targets a distinct operation: searching, listing views, listing shelves, fetching shelf contents, fetching covers, and retrieving library stats. Even the two book-listing tools are clearly separated by search vs. browse intent.

    Naming Consistency5/5

    All tool names follow a consistent verb_noun pattern: search_books, list_books, list_shelves, get_shelf_books, get_cover, get_stats. The naming style is uniform and predictable across the entire set.

    Tool Count5/5

    Six tools is well-scoped for a read-only Calibre-Web library interface. Each tool covers a meaningful slice of the domain without redundancy or bloat.

    Completeness4/5

    The core read-only workflows are covered: search, browse, shelves, covers, and stats. Minor gaps exist such as direct single-book lookup by ID and author/tag browsing, but book entries from search and list tools carry enough detail to work around them.

    Maintenance

    ActivityActive
    ResponsivenessNo recent community issues

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      A
      quality
      D
      maintenance
      An MCP server to manage and organize a Calibre ebook library, enabling metadata editing, search, conversion, and more through AI assistants.
      17
      5
      MIT
    • A
      license
      A
      quality
      D
      maintenance
      A local stdio MCP server that enables AI tools to search a self-hosted Calibre library over SSH, supporting metadata queries, full-text search, and book details.
      7
      MIT
    • A
      license
      A
      quality
      D
      maintenance
      An MCP server that lets an LLM browse, search, and download books from OPDS catalogs (e.g., Project Gutenberg, Standard Ebooks) using tools for feed navigation, full-text search, and acquisition link downloads.
      4
      1
      AGPL 3.0