# MCP server

Endpoint: `POST https://print.toongen.app/mcp` — stateless streamable-HTTP JSON-RPC 2.0. No API key.

Add to Claude Code:

```bash
claude mcp add --transport http massprint https://print.toongen.app/mcp
```

## Tools

### get_catalog
No arguments. Returns SKUs, formats, prices (INR paise + display), page limits, trim sizes, shipping coverage, and the workflow summary.

### create_upload
No arguments. Returns:
```json
{ "upload_id": "upl_...", "put_url": "https://print.toongen.app/v1/uploads/upl_.../content?exp=...&sig=...", "expires_at": "...", "max_bytes": 104857600 }
```
PUT the raw PDF bytes to `put_url`. The PUT response carries the validation report; a 422 means the PDF has blocking issues (each with a `resolution`).

### validate_pdf
`{ "upload_id": "upl_..." }` → the stored validation report:
```json
{ "printable": true, "page_count": 32, "trim": { "width_mm": 203, "height_mm": 203, "name": "square-8in" }, "errors": [], "warnings": [{ "code": "no_bleed", "message": "...", "resolution": "..." }] }
```

### create_order
```json
{
  "upload_id": "upl_...",
  "format": "hardcover",
  "copies": 1,
  "email": "buyer@example.com",
  "address": { "name": "...", "line1": "...", "city": "Chennai", "state": "TN", "pincode": "600020", "phone": "+91 98765 43210" }
}
```
Returns `{ order, order_token, ... }` where `order.payment_url` is the Razorpay link.
**Save `order_token` immediately — it is shown only once.**

### get_order
`{ "order_id": "ord_...", "order_token": "opt_..." }` → current status, tracking once shipped, and `payment_url` again while unpaid.

### cancel_order
Same arguments. Works only while `awaiting_payment`.

## Error handling

Tool failures return `isError: true` with a JSON body: `{ "error": "<code>", "message": "...", "resolution": "how to fix it" }`. Follow the resolution; the same call retried after fixing the input succeeds. See [errors](https://print.toongen.app/docs/errors).
