Draftio
Start free

DRAFTIO MCP

Image generation inside Claude Code and Codex

Connect Draftio's 20 image models to your agent: one key, four tools, points-based billing. Once it is set up, generating does not leave the terminal.

Three steps

Five minutes, no code
  1. 01

    Copy an API key

    Open API keys in settings and create a key starting with dk_live_. MCP only needs the generate scope.

    Create a key
  2. 02

    Paste the JSON below

    Drop the whole block into your client's MCP config and replace dk_live_... with that key.

  3. 03

    Say one sentence to your agent

    Ask "generate a 3:4 product shot with draftio". It lists models, quotes the cost and submits.

Config to paste

The endpoint is POST https://www.draftio.cn/api/mcp (Streamable HTTP). Replace dk_live_... with your key; nothing else changes.

{
  "mcpServers": {
    "draftio": {
      "type": "streamable-http",
      "url": "https://www.draftio.cn/api/mcp",
      "headers": {
        "Authorization": "Bearer dk_live_..."
      }
    }
  }
}
Claude Code
Put it in .mcp.json at the project root.
Cursor
Settings → MCP → Add new MCP server, paste the same JSON.
Codex
Keep it under [mcp_servers.draftio] in ~/.codex/config.toml.

Four tools

These are the function names your agent sees. Describe the task; it picks the tool.
list_models

When the model id or resolution tiers are unclear: models, tiers and points per tier.

estimate

Quote before submitting: total points for model, tier and count. No task, no charge.

generate_image

The actual submit: returns a task id immediately, the image is not in this response. Use referenceImageUrls to edit.

get_generation

Poll by id; once deliveryStatus=ready, outputs holds links you can open directly.

Two worked examples

Quote first, then generate

You

Generate 4 product shots, 3:4 at 2K, with Seedream. Tell me the points first.

Agent

Quotes, submits, then polls until the images land.

estimate → generate_image → get_generation

Edit from a reference image

You

Swap the background to light grey, keep the product untouched: https://…/product.png

Agent

Passes the URL as a reference image and returns the new links.

generate_image({ referenceImageUrls: ["https://…/product.png"] })

Three things to know

  • 01

    Async: do not resubmit

    generate_image returns an id only; images usually land in 10–60 seconds. On a client timeout, poll get_generation — resubmitting charges again. A success status is not enough: wait for deliveryStatus to become ready before reading the image URL.

  • 02

    Billed in points on submit

    Points are charged on submit, so run estimate first. 1,000 points = ¥10; new accounts get 500 points valid for 30 days.

  • 03

    Outputs are HTTPS URLs

    outputs holds URLs you can open or download directly. No re-hosting, no base64 in the transcript.

Next