HTML to PDF from Claude and LLM agents (MCP)
pdfrender ships a built-in MCP server: agents call the render_html_to_pdf tool to produce real PDFs. Setup for Claude Code and any MCP client.
Last updated
| MCP endpoint | https://api.pdfrender.dev/mcp/ (HTTP transport) |
|---|---|
| Tool | render_html_to_pdf — returns { pdf_base64, pages }; input capped at 256 KB |
| Auth | X-API-Key header optional — anonymous works at the per-IP rate limit; same credits as REST |
A PDF is something no LLM can produce locally — pdfrender exposes its renderer as a Model Context Protocol server, so agents generate documents as a tool call. Add it to Claude Code:
claude mcp add --transport http pdfrender https://api.pdfrender.dev/mcp/ \
--header "X-API-Key: YOUR_KEY"
Or in a generic MCP client configuration:
{
"mcpServers": {
"pdfrender": {
"type": "http",
"url": "https://api.pdfrender.dev/mcp/",
"headers": { "X-API-Key": "YOUR_KEY" }
}
}
}
The agent then calls render_html_to_pdf(html) and receives
{"pdf_base64": "…", "pages": N} — decode the base64 and write the file.
Tool vs REST
The tool mirrors the REST policy — anonymous calls work at the
per-IP limit, a key raises it, one call costs one credit — but caps input at
256 KB (base64 megabytes inside tool results are hostile to agent context
windows). For bigger documents have the agent call
POST /v1/render instead. The same rendering
rules apply: HTML + CSS, data: URIs, no JavaScript.
Try it free
Try it free — 100 renders a month, no card — the free tier covers an agent's occasional document easily.
FAQ
- Can Claude generate a real PDF?
- Yes, through pdfrender's MCP server. Add https://api.pdfrender.dev/mcp/ over the HTTP transport and the agent gets a render_html_to_pdf tool returning { pdf_base64, pages }.
- Does the MCP server need an API key?
- No. The X-API-Key header is optional: without one the tool works at the anonymous per-IP rate limit. With one it draws on the same credits as REST.
- Why is the MCP input limit smaller than the REST limit?
- The MCP tool accepts 256 KB of HTML against REST's 2 MiB, because tool arguments travel inside the model's context window. For large documents, call the REST endpoint directly.