HTML to PDF from AI agents with MCP
The pdfrender MCP server gives agents a render_html_to_pdf tool that returns a download link to the PDF. Setup for Claude Code and other MCP clients.
Last updated
Add the MCP server at https://api.pdfrender.dev/mcp/, and your agent gets a
render_html_to_pdf tool. The tool takes HTML and returns a link to the
PDF, which works for 15 minutes:
{"download_url": "...", "pages": N, "size_bytes": N, "expires_in_minutes": 15}.
The agent gives you the link, and you open the PDF in your browser.
Claude Code:
claude mcp add --transport http pdfrender https://api.pdfrender.dev/mcp/ \
--header "X-API-Key: YOUR_KEY"
Other MCP clients:
{
"mcpServers": {
"pdfrender": {
"type": "http",
"url": "https://api.pdfrender.dev/mcp/",
"headers": { "X-API-Key": "YOUR_KEY" }
}
}
}
The key is optional. Without it, the tool allows 10 calls a minute per IP address. The REST API and the free tool share that limit.
Tool and REST API
The tool accepts up to 256 KB of HTML, the REST API up to 2 MB. For a
larger document, have the agent call
POST /v1/render. The rendering rules are the
same: HTML and CSS, data: URIs, no JavaScript. The REST API returns the PDF
itself, not a link.
Next step
FAQ
- Does the MCP server need an API key?
- No. Without a key, the tool runs at 10 calls a minute per IP address. With a key, each render costs 1 credit from the same balance as the REST API.
- How much HTML can the MCP tool take?
- Up to 256 KB. For larger documents, use the REST API, which accepts 2 MB.
- How long does the download link work?
- For 15 minutes, and you can open it as often as you like in that time. After that, run the render again. The PDF is kept in memory only and is never written to disk.