About PolyDoc
PolyDoc is an MCP server for clients that need document rendering and invoice generation through the PolyDoc REST API. It converts HTML, URLs, or templates into PDFs and images, with optional PDF/A and PDF/UA verification.
Key features
- 01Convert HTML, URLs, or templates to PDF
- 02Capture PNG, JPEG, and WebP screenshots
- 03Generate Factur-X and ZUGFeRD e-invoices
- 04Target PDF/A and PDF/UA output
- 05Verify conformance with veraPDF
- 06Deliver files locally, to cloud storage, or webhooks
Use cases
- 01Create archival or accessible PDFs
- 02Capture a webpage as an image
- 03Generate structured-data e-invoices
MCP support
Exposes PolyDoc REST API conversion and invoice-generation operations as tools for MCP clients. Results can be saved locally or delivered to cloud storage or a webhook.
Configuration
Local server config is the same for every client. Copy it into your client’s MCP config file.
npx -y polydoc-mcpPOLYDOC_API_KEYSecretAPI key from dashboard.polydoc.tech.POLYDOC_SANDBOXDefault sandbox mode (watermarked, does not use production quota). A tool call can override per request. Defaults to false.POLYDOC_BASE_URLOverride for self-hosted or staging use. Defaults to https://api.polydoc.tech.POLYDOC_OUTPUT_DIRDirectory downloads are written to. Defaults to the OS temp dir + /polydoc.Local servers need a runtime on your machine (e.g. Node.js 18+). Config file locations differ by client; see your client’s docs.
Tools
4Saved tool list · updated 1d ago
| Parameter | Type | Required | Description |
|---|---|---|---|
| tag | string | No | Label for logging and analytics (max 30 chars). |
| url | string | No | Public URL to render. Provide exactly one of url, html, or templateId. |
| html | string | No | Inline HTML to render. Provide exactly one of url, html, or templateId. |
| sandbox | boolean | No | Override the server default for this call. Sandbox output is watermarked and rate-limited (about 5 requests/sec). |
| timeout | integer | No | Conversion timeout in milliseconds. |
| webhook | object | No | Webhook config, required when delivery is webhook. Shape: { url, async?, method?, headers?, retries? }. |
| advanced | object | No | Raw fields deep-merged into the request body for any API option not exposed here (e.g. pdf.watermark, render, request). |
| delivery | enum | No | download writes the file locally; cloudStorage uploads to a presigned URL; webhook posts the file to a URL.download | cloudStorage | webhook |
| filename | string | No | Output filename. Written under the configured output directory (basename only). |
| pdfOptions | object | No | Page layout and PDF conformance options. |
| pdfOptions.pdfa | object | No | Produce archivable PDF/A output. Best-effort unless verify is set. |
| pdfOptions.pdfa.level | enum | Yes | Archival target. Use "3b" unless a downstream system requires "2b" or "1b".1b | 2b | 3b |
| pdfOptions.pdfa.verify | boolean | No | Validate the output with veraPDF and fail the request (422) if it does not conform. |
| pdfOptions.pdfua | object | No | Produce accessible PDF/UA-1 (ISO 14289-1) output; forces a tagged render. Best-effort unless verify is set. |
| pdfOptions.pdfua.verify | boolean | No | Validate the output with veraPDF and fail the request (422) if it does not conform. |
| pdfOptions.scale | number | No | |
| pdfOptions.format | enum | No | A3 | A4 | A5 | Ledger | Legal | Letter | Tabloid |
| pdfOptions.tagged | boolean | No | Produce a tagged (accessible) PDF. |
| pdfOptions.outline | boolean | No | Generate PDF bookmarks from HTML headings. |
| pdfOptions.landscape | boolean | No | |
| pdfOptions.marginTop | string | No | e.g. "10mm". |
| pdfOptions.marginLeft | string | No | |
| pdfOptions.pageRanges | string | No | e.g. "1-5, 8, 11-13". |
| pdfOptions.marginRight | string | No | |
| pdfOptions.marginBottom | string | No | |
| pdfOptions.printBackground | boolean | No | |
| templateId | string | No | ID of a saved PolyDoc template. Provide exactly one of url, html, or templateId. |
| presignedUrl | string | No | Presigned PUT URL, required when delivery is cloudStorage. |
| returnBase64 | boolean | No | Also return the file as base64 in structured output (heavy; for clients without a filesystem). |
| templateData | object | No | Variables for the Liquid template (used with templateId). |
Details
From the project READMEpolydoc-mcp
An MCP server for PolyDoc, a REST API that converts HTML or URLs to PDF, captures screenshots, and generates EU-compliant e-invoices (Factur-X / ZUGFeRD hybrid PDF/A-3). It lets MCP clients (Claude Desktop, Claude Code, Cursor, and others) drive PolyDoc directly.
PDF output can target PDF/A (archival) and PDF/UA-1 (accessible, ISO 14289-1). Both are best-effort by default; set verify on either to validate the result with veraPDF and fail the request instead of returning a non-conforming file.
Tools
polydoc_html_to_pdf- HTML, URL, or saved template to PDF (layout, margins, page format, page ranges, bookmarks, tagged PDFs, PDF/A and PDF/UA conformance).polydoc_screenshot- HTML, URL, or template to PNG / JPEG / WebP, with viewport and device-pixel-ratio control. Returns an inline image preview when small enough.polydoc_generate_einvoice- Factur-X or ZUGFeRD hybrid PDF/A-3 from structured invoice data, profilesbasic,en16931andextended.polydoc_test_credentials- verify the configured API key with a minimal sandbox render (never draws production quota).
Content can come from a URL, an inline HTML string, or a saved template (with Liquid templateData). Downloads are written to a local directory and the file path is returned; you can also deliver to your cloud storage (presigned URL) or a webhook.
Installation
Requires Node.js >= 20.15. Published to npm, so clients can run it with npx:
npx -y polydoc-mcp
The server is configured entirely through environment variables (see below).
Configuration
| Variable | Required | Default | Description |
|---|---|---|---|
POLYDOC_API_KEY | yes | - | API key from dashboard.polydoc.tech. |
POLYDOC_SANDBOX | no | false | Default sandbox mode (watermarked, rate-limited). A tool call can override per request. |
POLYDOC_BASE_URL | no | https://api.polydoc.tech | Override for self-hosted or staging. |
POLYDOC_OUTPUT_DIR | no | OS temp dir + /polydoc | Where downloads are written. Output never escapes this folder. |
Client setup
Claude Desktop
Add to claude_desktop_config.json (Settings > Developer > Edit Config):
{
"mcpServers": {
"polydoc": {
"command": "npx",
"args": ["-y", "polydoc-mcp"],
"env": {
"POLYDOC_API_KEY": "your-key",
"POLYDOC_OUTPUT_DIR": "/Users/you/Documents/polydoc"
}
}
}
}
Claude Code
claude mcp add polydoc -e POLYDOC_API_KEY=your-key -- npx -y polydoc-mcp
Cursor
Add to ~/.cursor/mcp.json (or a project .cursor/mcp.json) using the same mcpServers block shown for Claude Desktop.
Output and delivery
- Download (default): the file is written under
POLYDOC_OUTPUT_DIRand the absolute path is returned with metadata (size, conversion id, credits). Screenshots also return an inline image block. PassreturnBase64: trueto also receive the bytes as base64 (heavy; for clients without a filesystem). - Cloud storage: set
delivery: "cloudStorage"andpresignedUrl. The upload URL is returned. - Webhook: set
delivery: "webhook"and awebhookobject ({ url, async?, method?, headers? }).
PDF/A and PDF/UA
polydoc_html_to_pdf takes two conformance targets inside pdfOptions:
{
"pdfOptions": {
"pdfa": { "level": "3b", "verify": true },
"pdfua": { "verify": true }
}
}
pdfa.level is 1b, 2b, or 3b. Setting pdfua forces a tagged render, so you do not need tagged as well.
Without verify, output is best-effort: it targets the standard but the request still succeeds if the toolchain cannot satisfy every machine-checkable rule. With verify: true, veraPDF validates the result and a non-conforming file fails with 422 instead of being returned. Use it when a downstream system will reject a bad file anyway.
Anything not in a tool's schema?
Every conversion tool has an advanced object that is deep-merged into the request body, so any API capability not surfaced as a typed field (for example pdf.watermark, pdf.encryption, render, request) is still reachable. See the field reference at docs.polydoc.tech.
Examples
Worked tool inputs for each angle live in examples/: a branded PDF from a template, a URL screenshot, and a ZUGFeRD / EN 16931 e-invoice.
Development
yarn installyarn build- compile todist/yarn lintyarn test- unit tests (request builder, output jail, tool handlers) and an in-memory MCP round-tripPOLYDOC_API_KEY=your-key yarn test:integration- live smoke tests against the sandboxyarn scrub:check- check for em-dashes in source and docs
Run the built server directly for a quick check:
POLYDOC_API_KEY=your-key node dist/index.js
License
Comments
New to MCP?
From what the protocol is to installing your first server, these answers cover most first questions.
An open protocol that defines how AI applications connect to external tools and data in a uniform way. Clients talk to the model; MCP servers provide tools, resources and prompt templates. They exchange standard messages, so one server can be reused by many clients.