Connect AI apps
Ask about an authorized book in ChatGPT or Claude, with links back to the text.
ChatGPT (Web)
- On ChatGPT Web, open Plugins and choose Add custom MCP server.
- Copy the address from Manual setup below, choose OAuth, then sign in to Leafhour and approve one book.
- After creating the plugin, install it. In a new conversation, use @ to select it, then ask about your authorized book.
ChatGPT Plugins · ChatGPT documentation
Claude
- In Claude, open Customize → Connectors and add a custom connector.
- Use the address from Manual setup. Under OAuth client, choose Register automatically, then sign in to Leafhour and approve one book. Team and Enterprise may need an owner to add it first.
- In the conversation, open + → Connectors and enable this connector before asking about the book.
Choose one book
Only the book you select is shared. Text, saved translations and source links are read-only by default for one hour. Optional AI annotation and highlight permissions start off. Private notes, your annotation replies and reading history are not included. Books stored only on a device are unavailable. You can connect another book later.
Review and withdraw access
On Web, open Settings → Data → Connect AI apps; on iOS, open Settings → Connect AI apps. Review the app, book and permissions, then revoke access when you are done. To change permissions or renew expired access, reconnect from the original app. Revocation blocks subsequent requests; it cannot erase content the app already saved. App names are self-reported.
Try a question
In the book I authorized, find a few passages about friendship. Give the book, chapter and links back to the original text.
The connection searches within one book and reads bounded pages of passages. It does not send an entire book at once. Private-note questions are not available through this OAuth connection.
Manual setup
Server address: https://leafhour.com/api/mcp
Technical reference and local hosts
Remote OAuth above and manual grants below are separate access paths. The technical reference lists permissions for manual/local hosts; a seven-day manual grant is not a remote OAuth session.
Remote OAuth only: identify the authorized book with reader_get_connection. Optional scopes expose reader_add_highlight, reader_add_annotation and reader_get_annotations. Each needs its own explicit permission; AI explanations never become the reader’s own words.
Choose what the agent may access.
| Permission | What it permits |
|---|---|
content | Original text and saved translations, book metadata, paginated chapters and search within that book. |
notes | Separately authorized personal comments and questions. |
activity | Saved reading position and recent reading sessions. |
comment:write | Save a comment explicitly supplied by the user, anchored to a passage. It does not authorize edits to the book. |
highlight:write | Save exact-text highlights. |
annotations | Read AI annotations, excluding private reader replies. |
annotation:write | Save AI evaluations labeled External Agent; no Leafhour model call. |
Start with content only. A grant expires after seven days and can be revoked earlier. A revoked grant fails subsequent service authorization; revocation cannot erase content already copied into your AI host.
Connect the adapter.
- Run Leafhour locally using the repository instructions, or use the hosted reading service. Import a book or choose a public sample in your reading room.
- Through a compatible client or the authenticated API, create a grant with a
bookIdand selectedscopesusingPOST /api/library/grants. The token is returned once; keep it in your AI host’s private configuration. - Read
GET /api/library/mcp-setupand use the configuration builder to create the host configuration. For a local source checkout, the adapter runs asnode server/mcp.mjs. The hosted setup returns the deployed source commit, and the generated configuration pins that immutable source package with explicit HTTPS access; missing deployment provenance fails closed. - Enable the MCP server in your compatible AI host, and pass the authorized book ID with tool requests. Revoke access with
POST /api/library/grants/{id}/revokewhen you are done.
The adapter uses these environment variables:
READER_SERVICE_URL=http://127.0.0.1:8330
READER_AGENT_TOKEN=<your book-scoped grant>
# For your configured HTTPS service only:
# READER_SERVICE_URL=https://leafhour.com
# READER_ALLOW_REMOTE=trueNever put a login password, session cookie, Supabase key or grant token into a public document or repository. An MCP grant is separate from your website login. Use your host’s secret storage where available.
Ask for a passage, then go deeper.
reader_get_manifest lists the book’s source metadata and chapter identities. reader_get_context returns a passage with its adjacent passages and stable anchors. reader_get_chapter returns at most 20 passages at a time and a continuation cursor. reader_search searches the authorized book and returns up to 20 anchored matches.
With additional scopes, reader_get_notes reads comments and questions, reader_get_reading_activity reads position and sessions, and reader_add_comment saves explicitly supplied user text. Agent access does not add time to your reading calendar.
For example: “In my authorized book, find passages about friendship, show the source chapter and paragraph anchors, and help me compare the author’s wording.” The agent needs the book ID; it cannot infer permission to search your entire private library.
Know the current limits.
The adapter also exposes audio tools, but hosted audio generation is not enabled. Local audio needs separate configuration and permissions; generating audio can incur provider charges. MCP does not currently upload books, automatically translate a whole library, or schedule notifications by itself.
The built-in reading assistant has its own read-only boundaries and is separate from this external MCP grant. See the privacy notice for hosted processing details.
For exact tool definitions and current service behavior, inspect the adapter source, the service routes and the scoped MCP reading notes. This guide describes the current implementation, not planned capabilities.