Skip to main content
Glama
apple-books-mcp

apple-books-mcp

by vgnshiyer

Apple Books MCP

Apple Books 的模型上下文协议 (MCP) 服务器。

Website PyPI License: Apache 2.0 Buy Me A Coffee

一览

  • 从上次中断的地方继续 — Claude 可以看到您当前阅读的章节及其文本,以及书中最近的高亮内容。

  • 扩展任何高亮内容 — 获取上下文中的段落解释,并以 «...» 标记出您所选的确切锚点。

  • 重温书籍 — 提取您的高亮内容,按主题进行聚类,并向您复述您的观点。

  • 反思您的阅读 — 跨书籍的模式、高亮中反复出现的想法,以及您真正被吸引的内容。

https://github.com/user-attachments/assets/77a5a29b-bfd7-4275-a4af-8d6c51a4527e

还有更多功能!

Related MCP server: Co-Reading MCP

可用工具

收藏 (Collections)

工具

描述

参数

list_all_collections

列出所有收藏

limit?: int

get_collection_books

获取收藏中的所有书籍

collection_id: str

describe_collection

获取收藏详情

collection_id: str

search_collections_by_title

按标题搜索收藏

title: str

书籍 (Books)

工具

描述

参数

list_all_books

列出所有书籍

limit?: int

describe_book

获取特定书籍的详情(元数据、进度、标注计数、描述)

book_id: str

list_annotations

获取书籍的所有标注(每行包含 id + 文本 + 章节,按章节排序)

book_id: int, limit?: int

search_books_by_title

按标题搜索书籍

title: str

get_books_by_genre

按流派获取书籍(子字符串匹配)

genre: str, limit?: int

阅读状态 (Reading Status)

工具

描述

参数

get_books_in_progress

获取当前正在阅读的书籍

limit?: int

get_finished_books

获取已读完的书籍

limit?: int

get_unstarted_books

获取尚未开始阅读的书籍

limit?: int

get_recently_read_books

获取最近打开的书籍

limit?: int (默认: 10)

标注 (Annotations)

工具

描述

参数

list_all_annotations

浏览按书籍分组的所有标注,最新优先

limit?: int

recent_annotations

获取最近的标注(平铺,每行包含日期 + 书籍)

limit?: int (默认: 10)

describe_annotation

获取单个标注的完整详情

annotation_id: str

get_annotation_context

高亮周围的文本窗口(所在段落),高亮部分标记为 «...»

annotation_id: int, chars_before?: int (默认: 500), chars_after?: int (默认: 500)

get_highlights_by_color

按书籍分组的特定颜色高亮

color: str, limit?: int

search_notes

搜索用户笔记(内联显示高亮 + 笔记)

note: str, limit?: int

search_annotations

搜索高亮 + 笔记 + 周围文本

text: str, limit?: int

get_annotations_by_date_range

日期范围内的标注(平铺,每行包含日期 + 书籍)

after?: YYYY-MM-DD, before?: YYYY-MM-DD, limit?: int

图书馆统计 (Library Stats)

工具

描述

参数

get_library_stats

获取包含阅读统计的图书馆摘要

无

书籍内容 (Book Content)

仅适用于非 DRM 的 EPUB 文件(导入的书籍、古腾堡计划、Standard Ebooks 等)。Apple Books 商店购买的书籍受 FairPlay 保护,会返回明确的错误。仅 iCloud 的书籍会返回“未下载”提示。

工具

描述

参数

list_book_chapters

书籍目录(章节标题、顺序、嵌套)

book_id: int

get_chapter_content

章节的纯文本内容,支持可选的 offset + max_chars 切片

book_id: int, chapter_id: str, offset?: int, max_chars?: int

get_current_reading_position

用户上次阅读的章节(通过 Apple Books 的自动书签 CFI)

book_id: int

可用资源

可从 Claude Desktop 的资源选择器中访问的可附加数据对象。

资源

URI

描述

Currently Reading

apple-books://currently-reading

您当前正在阅读的书籍 — 最近打开的进行中书籍,包含元数据、您上次阅读的章节及文本预览(针对非 DRM EPUB),以及最近的标注。将其附加到任何对话中,让 Claude 专注于您当前的阅读。

可用提示词 (Prompts)

一键式工作流,可从 Claude Desktop 的提示词选择器中访问。

提示词

描述

参数

weekly_digest

总结我过去一周阅读和高亮的内容

days?: int (默认: 7)

library_snapshot

对我整个阅读生活的反思

无

revisit_book

重温特定书籍的笔记和高亮

book_title: str

安装

使用 uv (推荐)

uvx 可用于直接运行 apple-books-mcp(无需安装)。

brew install uv  # for macos
uvx apple-books-mcp

使用 pip

pip install apple-books-mcp

安装后,您可以使用以下命令运行服务器:

python -m apple_books_mcp

使用 Docker

docker run -v ~/Library/Containers/com.apple.iBooksX/Data/Documents:/root/Library/Containers/com.apple.iBooksX/Data/Documents:ro ghcr.io/vgnshiyer/apple-books-mcp:latest

首次运行权限提示 (macOS)

首次使用时,macOS 会询问 uvx(或 python / docker,取决于您的启动方式)是否可以“访问其他应用的数据”。请点击 允许 (Allow) — MCP 会读取位于 ~/Library/Containers/com.apple.iBooksX/ 的 Apple Books 私有容器,macOS 将其视为其他应用的沙盒数据。访问权限为只读且仅限于该容器;无论如何服务器都能启动,但如果没有权限,所有工具都将返回空结果。

macOS 权限提示:uvx 想要访问其他应用的数据。不允许 / 允许。

配置

Claude Desktop 设置

使用 uvx (推荐)

{
    "mcpServers": {
        "apple-books-mcp": {
            "command": "uvx",
            "args": [ "apple-books-mcp@latest" ]
        }
    }
}

使用 python

{
    "mcpServers": {
        "apple-books-mcp": {
            "command": "python",
            "args": ["-m", "apple_books_mcp"]
        }
    }
}

使用 Docker

{
    "mcpServers": {
        "apple-books-mcp": {
            "command": "docker",
            "args": [
                "run", "-i", "--rm",
                "-v", "~/Library/Containers/com.apple.iBooksX/Data/Documents:/root/Library/Containers/com.apple.iBooksX/Data/Documents:ro",
                "ghcr.io/vgnshiyer/apple-books-mcp:latest"
            ]
        }
    }
}

即将推出的功能

  • [ ] PDF 内容访问(目前仅支持 EPUB)

  • [ ] 通过 CFI → 段落解析实现更完整的标注上下文

贡献

感谢您考虑为本项目做出贡献!

开发

如果您克隆了此仓库,可以使用以下配置在 Claude Desktop 中进行测试:

使用 uv venv 创建虚拟环境并安装依赖项。

uv venv
uv sync

调试

使用 Claude Desktop

{
    "mcpServers": {
        "apple-books-mcp": {
            "command": "uv",
            "args": [
                "--directory",
                "/path/to/apple-books-mcp/",
                "run",
                "apple_books_mcp",
                "-v"
            ]
        }
    }
}

使用 inspector

npx @modelcontextprotocol/inspector uvx apple-books-mcp

提交 Issue

如果您遇到 Bug、有功能请求或想讨论与项目相关的内容,请在 GitHub 仓库中提交 Issue。提交 Issue 时,请提供:

Bug 报告:详细描述问题。如果可能,请包含重现 Bug 的步骤,以及任何错误消息或截图。

功能请求:清晰地解释您希望添加到项目中的新功能。提供关于该功能为何有益的背景信息。

一般讨论:欢迎就与项目相关的更广泛主题发起讨论。

贡献流程

1️⃣ Fork GitHub 仓库 https://github.com/vgnshiyer/apple-books-mcp
2️⃣ 为您的更改创建一个新分支 (git checkout -b feature/my-new-feature)。
3️⃣ 进行更改并彻底测试。
4️⃣ 推送您的更改并向 main 分支提交 Pull Request。

请为您的更改提供清晰的标题和描述。

许可证

Apple Books MCP 采用 Apache 2.0 许可证授权。详情请参阅 LICENSE 文件。

Available Tools

31 tools
add_book_to_collectionAdd a book to a collectionC
Idempotent

Add a book to a collection (user-created collections and "Want to Read"). Idempotent. Requires write access and Books to be quit.

Args: collection_id: The collection's numeric ID. book_id: The book's numeric ID.

Inputs: book_id (required), collection_id (required).

create_collectionCreate a collectionA

Create a new collection in the user's Apple Books library. Requires write access and Books to be quit; a backup is taken automatically.

Args: title: Name for the new collection. details: Optional description.

Inputs: title (required), details.

delete_collectionDelete a collectionA
DestructiveIdempotent

Delete a user-created collection (built-in collections are refused). The books inside are NOT deleted — only the collection. Requires write access and Books to be quit.

Args: collection_id: The collection's numeric ID.

Inputs: collection_id (required).

describe_annotationDescribe an annotationA
Read-only

Describe a specific annotation in detail — text, note, book (with an Open in Books: link), chapter, color, creation date. For the passage around the highlight, call get_annotation_context instead.

Args: annotation_id: The annotation's numeric ID.

Inputs: annotation_id (required).

describe_bookDescribe a bookA
Read-only

Describe a specific book in detail — metadata (title, author, genre, page count), reading status (progress, last opened, finished date), and annotation count. Also whether the chapter tools can read its text (Readable text:, and why not), and an Open in Books: link (ibooks://assetid/...) that opens it in Apple Books.

Args: book_id: The book's numeric ID.

Inputs: book_id (required).

describe_collectionDescribe a collectionB
Read-only

Describe a specific collection in detail — title, details text, and the books contained in it.

Args: collection_id: The collection's numeric ID.

Inputs: collection_id (required).

get_annotation_contextGet the passage around a highlightA
Read-only

Return the passage around a specific highlight — the text before and after, with the highlight itself wrapped in «...». Use this to expand on a highlight without fetching the whole chapter.

Works for non-DRM EPUBs downloaded to this Mac; fails with a clear message for DRM-protected books, iCloud-only books, or older annotations that lack the chapter hint.

Args: annotation_id: The annotation's numeric ID. chars_before: Chars of context before the highlight (0–5000). Default 500. chars_after: Chars of context after the highlight (0–5000). Default 500.

Inputs: annotation_id (required), chars_after, chars_before.

get_annotations_by_date_rangeAnnotations by date rangeA
Read-only

Annotations created within a date range, newest first by default. Flat rows with the creation time and book name inline. Dates and times are in the Mac's local time zone, named in the header.

Row format::

YYYY-MM-DD HH:MM [id] text — chapter · Book Title

Args: after: Only include annotations created on or after this date (YYYY-MM-DD, or YYYY-MM-DDTHH:MM). before: Only include annotations created on or before this date (YYYY-MM-DD covers the whole day, or YYYY-MM-DDTHH:MM). limit: Max annotations to return (1–500, default 50). offset: Annotations to skip, for paging. order_by: newest (default) or oldest first.

Inputs: after, limit, before, offset, +1 more.

get_books_by_genreFind books by genreA
Read-only

Get books whose genre matches the given string (substring match). Output is one row per match: [id] title by author (genre).

Args: genre: The genre to search for (e.g. "Romance", "Philosophy"). limit: Max books to return (1–500, default 200). offset: Books to skip, for paging.

Inputs: genre (required), limit, offset.

get_books_in_progressBooks in progressA
Read-only

Get books currently being read (progress > 0% and < 100%). Output per row: [id] title by author with a progress summary below.

Args: limit: Max books to return (1–500, default 200). offset: Books to skip, for paging.

Inputs: limit, offset.

get_chapter_contentGet chapter textA
Read-only

Return the plain-text content of a chapter, paginated by default to protect the context window. Get chapter_id from list_book_chapters or from the (ch=...) suffix on annotation listing rows, or pass "current" (the default) for the chapter the user is reading in Apple Books. Works for non-DRM EPUBs downloaded to this Mac.

Default max_chars=10000 (~2500 words) fits most chapters in one call. Longer chapters return a slice with a footer naming the exact offset to pass next. At most 50000 chars are returned per call.

Every response ends with a footer like one of::

(full chapter returned: 4,872 chars.)
…(returned chars 0–10000 of 24,311 [10000 chars]. Call again with
  offset=10000 to continue; 14,311 chars remaining.)
(returned chars 20000–24311 of 24311 [4311 chars]. End of chapter.)

Args: book_id: The book's numeric ID. chapter_id: Chapter identifier, the 1-based chapter order as a string (e.g. "5"), or "current" (the default): the chapter of the user's reading position. A chapter whose id is literally "current" wins. offset: Character offset to start from. Defaults to 0. max_chars: Max chars to return (1–50000). Default 10000.

Inputs: book_id (required), offset, max_chars, chapter_id.

get_collection_booksList a collection's booksA
Read-only

List the books in a collection as lean rows: [id] title by author. Descriptions are intentionally omitted — collections with many books would otherwise emit tens of thousands of chars of marketing blurb. Use describe_book(id) for details on any specific book.

Args: collection_id: The collection's numeric ID.

Inputs: collection_id (required).

get_current_reading_positionCurrent reading positionA
Read-only

Return where the user last left off reading a book — chapter title and chapter_id, no text — and an Open in Books: link to the book. Follow up with get_chapter_content for the text.

Works for non-DRM EPUBs downloaded to this Mac. If Apple Books hasn't recorded a position, falls back to inferring from the user's most recent highlight (labeled as such in the output).

Args: book_id: The book's numeric ID.

Inputs: book_id (required).

get_finished_booksFinished booksA
Read-only

Get books that have been finished. Output per row: [id] title by author with a progress summary below.

Args: limit: Max books to return (1–500, default 200). offset: Books to skip, for paging.

Inputs: limit, offset.

get_highlights_by_colorHighlights by colorA
Read-only

Browse highlights of a particular color, grouped by book.

Output is one row per highlight: [id] text — chapter. The book's name is shown once in the header, with a count of matching highlights on this page.

Args: color: yellow, green, blue, pink, or purple. limit: Max annotations to return (1–500, default 50). offset: Annotations to skip, for paging. order_by: newest (default) or oldest first.

Inputs: color (required), limit, offset, order_by.

get_library_statsLibrary statsA
Read-only

Get a summary of your Apple Books library with reading stats.

Inputs: no named parameters.

get_recently_read_booksRecently read booksA
Read-only

Get the most recently read books, newest first (by when each was last opened or read, whichever is later). Output per row: [id] title by author with a progress summary below.

Args: limit: Max books to return (1–500, default 10). offset: Books to skip, for paging.

Inputs: limit, offset.

get_unstarted_booksUnstarted booksA
Read-only

Get books that haven't been started yet (0% progress). Output per row: [id] title by author with a progress summary below.

Args: limit: Max books to return (1–500, default 200). offset: Books to skip, for paging.

Inputs: limit, offset.

list_all_annotationsList all annotationsA
Read-only

Browse all annotations grouped by book, most recent first. Rows: [annotation_id] <text> — <chapter title> (ch=<id>), with the user's note, if any, on a second line prefixed with ↳ note:. Pass ch=<id> to get_chapter_content for the chapter, or call get_annotation_context(annotation_id) for the passage around a specific highlight.

Args: limit: Max annotations to return (1–500, default 50). offset: Annotations to skip, for paging; a footer names the next offset when there are more.

Inputs: limit, offset.

list_all_booksList all booksA
Read-only

List all books in my Apple Books library. Output is one row per book: [id] title by author. Use describe_book(id) for details on any book.

Args: limit: Max books to return (1–500, default 200). offset: Books to skip, for paging; a footer names the next offset when there are more.

Inputs: limit, offset.

list_all_collectionsList collectionsA
Read-only

List all collections in my Apple Books library. Output is one row per collection: [id] title. Use describe_collection(id) for details or get_collection_books(id) to list its books.

Args: limit: Max collections to return (1–500, default 200). offset: Collections to skip, for paging.

Inputs: limit, offset.

list_annotationsList a book's annotationsA
Read-only

List annotations within a specific book in reading order (their position in the book). Rows are lean — [annotation_id] <text> — <chapter> (ch=<id>) — with the user's note, if any, on a second line prefixed with ↳ note:.

Args: book_id: The book's numeric ID. limit: Max annotations to return (1–500, default 50). offset: Annotations to skip, for paging; a footer names the next offset when there are more.

Inputs: book_id (required), limit, offset.

list_book_chaptersList a book's chaptersA
Read-only

List the table of contents for a book — chapter titles, order, and nesting depth. Only works for non-DRM EPUBs that have been downloaded to this Mac.

Args: book_id: The book's numeric ID (from list_all_books or similar).

Inputs: book_id (required).

recent_annotationsRecent annotationsA
Read-only

Most recent annotations, newest first. Flat rows with the creation time (the server's local time zone) and book name inline so Claude can see chronology across books at a glance.

Row format::

YYYY-MM-DD HH:MM [id] text — chapter · Book Title

Args: limit: Max annotations to return (1–500, default 10). offset: Annotations to skip, for paging.

Inputs: limit, offset.

remove_book_from_collectionRemove a book from a collectionA
DestructiveIdempotent

Remove a book from a collection (the book stays in the library). Idempotent. Requires write access and Books to be quit.

Args: collection_id: The collection's numeric ID. book_id: The book's numeric ID.

Inputs: book_id (required), collection_id (required).

rename_collectionRename a collectionA
DestructiveIdempotent

Rename a user-created collection (built-in collections are refused). Requires write access and Books to be quit.

Args: collection_id: The collection's numeric ID. new_title: The new name.

Inputs: new_title (required), collection_id (required).

search_annotationsSearch annotationsA
Read-only

Search across every annotation field — selected (highlighted) text, the surrounding paragraph, and the user's note body. Grouped by book; a row's note, if any, is on a second line prefixed with ↳ note:. Use search_notes when you only want to find your own written notes.

Args: text: Substring to match anywhere in an annotation. limit: Max annotations to return (1–500, default 50). offset: Annotations to skip, for paging. order_by: newest (default) or oldest first.

Inputs: text (required), limit, offset, order_by.

search_booksSearch books by title or authorA
Read-only

Search for books whose title or author contains query, ignoring case, accents and quote/dash style ("don't" finds "Don’t", "godel" finds "Gödel"). Output is one row per book, by book id: [id] title by author. Use describe_book(id) for details.

Args: query: Text to find in the title or the author's name. limit: Max books to return (1–500, default 200). offset: Books to skip, for paging; a footer names the next offset when there are more.

Inputs: query (required), limit, offset.

search_books_by_titleSearch books by titleA
Read-only

Search for books by title (substring match, ignoring case, accents and quote/dash style). Output is one row per match: [id] title by author. Use describe_book(id) for details, and search_books to match authors too.

Args: title: The title to search for. limit: Max books to return (1–500, default 200). offset: Books to skip, for paging; a footer names the next offset when there are more.

Inputs: title (required), limit, offset.

search_collections_by_titleSearch collections by titleA
Read-only

Search for collections by title (substring match). Output is one row per match: [id] title.

Args: title: The title to search for.

Inputs: title (required).

search_notesSearch notesA
Read-only

Search user notes (not highlights) by substring, grouped by book. Output shows the highlighted passage on the primary row and the matching note on a second line prefixed with ↳ note:.

Args: note: Substring to find inside note bodies. limit: Max annotations to return (1–500, default 50). offset: Annotations to skip, for paging. order_by: newest (default) or oldest first.

Inputs: note (required), limit, offset, order_by.

Tool Schema Changelog

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

Loading tool schema changelog…

    TDQS

    A3.5/5.0

    Scored across 31 tools

    Disambiguation4/5

    Most tools target distinct resources or actions (collections, books, annotations, chapters), and descriptions clarify differences like search_books vs search_books_by_title or list_annotations vs list_all_annotations. However, several listing/searching tools for the same resource overlap somewhat, requiring careful reading to pick the right one.

    Naming Consistency4/5

    Names are predominantly snake_case with a clear verb_noun structure (list_, get_, describe_, search_, create_, rename_, delete_, add_, remove_). Minor inconsistencies include 'recent_annotations' lacking a verb prefix and filtered book lists using 'get_' while full lists use 'list_', but the overall pattern is readable.

    Tool Count2/5

    31 tools is heavy for the domain; many could be consolidated (e.g., the four reading-status book filters, the multiple book search tools, the several annotation listing tools). While the domain is complex, the rubric flags 25+ as too many, and several tools feel redundant.

    Completeness3/5

    Read coverage is extensive (books, collections, annotations, chapters, stats), but there are notable gaps in write operations: no tools to create/update/delete annotations or notes, no book metadata editing, no reading progress updates, and no ability to add/remove books from the library. Collection CRUD exists, suggesting write support is intended, so these gaps limit full lifecycle coverage.

    Maintenance

    ActivitySlowing
    ResponsivenessOutdated data

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      Not graded
      quality
      B
      maintenance
      Enables AI clients to read and write local Apple Books library, collections, and annotations. Supports searching, exporting, and modifying books and highlights via MCP tools.
      1
      MIT
    • F
      license
      Not graded
      quality
      C
      maintenance
      MCP server enabling AI assistants to search, browse, and discover books from Books Mandala's live catalog of 50,000+ titles.
      2
      -