apple-books-mcp
Allows reading and writing to the local Apple Books library, including books, collections, and annotations.
Click on "Install Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@apple-books-mcplist my books from 2024"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
Apple Books MCP Server
A Bun/TypeScript Model Context Protocol server that lets an AI client (Claude Desktop, Cursor, Copilot CLI, …) read and write your local Apple Books library, collections, and annotations.
⚠️ Educational / personal use only. This accesses Apple Books' internal Core Data SQLite databases under
~/Library/Containers/com.apple.iBooksX/, which is not a supported Apple API. Schema can change between macOS releases. The server validates the schema at startup and refuses to run if it doesn't recognise it; even so, use at your own risk.
Requirements
macOS (the only platform that has Apple Books)
Bun ≥ 1.0 (this server is not Node-compatible)
Full Disk Access for the process that will run this server (see below)
Related MCP server: apple-books-mcp
Full Disk Access — read this first
macOS sandboxes ~/Library/Containers/. Without Full Disk Access, the
server's first SQLite call will fail with EACCES and you'll see a startup
error. To grant it:
System Settings → Privacy & Security → Full Disk Access
Add the terminal application that will spawn the MCP server. Which one depends on your client:
Claude Desktop spawns its servers itself, so add Claude.app.
Cursor / VS Code spawn from the editor, so add Cursor.app or Code.app.
Copilot CLI runs from your shell, so add Terminal.app (or iTerm.app, etc.).
Restart the client. macOS does not pick up new permissions until the process restarts.
You'll know it worked when this server starts without printing
could not open the Apple Books library.
Install
bun add -g @ragmha/apple-books-mcp # if/when published to npm
# or run directly from a clone:
git clone https://github.com/ragmha/apple-books-mcp.git
cd apple-books-mcp && bun installThe bin entry points at the TypeScript source — Bun executes .ts files
directly, so no build step is needed. Node and npx will not work;
bunx (or pointing command at bun) is required.
MCP client setup
Claude Desktop
Add to ~/Library/Application Support/Claude/claude_desktop_config.json:
{
"mcpServers": {
"apple-books": {
"command": "bunx",
"args": ["@ragmha/apple-books-mcp"]
}
}
}Or for a local clone:
{
"mcpServers": {
"apple-books": {
"command": "bun",
"args": ["run", "/absolute/path/to/apple-books-mcp/src/index.ts"]
}
}
}Cursor / VS Code (with MCP support)
Add to .vscode/mcp.json:
{
"servers": {
"apple-books": {
"command": "bunx",
"args": ["@ragmha/apple-books-mcp"]
}
}
}Copilot CLI
copilot mcp add apple-books bunx @ragmha/apple-books-mcpDemo
The repository includes a scripted Remotion demo that uses sanitized sample
books, highlights, and notes. It shows the read flow (list_books,
search_highlighted_text, export_annotations_markdown) and the write flow
(create_collection, collection membership changes, annotation updates/deletes,
backups, and restore) without touching a real Apple Books library.
bun run demo:preview # open Remotion studio
bun run demo:render # render demo/out/apple-books-mcp-demo.mp4See demo/ for the source, transcript, and client-agnostic prompts.
Generated videos are ignored by git and are not included in the npm package.
Tools
All list/search tools accept limit (default 50, max 100) and offset.
Reads — collections
Tool | Purpose |
| All non-deleted collections |
| Books in one collection |
| Details of one collection by UUID or |
Reads — books
Tool | Purpose |
| Books, paginated (use this) |
| Every book, no pagination (use sparingly — large libraries blow past LLM context) |
| One book by |
| Title / author / genre, case-insensitive partial match |
Reads — annotations
Tool | Purpose |
| Recent annotations across the whole library, paginated |
| The 10 most recently modified annotations |
| All annotations for one book |
| One annotation by UUID or |
| Highlights of one colour, paginated ( |
| Search the highlighted-text field |
| Search the user-written note field |
| Search highlight text, note, and representative text together |
| Render annotations as Markdown — pass an |
Writes
Every write snapshots the relevant database (Library or Annotations), verifies the snapshot's integrity, quits Books.app before the change, runs in a
BEGIN IMMEDIATEtransaction with full Core Data discipline (Z_OPTbumped, mtimes refreshed, parent-collection mtime refreshed for iCloud sync), and relaunches Books.app on success. SeeCONTEXT.mdfor the architecture.
Tool | Purpose |
| Add an existing book to a collection |
| Remove a book from a collection |
| Returns the new |
| Soft delete ( |
| Rewrite the note text on a highlight |
| Soft-delete an annotation ( |
| Enumerate previously-taken Library snapshots, newest first |
| Roll the Library back to a chosen snapshot (with the same safety ceremony as a write) |
Backups & restore
Every write produces a snapshot file alongside the database it touched:
Library writes snapshot
~/Library/Containers/com.apple.iBooksX/Data/Documents/BKLibrary/BKLibrary*.sqlite
to a BKLibrary*.sqlite.backup-<timestamp> sibling; annotation writes do
the equivalent in
~/Library/Containers/com.apple.iBooksX/Data/Documents/AEAnnotation/.
The five most recent backups per database are kept; older ones are pruned.
To roll back the Library, ask your MCP client to run list_backups
(returns {handle, createdAt, sizeBytes} newest-first), then call
restore_backup with the chosen handle. The restore runs the same
safety ceremony as a write: integrity-check the chosen backup → quit
Books.app → take a fresh pre-restore safety snapshot of the current
Library → swap the file → relaunch Books. The safety snapshot path is
returned in the result so you can roll forward again if needed.
To roll back annotations, the manual procedure below is currently the
only option (a parameterised restore_backup for the Annotations DB is on
the roadmap).
If you'd rather restore by hand:
Quit Apple Books.
In the
BKLibrary(orAEAnnotation) directory, find the.backup-*file you want.Copy it over the live
.sqlitefile (preserve the live filename — the suffix matters).Delete the
.sqlite-waland.sqlite-shmsiblings if they exist.Reopen Apple Books.
Troubleshooting
"Apple Books schema validation failed; the codebase expects Core Data
tables/columns that are not present" — this server has been tested
against macOS 14/15 Apple Books schemas. If you're on a newer macOS that
has changed the schema, please open an issue with your sw_vers output and
the error detail.
"could not open the Apple Books library" — Full Disk Access not granted to the process running this server. See above.
"database is locked" on a write — Apple Books was open during a write and our quit step couldn't reach it (or another process has the file open). The mutation rolled back; try again with Books closed.
Backup integrity check failed — disk full or filesystem error during the snapshot copy. Free space and retry; nothing on disk was modified.
Tool returned Operation failed. — the original error is on stderr.
This server deliberately sanitises tool responses because SQLite constraint
errors can include user PII (book titles, note text).
Development
bun install
bun run check # Biome format/lint/import organization
bun run typecheck # tsc --noEmit
bun test # 72 tests, in-memory SQLite + fake adapters
bun run dev # watch-mode startThe architecture lives in CONTEXT.md, including an ASCII
diagram of the read rail, write rail, and the production-vs-test fork at
the port adapters.
Contributing
Pull requests welcome. Please read CONTRIBUTING.md
for the dev loop, commit style, and how the test fixtures work.
Security
Found a security issue? Please don't open a public issue — see
SECURITY.md for how to report privately.
License
MIT — see LICENSE.
Trademark notice. "Apple", "Apple Books", and "iBooks" are trademarks of Apple Inc., registered in the U.S. and other countries. This project is an independent, unofficial tool and is not affiliated with, endorsed by, or sponsored by Apple Inc. in any way.
This server cannot be installed
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Latest Blog Posts
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/ragmha/apple-books-mcp'
If you have feedback or need assistance with the MCP directory API, please join our Discord server