MCP server
Connect Claude, Cursor, VS Code, n8n and other MCP clients to Druckling so AI agents can render documents and build templates with your API key.
Druckling hosts a Model Context Protocol server, so AI agents can work with your templates and documents directly. An agent can look up a template's data contract, render a PDF and hand you the link, or build a new template from a starter, preview it with Typst and publish it, using the same validated edit operations as the editor.
There's nothing to install or run: point your MCP client at the endpoint and authenticate with an API key.
Endpoint
https://druckling-nine.vercel.app/api/mcp- Transport: Streamable HTTP.
- Authentication: a Druckling API key, as
Authorization: Bearer dr_test_…or in anx-api-keyheader. The server doesn't offer OAuth sign-in; clients that can't send a header can connect throughmcp-remote(see Claude Desktop). - Per request: every request is authenticated with the key it carries, so revoking a key in Developers › API keys cuts the agent off right away.
Settings › AI tools (MCP) in the dashboard shows the endpoint and ready-to-paste snippets for the clients below.
Choose an API key
The key decides what the agent can do. Tools the key isn't allowed to use aren't listed at all, so the agent never plans around them.
| Key | Tools |
|---|---|
| Render only | render_document, get_document, list_documents |
| Full access | All of the above, plus list_templates, get_template, template_reference, create_template, get_template_draft, edit_template, preview_template, publish_template |
Start with a test key (dr_test_…): test renders are free and don't count toward your quota. Switch to a live key when the agent's output looks right. Create keys in Developers › API keys; see Authentication and Test mode.
A render-only key can't list or read templates, so tell the agent which template slug to use and what data it takes.
Templates are shared between modes
Test mode separates documents and usage, not templates. A full-access test key can edit and publish the same templates your live renders use. Give an agent a render-only key unless you want it to change templates.
Set up your client
Replace dr_test_… with your own key.
Run this in a terminal. Add --scope user to use it in every project.
claude mcp add --transport http druckling https://druckling-nine.vercel.app/api/mcp --header "Authorization: Bearer dr_test_…"To share the server with your team, commit a .mcp.json instead. Each person sets DRUCKLING_API_KEY in their environment:
{
"mcpServers": {
"druckling": {
"type": "http",
"url": "https://druckling-nine.vercel.app/api/mcp",
"headers": { "Authorization": "Bearer ${DRUCKLING_API_KEY}" }
}
}
}Tools
The server exposes tools only, no resources or prompts. When a client connects, the server also sends instructions that tell the agent the key's mode and access level and the workflow below.
| Tool | What it does | Inputs | Key |
|---|---|---|---|
render_document | Renders a published template and returns the document id, status, page count and a time-limited signed download URL. E-invoice templates produce their Factur-X PDF or XRechnung or Peppol XML. | template, data; optional version, filename, format (pdf, png, xml), async, language | Render only |
get_document | Gets a document: status, pages, a fresh signed URL, the error with its field if it failed, and its timeline. | id | Render only |
list_documents | Lists recent documents of the key's mode, newest first. | optional status, template, limit (1–100, default 20), cursor | Render only |
list_templates | Lists templates with slug, name, status, latest version, required fields and languages. | optional search, status (draft, published) | Full access |
get_template | Gets a template's data contract: JSON Schema, required fields, complete sample_data, languages and published versions. | template; optional version | Full access |
template_reference | Explains template strings, filters, variables, every block type and the edit operation formats. | none | Full access |
create_template | Creates a draft, blank or from a starter such as invoice-standard or packing-slip. | name; optional starter | Full access |
get_template_draft | Reads the editable draft: the document JSON with block ids, its draft_revision, validation issues and an outline. | template | Full access |
edit_template | Applies edit operations to the draft, in order and atomically: one invalid op rejects the whole call. | template, base_revision, ops (1–200) | Full access |
preview_template | Compiles the draft with Typst without saving anything: page count, the pages each block lands on, errors and warnings per block. | template; optional data, language | Full access |
publish_template | Publishes the draft as a new immutable version, after checking for validation errors and a clean Typst render. | template, base_revision; optional note | Full access |
Tools that only read are annotated as read-only, and publish_template as destructive, so clients that support annotations can auto-approve reads and ask before publishing.
How agents use them
- Render a document:
list_templates→get_template→render_documentwithdatathat matches the schema. For large documents,render_documentwithasync: true, thenget_documentuntil the status isrenderedorfailed. - Build or change a template:
template_referenceonce →create_template→get_template_draft→edit_template→preview_template→publish_template→render_document.
Drafts never affect renders until they're published. Every edit_template and publish_template call passes the draft_revision it last read as base_revision; if someone changed the draft in the meantime, the call fails with stale_revision and the agent re-reads the draft.
Failed calls come back as tool errors the agent can act on: the message, the error code and field, every offending field (for example each schema mismatch or broken e-invoice rule), and a hint for the next step. See Errors for the codes.
Example prompts
- "Which templates do I have, and what data does invoice-standard need?"
- "Render invoice-standard for Northwind Ltd., 12 Pier St, Leeds: invoice INV-2042, due November 22, 12 hours of design system audit at 180 and one brand workshop at 640, plus 8% tax. Send me the link."
- "Render the invoice again in German."
- "Which documents failed today, and why?"
- "Create a packing slip from the packing-slip starter with our return address in the footer. Preview it with 40 items to check the page breaks, then publish it."
Limits
- 60 seconds per request. A synchronous
render_documentor apreview_templatehas to finish within that time; render large documents withasync: true. - Rate limit. Every MCP request, including the client's
initializeandtools/list, is authenticated with the key and counts toward its rate limit of 120 requests a minute, shared with/v1. - Quota. Live renders count toward your plan's monthly documents; test renders don't. See Plans and limits.
Tool calls appear in Developers › Logs next to your API requests, with method MCP, the endpoint /api/mcp/<tool> and an HTTP-style status (for example 422 for a payload that doesn't match the schema).
Security
- Use a test key while trying it out, and a render-only key for agents that only need to render: they can't see or change templates.
- Keep keys out of committed files with environment variables or input prompts, as in the snippets above.
- Signed URLs are links anyone can open until they expire. They end up in the agent's conversation, so treat transcripts accordingly. See Documents.
- Your MCP client's AI provider sees the tool calls, including the payload data you render. Druckling's EU-only, zero-retention inference applies to Druck, the AI assistant built into Druckling, not to the client you connect.
- Revoke a key in Developers › API keys to cut an agent off. The next request fails with
401.