TC

trieloff/calibre-mcp

开发工具

本页由 AI 翻译,技术细节请以原文为准。 查看原文

59 stars 4 forks 质量 64 趋势 13Apache-2.0

用于搜索和阅读Calibre电子书库中的书籍的MCP服务器

概览

一个用于搜索和阅读Calibre电子书库图书的模型上下文协议(MCP)服务器。 - 自动短语匹配和模糊回退 - 或部分匹配 - 从带有关键词高亮和分码的书籍中 - 纯bash实现,使用calibredb CLI- 返回Calibre深度链接(calibre://)和文件URL(file://) - 强健的超时处理以支持macOS兼容性 - Calibre 安装于 /Applications/calibre.app - Calibre 库 ~/Calibre Library - 用于摘录功能的书籍文本(.txt)导出 - Bash 4.0 及更高版本 使用MCP检查器测试服务器: 添加到你的Claude桌面配置中: 使用Calibre全文搜索引擎搜索书籍。 - 查询(必需):搜索查询。多词查询自动进行短语搜索- 限制(可选):最大结果(默认:50)- fuzzy_fallback(可选):如果精确搜索失败,则使用相关词汇的备回查询 按作者名部分匹配搜索书籍。

概述(AI 翻译)

一个用于搜索和阅读Calibre电子书库图书的模型上下文协议(MCP)服务器。

特色

  • 全文搜索,配备自动短语匹配和模糊回退
  • 按作者搜索或标题并部分匹配
  • **从带有关键词高亮和分页的书籍中提取文本摘录
  • 纯bash实现,使用calibredbCLI进行
  • 返回Calibre深度链接(calibre://)和文件URL(file://)
  • 为macOS兼容性提供强健的超时处理

先修条件

  • 安装在[[T3]的口径]
  • Calibre 库 [~/Calibre Library
  • 用于摘录功能的书籍文本(.txt)导出
  • Bash 4.0或更高版本

安装

  1. 克隆此仓库:

  2. 使脚本可执行:

用途

与MCP督察合作

使用MCP检查器测试服务器:

使用Claude桌面

添加到你的Claude桌面配置中:

可用工具

搜索-全文

使用Calibre全文搜索引擎搜索书籍。

参数:

  • query(必填):搜索查询。多词查询会自动进行短语搜索
  • limit(可选):最大结果(默认:50)

本页由 AI 翻译,技术细节请以原文为准。

README

以下为原文 README 节选,完整内容请查看原文。

calibre-mcp

A Model Context Protocol (MCP) server for searching and reading books from your Calibre ebook library.

Features

  • Full-text search with automatic phrase matching and fuzzy fallback
  • Search by author or title with partial matching
  • Extract text excerpts from books with keyword highlighting and pagination
  • Pure bash implementation using calibredb CLI
  • Returns Calibre deep links (calibre://) and file URLs (file://)
  • Robust timeout handling for macOS compatibility

Prerequisites

  • Calibre installed at /Applications/calibre.app
  • A Calibre library at ~/Calibre Library
  • Text (.txt) exports of your books for excerpt functionality
  • Bash 4.0 or later

Installation

  1. Clone this repository:
git clone https://github.com/trieloff/calibre-mcp.git
cd calibre-mcp
  1. Make the script executable:
chmod +x calibre-mcp.sh

Usage

With MCP Inspector

Test the server using the MCP Inspector:

npx @modelcontextprotocol/inspector /path/to/calibre-mcp.sh

With Claude Desktop

Add to your Claude Desktop configuration:

{
  "mcpServers": {
    "calibre": {
      "command": "/path/to/calibre-mcp.sh"
    }
  }
}

Available Tools

search-fulltext

Search books using Calibre’s full-text search engine.

Parameters:

  • query (required): Search query. Multi-word queries are automatically phrase-searched
  • limit (optional): Maximum results (default: 50)
  • fuzzy_fallback (optional): Fallback query with related terms if exact search fails

Example:

{
  "query": "machine learning",
  "fuzzy_fallback": "AI artificial intelligence ML neural networks deep learning"
}

search-author

Search books by author name with partial matching.

Parameters:

  • author (required): Author name (partial match supported)
  • limit (optional): Maximum results (default: 50)

search-title

Search books by title with partial matching.

Parameters:

  • title (required): Book title (partial match supported)
  • limit (optional): Maximum results (default: 50)

get-excerpt

Extract text excerpts from books with keyword context.

Parameters:

  • book_id (required): Calibre book ID
  • keyword (optional): Search term to find in the book
  • context_lines (optional): Lines of context around matches (default: 10)
  • max_results (optional): Results per page (default: 10)
  • page (optional): Page number for pagination (default: 1)

Response Format

Search results include:

  • Book metadata (title, authors, series, tags, publisher)
  • Calibre deep link for opening in Calibre
  • File URL for direct EPUB access
  • Available formats
  • Whether text format is available for excerpts

Logging

The server logs all requests and responses to requests.log for debugging.

Limitations

  • Requires Calibre to be closed or may experience timeouts
  • Full-text search requires indexed books
在 GitHub 查看完整 README

安装

npx @modelcontextprotocol/inspector /path/to/calibre-mcp.sh
新手?先看 mcpskill.org 教程 →

配置

{ "mcpServers": { "calibre": { "command": "/path/to/calibre-mcp.sh" } } }