Automation

DraftToDone CLI and MCP server: generate books from your terminal or agent

Reference for the DraftToDone command-line tool and Model Context Protocol server: install, authenticate, create a book, poll progress and download all four files — from a terminal or an AI agent.

Updated 2026-07-1311 min read

DraftToDone CLI and MCP server:

Automation

If you would rather live in a terminal than a dashboard — or you are an AI agent with a shell — DraftToDone ships a command-line tool and a Model Context Protocol server that expose the whole book pipeline. Same account, same credits, same four deliverables (Word manuscript, interior PDF, cover image, KDP cover PDF); no browser required except to pay.

This is a hands-on reference. It covers installing and authenticating the CLI, the command set, the equivalent MCP tools, and the exact loop from niche to downloaded files. Copy the commands, adjust the niche, and you have a repeatable generator you can script or hand to an agent.

Everything here talks to the same backend as the web app, so nothing you do in the terminal is second-class. The CLI is a thin client over the MCP server, and the MCP server is a thin layer over the same generation pipeline that powers the dashboard.

Install and authenticate the CLI

The fastest path is npx, which needs only Node 18 or newer: run 'npx drafttodone help' to see every command. If you would rather not use npm at all, download the single file directly — 'curl -fsSL https://app.drafttodone.io/cli.mjs -o drafttodone.mjs' — and run it with 'node drafttodone.mjs help'. There are zero dependencies either way.

Authenticate once: 'npx drafttodone signup --email [email protected] --password "min8chars"' creates the account and stores a session token in ~/.drafttodone.json. Returning users run 'login' with the same flags. You can also pass credentials through the DRAFTTODONE_EMAIL and DRAFTTODONE_PASSWORD environment variables, which is handy in a CI job or an agent's sandbox.

Every command accepts --json, which swaps the human-readable output for a machine-parseable object. Agents should always pass --json; humans can leave it off for readable tables. The stored token can be overridden per-invocation with the DRAFTTODONE_TOKEN environment variable if you juggle multiple accounts.

  • npx drafttodone help — needs Node 18+, zero dependencies.
  • No-npm option: curl the single cli.mjs file and run it with node.
  • signup/login store a session token in ~/.drafttodone.json.
  • --json for machine output; env vars for credentials and token.

The command set

The core commands map one-to-one onto the workflow. 'status' prints your credits, subscription and share-reward eligibility. 'checkout --plan weekly' (or yearly) prints a Stripe URL you open in a browser to pay. 'create --niche "..." --lang en' starts a book and returns its id; add --random to let DraftToDone pick a surprise niche instead.

'books' lists your books with status and a progress counter. 'wait <book-id>' blocks and polls until that book completes, printing status as it goes — ideal in a script that should not proceed until the files exist. 'download <book-id> --out ./dir' fetches all four deliverables into a folder.

One extra command closes the loop on the free credit: 'share-claim <x-post-url>' redeems a public X post that mentions drafttodone.io for one bonus credit, once a week, after you have a completed book. Run 'help' any time for the full list with options.

  • status, checkout --plan, create --niche/--random/--lang.
  • books (list + progress), wait <id> (blocking poll), download <id> --out.
  • share-claim <x-post-url> for the weekly free credit.
  • help lists every command and flag.

The MCP server and its tools

For agent frameworks, the same functionality lives at the MCP endpoint app.drafttodone.io/mcp — a stateless, streamable-HTTP server with no OAuth. In Claude Code, add it with 'claude mcp add --transport http drafttodone https://app.drafttodone.io/mcp'. In Hermes Agent, OpenClaw or any MCP host, register a remote server pointing at that URL; tools are discovered automatically.

The eight tools mirror the CLI: sign_up and log_in return a session_token that every other tool takes as an argument; get_status, get_checkout_url, create_book, list_books, get_download_links and claim_share_reward do exactly what their names say. A discovery manifest sits at app.drafttodone.io/.well-known/mcp.json for agents that probe the well-known path.

Because the CLI and MCP server share one backend, you can develop against the CLI interactively and deploy the identical flow through MCP in production, or vice versa. There is no behavioural drift to debug between them.

  • Endpoint: app.drafttodone.io/mcp (streamable HTTP, stateless, no OAuth).
  • Claude Code: claude mcp add --transport http drafttodone <url>.
  • Eight tools; sign_up/log_in issue the session_token others require.
  • Manifest at /.well-known/mcp.json; behaviour identical to the CLI.

The full flow, start to finish

A complete terminal session reads like this: 'npx drafttodone signup --email [email protected] --password "min8chars"', then 'npx drafttodone checkout --plan weekly' and pay the printed URL in a browser. Confirm credits landed with 'npx drafttodone status'.

Then generate and collect: 'npx drafttodone create --niche "beginner yoga for seniors" --lang en' returns a book id; 'npx drafttodone wait <book-id>' blocks for the roughly 30 to 45 minutes of server-side generation; 'npx drafttodone download <book-id> --out ./my-book' saves the manuscript, interior PDF, cover image and KDP cover PDF.

From there it is your turn: review the manuscript, adjust anything you want, then upload to Amazon KDP with the AI-content disclosure. The CLI and MCP server get you to production-ready files fast; the editorial and publishing decisions stay yours, which is exactly where they belong.

  • signup → checkout (pay in browser) → status to confirm credits.
  • create --niche → wait <id> → download <id> --out ./dir.
  • Four files land: manuscript, interior PDF, cover, KDP cover PDF.
  • Review and publish on KDP with the AI disclosure — your call.

Operational checklist

  • Node 18+ available, or the cli.mjs file downloaded.
  • Authenticated with signup/login; token stored or set via env var.
  • Credits confirmed with status after paying the checkout URL.
  • Book created with a specific niche and explicit language.
  • wait used to block until the book completes (4/4).
  • All four files downloaded to a known folder.
  • Manuscript reviewed before uploading to KDP with the AI disclosure.

FAQ

Do I need npm to use the DraftToDone CLI?

No. 'npx drafttodone' is the easiest route if you have Node, but you can also download the single file with 'curl -fsSL https://app.drafttodone.io/cli.mjs -o drafttodone.mjs' and run it with 'node drafttodone.mjs'. It has zero dependencies and needs only Node 18 or newer.

What is the difference between the CLI and the MCP server?

They are two front ends over the same backend. The CLI is for terminals and shells (with a --json mode for scripts); the MCP server at app.drafttodone.io/mcp is for agent frameworks that speak Model Context Protocol. Behaviour, rules and pricing are identical, so there is no drift between them.

How do I add the MCP server to Claude Code?

Run 'claude mcp add --transport http drafttodone https://app.drafttodone.io/mcp'. For Hermes Agent, OpenClaw or another MCP host, register a remote streamable-HTTP server pointing at the same URL; the tools are discovered automatically at startup.

Can I script book generation in CI?

Yes. Pass credentials via DRAFTTODONE_EMAIL and DRAFTTODONE_PASSWORD, add --json to every command for parseable output, and use 'wait <book-id>' to block until a book completes before downloading. Payment still needs a human once to fund the account.

Where is my session token stored?

In ~/.drafttodone.json after signup or login. You can override it per run with the DRAFTTODONE_TOKEN environment variable, which is useful when an agent or CI job manages the token itself rather than reading the file.

English

Turn your publishing workflow into a system.

DraftToDone helps transform ideas into manuscript, cover assets and optimized metadata from one controlled pipeline.

Open the app