# PDFgen — how to use (mcp.ai)

Connect your PDFgen account and use 8 tools for documents straight from your AI agent. Connect with your own API key. PDFgen creates PDFs from reusable templates, HTML, Markdown, or natural-language prompts and manages account templates and usage logs.

## Option A — via MCP (recommended)
Remote MCP endpoint (HTTP, streamable): `https://api.mcp.ai/p_pdfgen?ms=1787293440000`
Add it as a custom/remote MCP connector in your client (Claude, Cursor, VS Code…), then authenticate when prompted. Once connected, ask the agent to use the server's tools (e.g. `pdfgen_create_template`).

## Option B — via direct REST API
Base URL: `https://api.mcp.ai/api/pdfgen`
Auth: `Authorization: Bearer sk_live_…` — create a workspace API key at https://mcp.ai/settings/api-keys
Discover endpoints: `GET https://api.mcp.ai/api/pdfgen/_endpoints`

### Endpoints
- `POST https://api.mcp.ai/api/pdfgen/create/template` — Create a reusable HTML template for later PDF generation.
  - body: { name: string, engine?: string, content: string }
- `POST https://api.mcp.ai/api/pdfgen/delete/template` — Permanently delete one saved template owned by the connected account.
  - body: { template_id: string }
- `POST https://api.mcp.ai/api/pdfgen/generate/pdf` — Generate a PDF from exactly one saved template, HTML document, Markdown document, or AI prompt and return a temporary download URL.
  - body: { data?: object, html?: string, engine?: string, format?: string, prompt?: string, markdown?: string, password?: string, file_name?: string, expiry_time?: number, orientation?: string, protect_pdf?: boolean, template_id?: string }
- `POST https://api.mcp.ai/api/pdfgen/get/account` — Return the connected PDFgen account, organization, plan, and current credit usage.
- `POST https://api.mcp.ai/api/pdfgen/get/template` — Get one saved PDFgen template, including its complete HTML content.
  - body: { template_id: string }
- `POST https://api.mcp.ai/api/pdfgen/list/templates` — List saved PDF templates owned by the connected account and return one page with a continuation cursor.
  - body: { limit?: integer, next_cursor?: string }
- `POST https://api.mcp.ai/api/pdfgen/list/usage/logs` — List recent PDFgen API calls for auditing, billing inspection, and generation troubleshooting. Returns one page with a continuation cursor. Usage logs are eventually consistent, so a just-completed ca
  - body: { limit?: integer, next_cursor?: string }
- `POST https://api.mcp.ai/api/pdfgen/update/template` — Partially update a saved template's name, HTML content, or rendering engine without replacing omitted fields.
  - body: { name?: string, engine?: string, content?: string, template_id: string }

## Example prompts
- "What can I do in PDFgen?"
- "Show me a summary of my PDFgen account"

## More
- Page: https://mcp.ai/pdfgen
- Agent spec (llms.txt): https://mcp.ai/pdfgen/llms.txt
- Postman collection: https://mcp.ai/pdfgen/postman.json
