leanpub-mcp
Provides tools for interacting with the Leanpub author API, enabling management of books, bundles, courses, and tracks, including previewing, publishing, unpublishing, retiring, closing, checking royalties and purchases, managing coupons, reading reader emails, registering interest, and polling job status.
Click on "Deploy 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., "@leanpub-mcp preview my book and tell me when it's ready"
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.
leanpub-mcp
An MCP server for the Leanpub author API — preview, publish, royalties, coupons, readers.
Why this exists
Leanpub documents an official hosted MCP server at
https://leanpub.com/api/mcp. As of 2026-09-14 that endpoint 404s on every
method (GET/POST/HEAD/OPTIONS), despite the docs describing it as live
("very early beta"). This is a local stdio server that talks to the same
documented REST API directly, so preview/publish workflows aren't blocked
on Leanpub finishing their rollout. Drop it once leanpub.com/api/mcp
actually answers.
Related MCP server: deliverable-mcp
Setup
npm installAPI key
Requires a Pro plan API key from https://leanpub.com/account/api_key. Resolved fresh on every tool call (never cached), checked in this order:
LEANPUB_API_KEYenv var (literal key)LEANPUB_API_KEY_FILEenv var (path to a file containing the key).leanpub-api-keyin the current working directory~/.config/leanpub/api_key
Writing the key to a file takes effect on the very next tool call — no server restart needed.
Register with Claude Code
As a personal, cross-project tool (recommended — keeps the machine-specific
path out of any repo's committed .mcp.json):
claude mcp add --scope user --transport stdio leanpub -- node /absolute/path/to/leanpub-mcp/bin/leanpub-mcp.jsOr add to a specific project's .mcp.json:
{
"mcpServers": {
"leanpub": {
"command": "node",
"args": ["/absolute/path/to/leanpub-mcp/bin/leanpub-mcp.js"]
}
}
}
### MCP client timeout for `wait_for_job`
`wait_for_job` polls internally for up to `timeoutSeconds` (default 120),
but that's a single MCP tool call the whole time -- most MCP clients kill a
tool call after their own default request timeout (often 30s) regardless of
what the server is doing internally, since this server sends no progress
notifications. Confirmed live: a 180s `wait_for_job` call was killed at 30s
with `Request timeout after 30000ms` even though the underlying Leanpub job
finished fine.
Fix: set a per-server timeout in your MCP client config, comfortably above
whatever `timeoutSeconds` you pass. In Claude Code / OMP's `.mcp.json`:
```json
{
"mcpServers": {
"leanpub": {
"command": "node",
"args": ["/absolute/path/to/leanpub-mcp/bin/leanpub-mcp.js"],
"timeout": 300000
}
}
}Without that, just poll get_job_status directly in a loop (5s between
calls, per Leanpub's own rate-limit guidance) instead of calling
wait_for_job.
Tools
Tool | Leanpub endpoint |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| polls |
|
|
|
|
|
|
|
|
|
|
|
|
Not implemented: file upload to upload-mode books, XML response formats
(JSON only). Add them if you need them — src/client.js follows one
pattern per resource.
Typical workflow
Preview the book, then tell me when it's ready.
Calls preview_book, then wait_for_job, then reports the pdf_preview_url
/ epub_preview_url from a follow-up get_book call.
Testing
npm test # unit tests for URL building, error parsing, key resolutionUnit tests don't hit the network. To confirm the server is wired to the
real API, run verify_api_key with a real (or intentionally wrong) key and
check you get back a 200 with your username, or a clean 401.
Available Tools
28 toolscheck_book_existsB
Check whether a book slug exists and you are an author of it.
Inputs: slug (required).
close_bookC
Close a book completely — hidden from the store (primary author only).
Inputs: slug (required).
create_bookC
Create a new Leanpub book (Browser, GitHub, or Upload mode).
Inputs: slug (required), title (required), syncMode, githubPath, +4 more.
create_bundleC
Create a new Leanpub bundle.
Inputs: slug (required), title (required), publisherId.
create_couponC
Create a new coupon for a book.
Inputs: slug (required), startDate (required), couponCode (required), discountedPrice (required), +4 more.
create_courseC
Create a new Leanpub course.
Inputs: slug (required), title (required), languageId (required), syncMode, +4 more.
create_trackC
Create a new Leanpub track (curated collection of courses).
Inputs: slug (required), title (required), publisherId.
get_bookB
Get a book's summary: title, word/page counts, sales, and preview/published download URLs.
Inputs: slug (required).
get_book_reader_emailsB
Get emails of readers of a specific book who opted to share them.
Inputs: slug (required).
get_couponC
Get details for a specific coupon.
Inputs: slug (required), couponCode (required).
get_individual_purchasesC
Get a paginated list of individual purchases for a book.
Inputs: slug (required), page, email.
get_interested_readersC
List readers who registered interest and opted to share their email.
Inputs: slug (required).
get_job_statusC
Check the status of a running preview/publish job. Returns {} when no job is running.
Inputs: slug (required).
get_royaltiesC
Get a book's sales and royalties summary.
Inputs: slug (required).
get_user_reader_emailsA
Get emails of readers who opted to share them with you, across all your books/courses.
Inputs: username (required), type.
list_couponsB
List all coupons for a book.
Inputs: slug (required).
preview_bookA
Start a full preview generation (PDF + EPUB) for a book. Returns immediately; poll get_job_status or use wait_for_job to know when it's done.
Inputs: slug (required).
preview_courseB
Start a preview generation for a course (self-published, organization, or university).
Inputs: slug (required), universitySlug, organizationSlug.
preview_singleA
Preview a single chapter from raw Markdown content without touching Subset.txt. Saved as {slug}-single-file.pdf.
Inputs: slug (required), markdown (required).
preview_subsetC
Generate a faster PDF-only preview using Subset.txt.
Inputs: slug (required).
publish_bookB
Publish a book, making the latest version available to readers.
Inputs: slug (required), emailReaders, releaseNotes.
publish_courseC
Publish a course (self-published, organization, or university).
Inputs: slug (required), emailReaders, releaseNotes, universitySlug, +2 more.
register_interestA
Register a reader's interest in an unpublished book so they're notified on publish.
Inputs: name (required), slug (required), email (required), shareEmailWithAuthor.
retire_bookA
Retire a published book — no new purchases, existing readers keep access (primary author only).
Inputs: slug (required).
unpublish_bookB
Unpublish a book (primary author only).
Inputs: slug (required).
update_couponB
Update an existing coupon (suspend/resume, change uses, etc). Only include fields to change.
Inputs: slug (required), couponCode (required), note, endDate, +2 more.
verify_api_keyA
Verify the configured Leanpub API key and return the authenticated user.
Inputs: no named parameters.
wait_for_jobA
Poll get_job_status every 5s (configurable) until the job completes or the timeout elapses. Use right after preview_book/publish_book.
Inputs: slug (required), timeoutSeconds, intervalSeconds.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 28 tools
Most tools target distinct actions (get, create, publish, preview) on specific entities. However, the three preview tools (preview_book, preview_subset, preview_single) and the three reader-email tools are closely related, though descriptions sufficiently clarify their different use cases.
Tool names follow a consistent snake_case verb_noun pattern throughout, such as get_book, create_coupon, publish_course, and wait_for_job. Minor compound names like check_book_exists still fit the established convention without introducing style inconsistencies.
With 28 tools, the set exceeds the 25-tool threshold for 'too many.' While the scope spans multiple entity types (books, courses, bundles, coupons, readers, jobs), the count feels heavy, especially since several entities only have creation tools (e.g., create_bundle, create_track), inflating the surface without corresponding coverage.
The tool surface has significant gaps. Books have create/publish/preview/status transitions, but there is no list_books or update_book. Bundles and tracks only have create operations—no get, update, or delete—and courses lack get/update/delete as well. This incompleteness will force agents to rely on out-of-band knowledge or fail when managing those entities.
Maintenance
Related MCP Connectors
Work with books, sources, series and publication jobs through the existing publishing workflow. Setup: In a remote MCP client that supports Streamable HTTP and OAuth, add https://platform.samuelz.com/api/v1/mcp/operator?toolset=books. Sign in to Samuelz and select your authorized workspace. An active workspace membership and the relevant module permissions are required. Review the requested permissions before authorizing. Existing approval requirements continue to apply.
Manage Pipefork API projects, drafts, connections, secrets, and deployments through MCP.
Gutendex MCP — wraps Gutendex API for Project Gutenberg books (free, no auth)
MCP server for Lemon Squeezy — stores, products, orders, subscriptions, license keys.
Related MCP Servers
- AlicenseAqualityBmaintenanceZero-dependency stdio bridge to Moltline Studio's fleet of 14 hosted MCP servers covering code review, time operations, data transforms, business ops, education, research, outreach and more. Free tier requires no registration; premium tools unlock with a license. Independently audited, MCPize Verified A.10MIT
- AlicenseBqualityCmaintenanceEnables MCP clients to render Markdown to HTML, estimate page counts, verify document delivery constraints, and atomically ship documents through a zero-dependency JSON-RPC stdio server.4MIT
- AlicenseAqualityBmaintenanceEnables MCP clients to connect to a WordPress site with a scoped API key and manage posts, pages, custom post types, taxonomies, comments, media, approved settings, plugins, and themes. It runs locally over stdio and requires the companion WordPress plugin to be installed and activated.42MIT
- AlicenseAqualityCmaintenanceConnects MCP clients to a self-hosted photo library through its REST API, exposing assets, albums, people, search, and optional administrative toolsets with read-only defaults and confirm-gated writes. It supports stdio and localhost Streamable HTTP transports.576 npmMIT