AI clients
MCP server reference
Run LibreLeaf locally to search for books and resolve lawful access routes from an MCP client.
Run on your computer
Clone the LibreLeaf GitHub repository and run npm ci in the checkout. Use Node.js 22.13 or later. In a client that supports local MCP servers, choose stdio and configure the command below with the absolute path to your checkout.
The client launches LibreLeaf and the process queries catalogues directly from your machine.
node --experimental-strip-types /absolute/path/to/libreleaf/mcp/stdio.tsHost your own Streamable HTTP endpoint
Run the command below in your own checkout. Connect a local HTTP client to http://127.0.0.1:8787/mcp. The process queries the catalogues from your host.
To serve remote clients, follow the reverse proxy and MCP_ORIGIN instructions in docs/MCP.md on GitHub. A self-hosted endpoint does not guarantee acceptance into a client’s public directory.
npm run mcp:hostTools
- search(query) — return citation-ready stable work IDs, titles and canonical LibreLeaf URLs.
- fetch(id) — refresh a search result and return its complete resolver record, provenance, routes and rights context.
- search_books(query, search_by?, limit?, region?) — search six catalogues with a result limit from 1 to 20.
- resolve_access(title, author?, region?) — select one canonical match and return every validated attached offer plus an auditable ranking explanation.
Selection and result rules
Use search followed by fetch when a client needs citation-compatible retrieval. Use search_books for bounded catalogue exploration. Use resolve_access when the title is known and the useful answer is one work with all of its lawful routes.
The server searches Project Gutenberg, Open Library, Wikisource, DOAB, the Library of Congress and LibriVox. It preserves download, read, listen, borrow and preview labels. GB, US and GLOBAL change source-rights context only; the model must not convert that metadata into a universal copyright claim.
Test a connection
Use MCP Inspector to list tools and make a controlled call before connecting a production workflow. Test direct, indirect and negative prompts, including requests that must not turn a preview into a download or describe a US public-domain assessment as worldwide.
The repository contains protocol tests and submission cases. A public ChatGPT plugin submission is a separate OpenAI review process requiring developer or business access, listing information, policy URLs, test cases and domain verification when requested.
npx netlify dev
npx @modelcontextprotocol/inspector
npm run test:mcp