# PDFgen > PDFgen generates PDFs from HTML, Markdown, saved templates, or plain-English prompts. Use it from AI agents through the PDFgen MCP server (tool: `generate_pdf`) or from code through the REST API (`POST https://pdfgen.com/api/v1/generate`). Every request needs an API key (`pdfg_live_...`); the free plan includes 30 PDFs a month. To give an agent a PDF tool, add this to its MCP client config: ```json { "mcpServers": { "pdfgen": { "command": "npx", "args": ["-y", "@pdfgen/mcp"], "env": { "PDFGEN_API_KEY": "pdfg_live_xxx" } } } } ``` ## Docs - [generate_pdf tool reference](https://pdfgen.com/docs/generate_pdf): parameters, examples, result format, and errors for the MCP tool - [REST API reference](https://pdfgen.com/docs): authentication, `/api/v1/generate`, templates, account, logs, Handlebars templating, page formats - [MCP server](https://pdfgen.com/mcp): setup for Claude Desktop, Cursor, and other MCP clients, plus the full tool list ## Guides - [Generate PDF guides](https://pdfgen.com/generate-pdf): generating PDFs from Node, Python, PHP, Go, and more - [HTML to PDF](https://pdfgen.com/html-to-pdf): convert HTML to PDF online - [Markdown to PDF](https://pdfgen.com/markdown-to-pdf): convert Markdown to PDF online - [PDF templates](https://pdfgen.com/pdf-templates): ready-made invoice, receipt, certificate, and other templates - [Integrations](https://pdfgen.com/integrations): Zapier, Make, n8n, and Airtable ## Optional - [Pricing](https://pdfgen.com/pricing): plans, credits (1 credit per 5 pages; prompt source billed at 2×), rate limits