Skip to main content
Glama
2b3pro

calibre-mcp

by 2b3pro

calibre-mcp Version 1.0.0

一个用于搜索、阅读和管理 Calibre 电子书库的模型上下文协议 (MCP) 服务器。使用 TypeScript 为 Bun 完全重写,提供超高性能、与 Calibre 命令行工具的深度集成以及自动化内容提取功能。

🚀 功能特性

  • 极速元数据搜索:通过 SQLite 直接查询 Calibre 的 metadata.db,实现近乎即时的搜索结果。

  • 全文内容搜索:利用 Calibre 的索引全文搜索引擎,在整个书库中查找特定短语。

  • 动态内容提取:自动将 EPUB、PDF 等格式即时转换为文本。无需手动导出 .txt 文件。

  • 全面的库管理:更新数据库元数据、修改内部文件元数据、润色书籍以及在不同格式间进行转换。

  • 智能结果分发:搜索结果在不同书籍间进行智能平衡,以提供多样化的匹配项。

  • 自定义 URL 方案:使用 epub:// URL 精确引用书籍位置和行范围。

Related MCP server: Calibre RAG MCP Server

📋 前置要求

  • 已安装 Calibre(macOS 下位于 /Applications/calibre.app)。

  • 已安装 Bun 运行时。

  • 一个 Calibre 书库。

⚙️ 配置

服务器使用以下环境变量:

  • CALIBRE_LIBRARY_PATH:Calibre 书库的路径(metadata.db 所在位置)。默认为 /Volumes/Xarismata/eBooks/CalibreNuevo。

🛠 安装

  1. 克隆此仓库:

git clone https://github.com/2b3pro/calibre-mcp.git
cd calibre-mcp
  1. 安装依赖:

bun install

⌨️ 使用方法

使用 MCP Inspector

在交互式环境中测试服务器:

npx @modelcontextprotocol/inspector bun src/index.ts

使用 Claude Desktop

将以下内容添加到你的 claude_desktop_config.json 中:

{
  "mcpServers": {
    "calibre": {
      "command": "bun",
      "args": ["run", "/absolute/path/to/calibre-mcp/src/index.ts"]
    }
  }
}

🧰 可用工具

工具

描述

search_library

统一搜索(元数据 + 全文)。支持 author:、title: 等。

read_content

通过 epub:// URL 从书籍中提取文本。支持动态转换。

update_metadata

更新书籍的 Calibre 数据库元数据。

fetch_online_metadata

从在线来源获取高质量元数据(OPF 格式)。

polish_book

增强书籍文件(标点符号、压缩、CSS 清理)。

convert_ebook

在不同格式间转换书籍(例如 EPUB ↔ MOBI)并将其添加到库中。

deep_search_book

在特定书籍内搜索内容(绕过 FTS 索引)。

read_file_metadata

读取直接嵌入在电子书文件内的元数据。

write_file_metadata

将元数据直接写入电子书文件本身。


工具详情与示例

search_library

使用自然语言搜索内容,或使用特定字段搜索元数据。

  • 查询示例:

    • "machine learning"(全文搜索)

    • author:Asimov title:Foundation(元数据搜索)

    • tag:science-fiction rating:>4(高级过滤)

read_content

使用 epub:// 方案。

  • 格式:epub://[作者]/[书名]@[书籍ID]#[起始行]:[结束行]

  • 示例:epub://Isaac%20Asimov/Foundation@123#500:600 获取第 500 到 600 行。

polish_book

非常适合清理自动转换后的文件或旧文件。

  • 选项:smartenPunctuation(智能标点)、compressImages(压缩图片)、upgradeBook(升级书籍)、removeUnusedCss(移除未使用的 CSS)。

convert_ebook

转换格式并自动更新你的库记录。

  • 示例:book_id: 45, output_format: "azw3", options: ["--enable-heuristics"]

deep_search_book

直接在特定书籍内搜索(如果 Calibre FTS 尚未索引该书,此功能很有用)。

  • 示例:book_id: 123, query: "quantum entanglement", context_lines: 3

⚖️ 许可证

Apache License 2.0 - 详情请参阅 LICENSE 文件。

Related MCP Connectors

Related MCP Servers

  • A
    license
    Not graded
    quality
    C
    maintenance
    Enables read-only access to local Calibre libraries for searching metadata, inspecting book formats, and extracting content samples. Supports full-text search, batch operations, and detailed book analysis through natural language queries.
    3
    MIT
  • F
    license
    B
    quality
    D
    maintenance
    Enables semantic search and contextual conversations with your Calibre ebook library using vector-based RAG technology. Supports project-based organization, multi-format book processing, and OCR capabilities for enhanced content extraction and retrieval.
    7
    2
    -
  • A
    license
    Not graded
    quality
    C
    maintenance
    Provides AI agents with research capabilities for local Calibre e-book libraries, including fulltext search across titles, ISBNs, and comments, plus structured excerpt retrieval from books.
    2
    GPL 3.0