The PDF API for AI agents
Agents are great at producing content and terrible at turning it into a file your customer can actually open. Docweave gives any agent a first-class generate_pdf tool over MCP — HTML, a URL, or a template + JSON in, a real PDF out.
1. Add the MCP server
Drop this into your MCP client config (Claude Desktop, Cursor, etc.):
{
"mcpServers": {
"docweave-pdf": {
"command": "npx",
"args": ["-y", "@docweave/mcp"]
}
}
}2. Let the agent call it
// Your agent calls the tool — no HTTP plumbing needed:
generate_pdf({
source: {
type: "template",
template: "<h1>Report — {{ month }}</h1><p>{{ summary }}</p>",
data: { month: "July 2026", summary: "Revenue up 18%." }
},
outputPath: "/tmp/report.pdf"
})FAQ
How do I let my AI agent generate a PDF?
Add the Docweave MCP server to your agent (Claude, Cursor, or any MCP client). It exposes a generate_pdf tool that accepts HTML, a URL, or a template + JSON and returns a real PDF file. No REST plumbing required.
Is there a free PDF MCP server?
Yes. The Docweave PDF MCP server is open source — run it with `npx @docweave/mcp`. It renders locally with Chromium. Upgrade to the hosted API when you need scale, metering, and stored templates.
What can the generate_pdf tool render?
Three source types: raw HTML, a public URL (rendered as a page), or a stored/inline template with JSON data bound into it. You control page format, margins, orientation, and headers/footers.
How is this different from a generic HTML-to-PDF API?
It is MCP-native and agent-first: one tool call instead of HTTP boilerplate, transparent per-document pricing instead of a per-page tax, and built-in idempotency so an agent never double-generates the same document.
Ready for production? The hosted API adds metering, stored templates, and higher limits.
Get an API key