D
Druckling
Docs

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 an x-api-key header. The server doesn't offer OAuth sign-in; clients that can't send a header can connect through mcp-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.

KeyTools
Render onlyrender_document, get_document, list_documents
Full accessAll 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:

.mcp.json
{
  "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.

ToolWhat it doesInputsKey
render_documentRenders 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, languageRender only
get_documentGets a document: status, pages, a fresh signed URL, the error with its field if it failed, and its timeline.idRender only
list_documentsLists recent documents of the key's mode, newest first.optional status, template, limit (1–100, default 20), cursorRender only
list_templatesLists templates with slug, name, status, latest version, required fields and languages.optional search, status (draft, published)Full access
get_templateGets a template's data contract: JSON Schema, required fields, complete sample_data, languages and published versions.template; optional versionFull access
template_referenceExplains template strings, filters, variables, every block type and the edit operation formats.noneFull access
create_templateCreates a draft, blank or from a starter such as invoice-standard or packing-slip.name; optional starterFull access
get_template_draftReads the editable draft: the document JSON with block ids, its draft_revision, validation issues and an outline.templateFull access
edit_templateApplies 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_templateCompiles the draft with Typst without saving anything: page count, the pages each block lands on, errors and warnings per block.template; optional data, languageFull access
publish_templatePublishes the draft as a new immutable version, after checking for validation errors and a clean Typst render.template, base_revision; optional noteFull 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_document with data that matches the schema. For large documents, render_document with async: true, then get_document until the status is rendered or failed.
  • Build or change a template: template_reference once → 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_document or a preview_template has to finish within that time; render large documents with async: true.
  • Rate limit. Every MCP request, including the client's initialize and tools/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.

Next steps

On this page