Skip to main content
Glama

bookorbit-mcp

An MCP server for finding books, reading EPUB text, and inspecting your library and reading history in a self-hosted BookOrbit instance.

This repository (masonfox/bookorbit-mcp, version 0.4.0-fox.1) is a downstream variant of joshstrange/bookorbit-mcp. It adds opt-in admin tools and inbound authentication for HTTP mode; with their env vars unset it behaves exactly like upstream v0.4.0, which the sections below describe. See Fork additions.

MCP v0.4.0 targets BookOrbit v3.10.0. It exposes 60 tools: 52 read-only tools and 8 write tools, the beta request_book and the writes to your own reading state and collections. Read-only describes the operation: query_books, get_genre_books, get_library_facets and request-availability checks use safe POST queries. MCP tool annotations mark search_requestable_books, search_author_metadata and request_book as open-world, because BookOrbit queries external metadata providers for them; request_book is also non-destructive and non-idempotent. Every write's description starts with WRITE:.

How it works

Find a book, inspect its chapter list, and fetch the sections you need. BookOrbit supplies EPUB structure and internal XHTML through /epub/{bookId}/info and /epub/{bookId}/file/{path}; this server extracts and caches text locally.

Three controls keep results bounded:

  1. list_chapters returns labels and character/word counts, without body text.

  2. get_chapter caps output at about 24,000 characters by default and provides offset / nextOffset for long chapters.

  3. search_in_book returns snippets with a chapter index and offset for a follow-up fetch.

The three text tools accept fileId. When omitted, the server selects a primary EPUB, then a sole alternative EPUB. If several alternatives remain, select an EPUB file ID from get_book. Only literal EPUB files are supported for text extraction.

Related MCP server: booklore-mcp

Tools

All tool parameters marked ? are optional. MCP page numbers start at 1. Browse, genre/tag and query requests translate this to BookOrbit's zero-based pages; reading history translates it to offset/limit; annotations, sessions, reading attempts and book requests keep their upstream one-based pages; bookmarks and grouped progress are paged locally. New paginated tools default to 25 results with a maximum of 100.

Tool errors keep BookOrbit's status, path and message. Known failures add a one-line Hint: with the fix: App Attest routes, API key limits (API_KEY_READ_ONLY, API_KEY_ROUTE_FORBIDDEN, API_KEYS_DISABLED, invalid keys), missing permissions and library access, merged books (with the surviving bookId), request destination and targetBookId refusals, reading-date refusals, demo-restricted accounts, unknown book IDs, and 404s on an ID (which discovery tool lists valid IDs).

Find and read

Tool

What it does

search_books(query, limit?)

Title/author/series search, maximum 20 results; returns book IDs, formats, and EPUB availability.

search_library(query, limit?, libraryId?)

Search books, authors, and series together with matched fields and per-group totals. Limit defaults to 5, maximum 10; query length 2–200.

query_books(q?, filter?, sort?, page?, size?, randomSeed?, collapseSeries?, collapseLinked?)

Structured library queries with nested AND/OR rules, custom fields, and stable seeded sorting. collapseLinked folds linked editions into one card.

get_book(bookId)

Metadata plus library, author, series, and file IDs, memberships, read status, rating, custom metadata, genre/tag IDs (genreRefs/tagRefs), provider IDs/links, and linked editions (other formats or editions of the same work).

list_chapters(bookId, fileId?)

Chapter labels and sizes; builds the text cache on first use.

get_chapter(bookId, chapter, offset?, maxChars?, fileId?)

One EPUB section as paginated plain text.

search_in_book(bookId, query, maxResults?, caseSensitive?, fileId?)

Keyword search within one EPUB, returning snippets and locations.

list_custom_metadata_fields()

Active field IDs, labels, types, and library enablement for custom:<id> query rules and sorts.

Query examples and wire contract explain filters, sorts, and pagination.

Discovery and browse

Tool

What it does

get_related_books(bookId, kind)

similar, same_series, or same_author recommendations.

list_series(page?, size?, …) / get_series_books(seriesId, page?, size?, …)

Browse series and their books with search, ordering, library, and series-completion filters where supported. Series indices are string labels.

get_next_series_book(seriesId, bookId)

Next series candidate with exact file ID and format, or null. The server's epub reader group can also return MOBI/AZW/FB2; inspect the format before using EPUB text tools.

list_authors(page?, size?, …) / get_author(authorId) / get_author_books(authorId, page?, size?, …)

Author discovery, biography, and paginated books with supported filters and sorts.

list_collections() / get_collection(collectionId) / get_collection_books(…)

Collections, detail, and member books. To change them, see Writes.

list_smart_scopes() / get_smart_scope_books(scopeId, q?, filter?, sort?, page?, size?)

Saved dynamic filters and matching books. An optional query_books filter narrows the scope; an omitted or empty sort uses the scope's saved default sort.

list_genres(kind, q?, sort?, order?, page?, size?, libraryId?) / get_genre(kind, id) / get_genre_books(kind, id, libraryId?, q?, filter?, sort?, page?, size?, …)

Genre or tag (kind) index with read counts, one entry with its libraries and similar names, and its books with the query_books grammar. Ids come from list_genres or get_book's genreRefs/tagRefs.

list_libraries()

Accessible libraries with book, storage, and format stats.

get_library_facets(libraryId, q?, filter?)

Book totals and per-format book counts for one library, optionally under a query_books filter.

suggest_metadata(kind, q)

Typeahead over metadata facets; resolve a name for filtering.

get_book_shelf(type, limit?, smartScopeId?)

Curated shelf with returned count, books, and upstream nullable total; smart-scope shelves require an ID.

search_author_metadata(q, …)

External provider biography candidates; fresh bypasses BookOrbit's metadata cache and cacheHits counts cached answers.

Reading state and statistics

Tool

What it does

get_reading_progress(bookId)

Per-file reading progress (percentage 0–100) for files with saved progress, and available audiobook progress.

list_reading_progress(bookId? | fileId?, page?, pageSize?)

Text, narration, Kobo and KOReader positions for every file of a book (or one file), percentages 0–100; paged locally.

list_currently_reading()

Current books with file IDs/formats and resume modes.

get_reading_sessions(bookId, page?, pageSize?, …)

Session history and stats with date, format, and sort options.

get_bookmarks(bookId, page?, pageSize?)

Saved locations; locally paginates the upstream bookmark array.

get_reading_attempts(bookId, page?, pageSize?)

Server-paginated reading/rereading attempts and outcomes.

get_reading_history(page?, pageSize?, year?, quarter?, outcomes?, search?, bookId?, sort?)

Finished reads across the library (completed only by default), with per-month counts on page 1.

get_reading_history_summary(year?, quarter?)

Totals, records, outcomes, formats, sources and goal for a year, quarter or all time.

get_reading_history_marks(attemptId)

A read's highlight and journal preview (at most 3 and 2) with total counts.

get_library_stats() / get_reading_stats()

Library and personal reading totals.

get_library_statistic(kind, libraryIds?)

A library distribution, timeline, top-N chart, or metadata gauge.

get_reading_statistic(kind, days?, …)

Personal reading charts with per-kind options.

get_dashboard_widget(kind)

Headline widgets such as streak, goal and projection. Use list_annotations for highlights.

See attempts, reading history and grouped progress for exact contracts. Reading history pages are translated to BookOrbit's offset/limit, and since BookOrbit v3.10 linked editions count as one work (finishing a second edition is a reread). Since BookOrbit v3.7 the reading-activity routes accept only App-Attested iOS/Android requests, so the removed get_reading_activity has no direct replacement; the reading-history tools replace it where possible (reading activity). The dashboard widgets with the same guard are fetched through the unguarded widget batch instead (dashboard).

Highlights and notes

Tool

What it does

list_annotations(page?, pageSize?, …)

Live, paginated annotation hub with text, chapter, colors, styles, origins, dates, note/review/status, and sort filters.

list_annotated_books(q?, limit?, status?, selectedId?)

Book facet/typeahead, default 20 and maximum 50; not an exhaustive library list.

get_annotations(bookId, page?, pageSize?, …)

Always a bounded page, default 1/25; annotationCount is the matching total, alongside annotations, page, pageSize, and stats.

get_annotation_overview()

Library annotation totals, facets, weekly activity, and device summaries.

Annotations retain CFI/file locators, position status, and highlight timestamps. Their reader chapter indices differ from MCP TOC-section indices. See annotations.

Beta book requests

Tool

What it does

search_requestable_books(query, author?, isbn?, providers?, limit?, fresh?, resultsPerProvider?)

Search configured external metadata providers for ebook choices. Returns provider IDs, edition metadata, ownership/request status, destination defaults, incomplete/provider-warning flags, and which results came from BookOrbit's metadata cache (cache, cacheHits). Default 5, maximum 20 results; fresh asks providers live and resultsPerProvider (1–20, default 5) sets each provider's count.

request_book(providerKey, providerId, language?, note?, targetLibraryId?, targetFolderId?, targetBookId?)

Writes: request the selected book or subscribe to its existing request. Looks up canonical metadata again and asks for EPUB, using the normal request queue and configured destination.

list_my_book_requests(view?, q?, status?, mediaKind?, sortBy?, sortDir?, page?, pageSize?)

Requests you made or subscribe to, with status, reason, destination, matched book and download status, plus per-view counts.

get_book_request(requestId)

One request by ID, to follow up after request_book.

Choose a result from search_requestable_books, then pass its exact providerKey and providerId to request_book. Search never submits a request. The request tool requires BookOrbit's book_request_access permission and follows the account's normal approval/automation rules; configured automation can download/import approved requests. EPUB is a preferred format, not a guarantee of fulfilment.

Language is unrestricted unless you provide language; the selected edition's language is not silently imposed. targetLibraryId/targetFolderId override the configured destination. targetBookId asks for the EPUB to join an existing library book, and only works for a book with no ebook-kind file (for example an audiobook-only book): any EPUB, MOBI, AZW, FB2, PDF, DjVu or comic file makes BookOrbit refuse it with SUBMIT_TARGET_BOOK_HAS_MEDIUM. A joined target's library and folder replace the destination; in a loose-file library, or one that does not accept ebook formats, the target is dropped and the response's targetBookId is null. Since v3.10, a downloaded file the target library refuses goes to the default destination instead. Submission returns the request ID/status and whether you joined an existing request. If a submission response is lost, check BookOrbit Requests before retrying. The live smoke scripts exercise reads only; creation tests use a synthetic server.

Follow up with list_my_book_requests or get_book_request: statuses, statusReason and failureCode are passed through as strings, so values added upstream parse. An import BookOrbit v3.10 holds for review as another edition (edition_mismatch on the review endpoints) shows here as status needs_review. See beta request API for routes, permissions, and examples.

Writes

Tool

What it does

Annotations

set_read_status(bookIds, status, startedAt?, finishedAt?)

Set your read status (unread, want_to_read, reading, on_hold, rereading, read, skimmed, abandoned) on 1–50 books, with optional YYYY-MM-DD dates. Closes or starts reading attempts; see the side effects below.

destructive, idempotent, closed-world

set_rating(bookIds, rating)

Set your own rating, whole stars 1–5, or null to clear, on 1–50 books. Needs the library_edit_metadata permission. Books with a locked rating are skipped silently.

destructive, idempotent, closed-world

create_collection(name, description?, icon?, isPublic?)

Create a collection you own; icon defaults to FolderOpen. Returns it with its collectionId. A duplicate name is a 409.

not destructive, not idempotent, closed-world

update_collection(collectionId, name?, description?, icon?, isPublic?)

Change the given fields of a collection you own; description: null clears it.

destructive, idempotent, closed-world

delete_collection(collectionId)

Delete a collection you own; the books are untouched. A 404 means not found or already deleted.

destructive, idempotent, closed-world

add_books_to_collection(collectionId, bookIds)

Add 1–50 books; books already in it are kept. Returns the updated collection.

not destructive, idempotent, closed-world

remove_books_from_collection(collectionId, bookIds)

Remove 1–50 books; books not in it are ignored. Returns the updated collection.

destructive, idempotent, closed-world

These change BookOrbit state; call them only when the user asks. The book writes take explicit book IDs (never a query selection), drop duplicates and accept at most 50. A password login or a write API key is required. Writes are never retried: after a 5xx, a timeout or a lost connection the tool says the outcome is unconfirmed, and you should read the state back before trying again. BookOrbit answers the status and rating writes with 204 and no per-book result, so those tools return the IDs they sent and a note on how to confirm; the collection writes return the updated collection.

set_read_status side effects: unread or want_to_read on a book in progress closes its active attempt as abandoned (history is kept); read, skimmed or abandoned closes an active attempt with that outcome; read on a book already read rewrites that read's dates instead of adding a reread; no reading sessions are created. finishedAt goes only with read, skimmed or abandoned, and unread/want_to_read take no dates. The write is not atomic: after an error some books may already have changed, so check them with get_book or get_reading_attempts instead of retrying blindly. See reading-state writes.

set_rating stores a personal rating (also on your latest completed read of each book), but BookOrbit still requires the library_edit_metadata permission for it; the tool error's hint says so when it is missing. rating is required: BookOrbit treats an omitted rating as a clear, so the tool always sends it, and null clears. Books whose rating an editor has locked are skipped silently, and BookOrbit does not report which; confirm with get_book. The write is atomic.

Collections: only the owner (or a superuser) can change one; another user's public collection is read-only, and the 403 gets a hint. Names are unique among your collections (exact and case-sensitive); a duplicate is a 409 with a hint, and after an unconfirmed create a 409 means the first create succeeded. BookOrbit does not say which books an add or removal actually changed; bookCount counts only books you can see. See collections.

Images

Tool

What it does

get_book_cover(bookId, size?)

Cover image content, full or thumbnail.

get_author_image(authorId, size?)

Author image content, full or thumbnail.

Connection

Tool

What it does

get_server_info()

MCP name/version, configured auth mode (never the secret), BookOrbit health, version and feature flags, and the authenticated user and permissions. Each part reports its own error.

See server info.

Typical flow: search_library → get_book → list_chapters → get_chapter / search_in_book.

The server also sends this guidance as MCP instructions at initialize: take IDs from discovery tools (search_library, search_books, query_books), follow the read flow, and call request_book or any WRITE: tool only on the user's explicit request.

When series are collapsed, book cards retain seriesId and a compact collapsedSeries summary with book/read counts and available navigation IDs. total counts returned cards; author results also retain bookTotal, the underlying book count. Standalone cards have no grouping summary.

Requirements and configuration

Use BookOrbit v3.10.0 with an account that can access the desired libraries. The server runs locally for one configured user. Older-server compatibility is outside this release's scope.

Set environment variables, or use a gitignored local .env (see .env.example):

Variable

Required

Notes

BOOKORBIT_URL

yes

Base URL, for example https://bookorbit.example.com; trailing slash is accepted.

BOOKORBIT_API_KEY

alternative

BookOrbit API key (bok_…, v3.8+). Sent as a bearer token; no login or refresh. Takes precedence.

BOOKORBIT_USERNAME

recommended

Use with password for automatic login and refresh.

BOOKORBIT_PASSWORD

recommended

Account password.

BOOKORBIT_TOKEN

alternative

Static active-session JWT bearer token with a session ID (sid); no automatic refresh.

CACHE_DIR

optional

Extracted text cache; default ~/.cache/bookorbit-mcp.

Configure one method. If several are set, BOOKORBIT_API_KEY wins, then BOOKORBIT_TOKEN, then username and password; the server names the ignored variables (never their values) on stderr.

An API key avoids storing a password, which suits the container. The key is validated at startup (bok_ plus 49 letters and digits), sent only as Authorization: Bearer, and never refreshed; a 401 means the key is invalid, expired or revoked and must be replaced. A read key cannot use list_currently_reading, the batch-based get_dashboard_widget kinds, search_requestable_books, request_book or any write tool, because those use POST, PATCH or DELETE routes BookOrbit does not mark read-safe. The write tools need a write key; the request tools also need the book_request_access permission, and set_rating needs library_edit_metadata. BookOrbit's App Attest routes refuse every key; the MCP does not use them.

Password authentication uses BookOrbit's native-client login with device label bookorbit-mcp. Access and rotating refresh tokens, including expiries, remain in memory. Concurrent refreshes share one request; authenticated HTTP requests time out after 30 seconds. A rejected login (401/403/429) is not retried for 60 seconds (or the server's Retry-After), so a wrong password can't trip BookOrbit's account lockout; tool calls fail fast with the original error until then. A static bearer token must still belong to an active session; it is not a long-lived API key. See authentication.

Reads are retried once, after 300 ms, on a 502/503/504 or a network error: every GET except /auth/*, plus the read-only query POSTs (/books/query, /smart-scopes/{id}/books/query, /genres|tags/{id}/books/query, /libraries/{id}/books/facets, /dashboard/widgets/batch). A timed-out GET is retried; a timed-out POST is not. Login, refresh, /auth/me, request availability, POST /book-requests, POST /books/bulk-set-status, POST /books/bulk-set-rating, the collection writes and every other write are never retried. Each attempt has its own 30-second timeout.

Install and use

npm install
npm run build

Configure your MCP client to run the built entry point:

{
  "mcpServers": {
    "bookorbit": {
      "command": "node",
      "args": ["/absolute/path/to/bookorbit-mcp/dist/server.js"],
      "env": {
        "BOOKORBIT_URL": "https://bookorbit.example.com",
        "BOOKORBIT_USERNAME": "your-username",
        "BOOKORBIT_PASSWORD": "your-password"
      }
    }
  }
}

HTTP mode

dist/http.js serves the same tools over stateless MCP Streamable HTTP for a gateway or other HTTP client:

npm run build
BOOKORBIT_URL=https://bookorbit.example.com BOOKORBIT_USERNAME=... BOOKORBIT_PASSWORD=... npm run start:http

Variable

Default

Notes

MCP_HTTP_HOST

0.0.0.0

Listen address.

MCP_HTTP_PORT

8000

Listen port.

The BOOKORBIT_URL, BOOKORBIT_API_KEY, BOOKORBIT_USERNAME, BOOKORBIT_PASSWORD, BOOKORBIT_TOKEN and CACHE_DIR variables work as above; BOOKORBIT_API_KEY keeps a password out of the container. HTTP mode reads only the process environment; it does not load .env.

Route

Behavior

POST /mcp

JSON-RPC requests and notifications; JSON responses, no sessions. Each request gets a fresh MCP server instance.

GET / DELETE /mcp

405 with a JSON-RPC error body (no SSE stream, no sessions).

GET /health

200 {"ok":true}; does not contact BookOrbit.

other paths

404.

Request bodies over 4 MiB get 413. One BookOrbit client, login, and text cache are shared by all requests in the process, so concurrent calls share a single login. There is no inbound authentication: run it only on a private network or behind an authenticating proxy, never on a public port. Logs go to stderr and never include credentials.

Container image

The Dockerfile builds docker.io/joshstrange/bookorbit-mcp (node:24-slim, CMD ["node", "dist/http.js"], port 8000, CACHE_DIR=/cache). It runs as the node user by default and works under any non-root uid, such as user: "99:100"; mount a writable volume at /cache to keep the text cache. .github/workflows/container-image.yml pushes latest (default branch), sha-<7> and, for v* tags, the version tag for linux/amd64 on pushes to main, v* tags, or manual dispatch.

docker build -t bookorbit-mcp .
docker run --rm -p 8000:8000 -e BOOKORBIT_URL=... -e BOOKORBIT_USERNAME=... -e BOOKORBIT_PASSWORD=... bookorbit-mcp

Fork additions: admin tools and inbound auth

This downstream variant lives in its own repository, masonfox/bookorbit-mcp (a plain repository, not a GitHub fork). Upstream changes are merged from the upstream remote (joshstrange/bookorbit-mcp); most fork code is in new src/admin-*.ts files, and the few edits to upstream files sit in marked blocks, so merges stay small. Both additions are opt-in: with the two variables below unset, the tool list, server instructions and HTTP routes are identical to upstream's, apart from a stderr warning that /mcp is unauthenticated.

Variable

Mode

Notes

MCP_AUTH_TOKEN

HTTP only

Shared secret for inbound auth: at least 32 characters of A-Z a-z 0-9 _ - (surrounding whitespace trimmed; empty means unset). Any other value stops startup with an error that never echoes the value. Generate one with openssl rand -hex 32.

BOOKORBIT_ADMIN_TOOLS

stdio/HTTP

true, 1, yes or on (case-insensitive) registers the admin tools below and appends a short admin note to the server instructions. Unset, empty, false, 0, no or off keeps them off (the default); any other value stops startup.

Inbound auth

With MCP_AUTH_TOKEN set, every MCP request must carry the token, in either form:

  • POST /mcp with Authorization: Bearer <token> (scheme case-insensitive). Prefer the header wherever the client supports it.

  • POST /mcp/<token>, for clients that cannot send custom headers, such as Claude custom connectors.

The token is compared in constant time. Anything else, including any other path under /mcp/, gets 401 with WWW-Authenticate: Bearer and a JSON-RPC error body, before the request body is read. GET/HEAD /health stays open. Without a token, /mcp/<anything> is a 404 as upstream. The token is never logged: the startup line says only whether inbound auth is enabled and shows the endpoint as /mcp.

A path token can leak through proxy, Cloudflare or client logs. Use a 64-hex token (openssl rand -hex 32), keep it out of screenshots and shared configs, rotate it (change the env var, restart, update the connector URL) if it may have been exposed, and send the header instead wherever a client allows.

Admin tools

BOOKORBIT_ADMIN_TOOLS=true adds the tools below to the upstream set, in both stdio and HTTP mode. They change library-wide state for every user, so call them only on an explicit request. Every tool that can change state has a description starting with WRITE:, readOnlyHint: false, and destructiveHint: true where it overwrites, discards or deletes data; openWorldHint is set only where BookOrbit contacts external metadata providers. Admin writes are sent once and never retried: a 5xx, timeout or dropped connection is reported as an unconfirmed outcome with what to check first, a 4xx as a refusal. Bulk tools take explicit IDs only (never selectAll or a query selection), paged tools take one-based page, and output is capped at about 60,000 characters with a truncation note saying how to narrow the request.

Metadata (all need library_edit_metadata)

Tool

What it does

update_book_metadata(bookId, metadata, syncFileWrite?)

WRITE: PATCH /books/{id}/metadata with the given fields; common fields are typed and other UpdateBookMetadataDto fields pass through. Locked fields are ignored silently.

set_metadata_locks(bookId, lockedFields)

WRITE: replace the whole lock set; an empty list unlocks every field.

preview_metadata_refresh(bookId)

Provider refresh preview, saving nothing. Open-world. BookOrbit doesn't mark the route read-safe, so a read-only key gets 403.

refresh_book_metadata(bookId)

WRITE: refresh one book from providers, overwriting unlocked fields.

bulk_edit_metadata(bookIds, fields)

WRITE: edit 1–50 books: authors/genres/tags/narrators by add/remove/replace, single values for series name, publisher, language and edition, year fields, series memberships.

bulk_refresh_metadata(bookIds, ignoreCache?)

WRITE: start a background refresh of 1–200 books; returns the run ID and first event, then disconnects (the run continues; follow it on BookOrbit's Jobs page). At most 10 runs may be unfinished.

Book Dock (the import queue; all need book_dock_access)

Tool

What it does

get_book_dock_summary()

Summary and statistics.

list_book_dock_files(status?, needsReview?, readyToFile?, search?, …)

One page of files; status filters pending, ready or error only; limit 1–100 (default 20).

get_book_dock_file(fileId)

One file with its embedded, fetched and selected metadata and target.

get_library(libraryId)

A library with its folders (folderId, path), for targets. Admin-only; needs only access to the library.

update_book_dock_file(fileId, selectedMetadata?, targetLibraryId?, …)

WRITE: change one file's selected metadata and/or target; null clears a target.

book_dock_apply_fetched(fileIds)

WRITE: replace the selected metadata with the fetched metadata.

book_dock_retry_fetch(fileIds)

WRITE: queue another fetch for files in error.

book_dock_set_target(fileIds, targetLibraryId, targetFolderId)

WRITE: set the target library and folder.

book_dock_preview_finalize(fileIds, defaultLibraryId?, …, overrides?)

Preview filing: files nothing, but BookOrbit treats it as a write route, so it needs a write key plus library_upload.

book_dock_finalize(fileIds, defaultLibraryId?, …, overrides?)

WRITE: file into libraries. Needs library_upload. Not idempotent: after an unconfirmed outcome check list_book_dock_files before retrying.

book_dock_discard(fileIds)

WRITE: remove files from the dock; they cannot be recovered through the MCP.

book_dock_control(action)

WRITE: pause, resume or rescan. Needs manage_book_dock.

fileIds is 1–100 unique IDs. defaultLibraryId and defaultFolderId go together or not at all.

Library maintenance

Tool

What it does

Permission

scan_library(libraryId)

WRITE: start a background scan (202 = scan started).

manage_libraries

get_scan_history(libraryId, limit?)

Recent scans; limit 1–50, default 5.

manage_libraries

refresh_library_covers(libraryId)

WRITE: re-extract every cover in the library in the background.

manage_libraries

get_metadata_fetch_status()

Automatic metadata fetch status.

manage_metadata_config

get_metadata_fetch_failures(page?, limit?)

Failed fetches; limit 1–100, default 50.

manage_metadata_config

metadata_fetch_control(action, libraryId?, ignoreCache?)

WRITE: run (optionally one library), pause, resume, cancel, retry_failed. Open-world.

manage_metadata_config

get_missing_resources()

Read-only missing-files and broken-cover report. No clean or sweep tools are offered.

library_delete_books

write_metadata_to_files(libraryId, dryRun?)

WRITE: write stored metadata into the library's book files. dryRun defaults to true; false rewrites files. Waits up to about 280 seconds.

library_edit_metadata

BookOrbit v3.10.0 requires library_delete_books for GET /maintenance/missing-resources, even though the tool only reads; grant it only if you want that report.

API escape hatch

Tool

What it does

list_api_routes(search?, method?, prefix?, limit?)

Search the committed BookOrbit v3.10.0 route catalog (src/admin-routes.json): method, path, handler, permissions, readKeySafe, apiKeyForbidden. No network call.

api_get(path, query?, method?)

One GET, or a body-less POST only to a route the catalog marks readKeySafe; other POSTs are refused and pointed at api_write.

api_write(method, path, query?, body?)

WRITE: one POST, PUT, PATCH or DELETE with an optional JSON body. Destructive and not idempotent.

Both request tools refuse, without sending, paths with .., a URL scheme, //, \, ? or #; /auth routes other than GET /auth/me; and catalog routes BookOrbit closes to API keys (interactive-only routes such as /jobs, and App Attest routes). A path not in the catalog is still sent, with a warning. Permissions are whatever the route requires (list_api_routes shows them). The catalog is regenerated with scripts/generate-route-catalog.mts against a BookOrbit checkout.

API key permissions

Use a write API key (BOOKORBIT_API_KEY); a read-only key gets 403 on every admin write and on preview_metadata_refresh and book_dock_preview_finalize. Grant only the permissions for the groups you use; the key is the real boundary on what api_write can reach.

Group

Permissions

Metadata

library_edit_metadata

Book Dock

book_dock_access; library_upload for preview/finalize; manage_book_dock for book_dock_control

Library maintenance

manage_libraries (scans, covers); manage_metadata_config (metadata fetch); library_delete_books (missing resources); library_edit_metadata (write to files)

API escape hatch

Whatever each route requires

Docker Compose (Dockge)

Build from this repository and join the network BookOrbit runs on (here an external foxlan network, with BookOrbit reachable as bookorbit:3000). Put the secrets in Dockge's .env, not in the compose file.

services:
  bookorbit-mcp:
    build: https://github.com/masonfox/bookorbit-mcp.git#main
    image: bookorbit-mcp:fox
    container_name: bookorbit-mcp
    restart: unless-stopped
    environment:
      BOOKORBIT_URL: http://bookorbit:3000
      BOOKORBIT_API_KEY: ${BOOKORBIT_API_KEY}
      BOOKORBIT_ADMIN_TOOLS: "true"
      MCP_AUTH_TOKEN: ${MCP_AUTH_TOKEN}
      CACHE_DIR: /cache
    volumes:
      - ./cache:/cache
    networks:
      - foxlan

networks:
  foxlan:
    external: true

No port is published: the Cloudflare tunnel connector on the same network reaches http://bookorbit-mcp:8000. If the repository is private, build from a local checkout (build: /path/to/bookorbit-mcp) or pull ghcr.io/masonfox/bookorbit-mcp instead (see below). Check the file with docker compose config.

Cloudflare tunnel and Claude connector

Point a tunnel public hostname at http://bookorbit-mcp:8000. Don't put Cloudflare Access in front of it: Claude custom connectors can't complete an Access login, so MCP_AUTH_TOKEN is the gate. Add the connector in Claude with the path-token URL:

https://<host>/mcp/<MCP_AUTH_TOKEN>

Long streams: Cloudflare's proxy times out a response after roughly 100 seconds, and a write_metadata_to_files call holds the MCP response open for up to about 280 seconds. On a large library the tunnel may cut the call first; BookOrbit then cancels the run when the client disconnects, so some files may already be written. Run with dryRun: true first and, for a real write, prefer smaller libraries or run it over a direct connection (stdio, or HTTP on the LAN). The tool reports cancellation clearly, and the run can be repeated. bulk_refresh_metadata is unaffected: it returns after the first event and the run continues on the server.

GHCR image

.github/workflows/ghcr.yml runs the five checks and pushes ghcr.io/masonfox/bookorbit-mcp (latest on main, the tag for v* tags, sha-<7>) with the workflow's GITHUB_TOKEN. It only runs in masonfox/bookorbit-mcp. Upstream's Docker Hub workflow (container-image.yml) is left untouched; without Docker Hub secrets it fails in this repository and can be disabled in the Actions settings.

Development

npm test          # offline tests against synthetic fixtures
npm run typecheck
npm run lint
npm run format:check
npm run build
npm run dev       # server from source over stdio
npm run dev:http  # server from source over HTTP

# Live checks require credentials in .env:
node --import tsx scripts/smoke.mts
node --import tsx scripts/mcp-check.mts

Text and cache behavior

Chapters follow flattened TOC entries and fragment ranges. A missing/null TOC falls back to readable spine sections; MCP chapter indices remain TOC-section indices, separate from BookOrbit annotation/TTS spine or block coordinates.

Text caches are separated by server, authenticated user, book, EPUB file, and parser version. Each text call verifies current book access before returning cached content. Metadata changes, a 24-hour expiry, missing sections, or corrupt cache data trigger rebuilding. Builds fetch at most four spine files concurrently and publish atomically; old unscoped caches are ignored. Discovery, annotations, bookmarks, reading state, and statistics remain live and uncached.

Text extraction is EPUB-only. This release adds no conversion, local parsing of other formats, audiobook content tools, PDF/comic content tools, administrative request workflows, podcast tools (disabled upstream since v3.2), exports, RAG/embeddings, admin tools, integration mutations, or library metadata writes; the only writes are book requests, your own reading state and your own collections. Existing metadata and progress inspection remains available for other formats.

The API audit records upstream versions, sources, and the difference between HTTP responses and MCP shaping.

Tool Schema Changelog

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

Loading tool schema changelog…

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      Not graded
      quality
      D
      maintenance
      Enables searching, reading, and managing a Calibre ebook library through natural language, with features like metadata search, full-text search, content extraction, and library management.
      Apache 2.0
    • F
      license
      A
      quality
      D
      maintenance
      Enables AI assistants to interact with BookLore self-hosted libraries, allowing natural language queries to search books, manage reading status, ratings, series, authors, and highlights.
      7
      1
      -
    • A
      license
      Not graded
      quality
      D
      maintenance
      Enables LLMs to interact with a local Calibre Content Server to search libraries, list books, retrieve ebook content, chapters, and more.
      15 npm
      MIT
    • A
      license
      A
      quality
      B
      maintenance
      Enables an AI assistant to search a self-hosted ebook, comic and audiobook library, inspect books' metadata and shelves, and safely edit metadata, tags, genres, authors and shelf assignments. Safety is enforced in code: no delete tools, locked fields are refused, and bulk edits require a preview plus explicit confirmation.
      8
      MIT