PDF API for AI agents
One paste into your agent. It installs Docweave, wires the tools, and only asks you for an API key when it needs one.
Setup prompt
Paste this into any agent that can edit config / run installs. Works across MCP clients — no client-specific steps for you.
Set up Docweave so I can generate and read PDFs from this agent.
1. Install and wire the Docweave MCP server (@docweave/mcp / npx -y @docweave/mcp) in this environment so the tools generate_pdf and read_pdf are available.
2. Confirm both tools show up.
3. If a Docweave API key is required for hosted calls, ask me for one (I can create a free key at https://docweave.dev/signup — 50 docs/month, no card). Do not invent a key.
4. Run a tiny smoke test: generate a simple one-page PDF (e.g. title "Docweave smoke test"), save it somewhere sensible, and tell me the path.
5. Briefly tell me how to ask for PDFs going forward.
Do the setup for me — I should only need to paste an API key if you ask.Or run the package yourself
Prefer a one-liner? npm package @docweave/mcp:
npx -y @docweave/mcpManual MCP config (optional)
Only if you'd rather edit JSON yourself. Same server for every client.
{
"mcpServers": {
"docweave": {
"command": "npx",
"args": ["-y", "@docweave/mcp"]
}
}
}{
"mcpServers": {
"docweave": {
"command": "npx",
"args": ["-y", "@docweave/mcp"]
}
}
}{
"mcpServers": {
"docweave": {
"command": "npx",
"args": ["-y", "@docweave/mcp"]
}
}
}Try it
After setup, ask something like this:
Generate a one-page PDF titled "Hello from Docweave" with a short paragraph, save it, and tell me where it is.
Also: read that PDF back and summarize it in one sentence.What your agent gets
generate_pdf
- HTML → PDF
- Markdown → PDF
- URL → PDF
- Template + data → PDF
- Watermarks, headers, footers, fonts
read_pdf
- PDF → text / markdown
- Page count + metadata
- OCR detection for scans
- File path or URL
No MCP? REST API
Get a key from your dashboard, then:
curl https://docweave.dev/api/v1/pdf \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-H "Accept: application/pdf" \
-d '{"source": {"type": "markdown", "markdown": "# Report\n\nContent"}}' \
--output report.pdfFAQ
How do I let my AI agent generate a PDF?
Copy the setup prompt on this page into your agent. It installs the Docweave MCP server (@docweave/mcp), wires generate_pdf and read_pdf, and only asks you for an API key if hosted calls need one.
Do I need an API key?
Your agent will ask if it needs one. Create a free key at docweave.dev/signup (50 documents/month, no card). Don’t invent keys — paste the real one when asked.
Is there a free PDF MCP server?
Yes. @docweave/mcp is open source on npm. Run it with npx -y @docweave/mcp. Upgrade to the hosted API when you need scale, metering, and stored templates.
What can the generate_pdf tool render?
HTML, Markdown, a public URL, or a template with JSON data — plus options for page format, margins, headers/footers, watermarks, and Google Fonts.
How is this different from a generic HTML-to-PDF API?
It’s MCP-native and agent-first: one tool call instead of HTTP boilerplate, per-document pricing, and idempotency so an agent never double-generates the same document.
What if my agent framework doesn't support MCP?
Use the REST API — POST https://docweave.dev/api/v1/pdf with your API key. Add Accept: application/pdf for raw bytes.
Need an API key for hosted renders? Free tier includes 50 documents/month.