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.
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
What you can do: the nine tools
| Tool | Kind | What it does |
|---|---|---|
| get_capabilities | read | Engines, field types, units, page sizes, default font and your plan limits. Call this first. |
| get_samples | read | List the sample catalogue, or fetch one sample in full (kind + engine together). |
| list_templates | read | Summaries of every template you can see. Never the schema. |
| get_template | read | One template. detail: "summary" (default) omits the schema; "full" includes it. |
| validate_template | read | Is this template valid? Never renders, never saves. |
| preview_template | read | Renders and returns the page as an image you can look at. Nothing is saved. |
| create_template | write | Saves a new template. Counts against your template limit. |
| update_template | write | Edits a template, optionally guarded by expected_version. |
| delete_template | destructive | Permanently 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
get_capabilities— read the contract once (engines, field types, units, page sizes, your limits).get_samples— adapt a working invoice or certificate instead of inventing JSON.- Write the template — pdfme coordinates in millimetres, or plain HTML and CSS with
{{variables}}. validate_template— cheap, catches malformed markup and unsupported field types.preview_template— look at the image. This is the step that catches what validation cannot.- Fix and preview again until the page is right.
create_template— only now. The first step that writes anything.
What you need to install
- An API key. Create one at API Keys — the same key your REST integration would use. A free tier exists.
- 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.
- A way to verify it worked. Saving a config proves nothing about reachability — run the host's probe, or simply call
get_capabilitiesand 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:
- /llms.txtShort index
- /llms-full.txtThe complete guide, one fetch
- /api/schemaThe authoring contract as JSON
- /.well-known/mcp.jsonMCP server descriptor
- /.well-known/mcp-hosts.jsonHost install matrix, machine-readable
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.