Agents & MCP

PDFEx speaks MCP — the open protocol that lets an agent use a service as a set of tools. Point your host at the endpoint below and it can design a template, look at a picture of the result, fix what is wrong, save it, and print real PDFs.

Agent-readyMCP

The one difference that matters

The REST API returns a pdf_base64 blob. The agent cannot look at it, so it has to trust the layout came out right.

preview_template over MCP returns the rendered page as an image — plus the measurements, the variables and any warnings.

That image is the whole point: a model cannot judge a layout from base64 bytes.

What you are connecting to

EndpointPOST https://pdfex.io/mcp
AuthAuthorization: Bearer pdfex_… — same key as REST
TransportStreamable HTTP, stateless
ResponsesPlain JSON (no long-lived SSE stream)
GET / DELETE405 by design — there is no session to hold open
Plan quotaOnly generating a PDF counts; designing and previewing do not
One key, both surfaces. REST calls and MCP tool calls are authenticated by the same credential path, so a single key covers both — and revoking it at API Keys switches both off at once.

What you can do: the nine tools

ToolKindWhat it does
get_capabilitiesreadEngines, field types, units, page sizes, default font and your plan limits. Call this first.
get_samplesreadList the sample catalogue, or fetch one sample in full (kind + engine together).
list_templatesreadSummaries of every template you can see. Never the schema.
get_templatereadOne template. detail: "summary" (default) omits the schema; "full" includes it.
validate_templatereadIs this template valid? Never renders, never saves.
preview_templatereadRenders and returns the page as an image you can look at. Nothing is saved.
create_templatewriteSaves a new template. Counts against your template limit.
update_templatewriteEdits a template, optionally guarded by expected_version.
delete_templatedestructivePermanently deletes. Requires confirm: true.

Six of the nine only read. A host that honours the MCP annotations can auto-approve those and still make delete_template ask first — so you can hand an agent your key without handing it the ability to quietly delete your work.

The order to do things in

  1. get_capabilities — read the contract once (engines, field types, units, page sizes, your limits).
  2. get_samples — adapt a working invoice or certificate instead of inventing JSON.
  3. Write the template — pdfme coordinates in millimetres, or plain HTML and CSS with {{variables}}.
  4. validate_template — cheap, catches malformed markup and unsupported field types.
  5. preview_template — look at the image. This is the step that catches what validation cannot.
  6. Fix and preview again until the page is right.
  7. create_template — only now. The first step that writes anything.
Steps 1–6 write nothing. An agent can iterate as long as it likes at no cost and with no risk to your data.

What you need to install

  1. An API key. Create one at API Keys — the same key your REST integration would use. A free tier exists.
  2. An MCP-capable host. Your agent is one of 18 documented hosts — Claude, Codex, Cursor, Hermes, OpenClaw, Pi and more. Each has an exact config block or one-line install command.
  3. A way to verify it worked. Saving a config proves nothing about reachability — run the host's probe, or simply call get_capabilities and check you get JSON back.

An agent with no key can still read all of this

Discovery does not require a credential. Fetch any of these before you have a key — they are public and cacheable:

Host verification honesty: of 18 hosts, 7 have their command checked against the tool itself or the vendor's docs (command verified / vendor-documented), and 11 are marked not yet verified. We would rather say so than publish a command nobody has run.