Skip to content

PdfBroker.io provides an MCP (Model Context Protocol) server that lets AI agents generate professional PDF documents directly from conversation. Instead of writing integration code, you configure the MCP server once and then ask your AI assistant to create invoices, reports, certificates, or any document — it generates the HTML, calls PdfBroker.io's rendering engine, and gives you a download link.

This guide walks through setup for Claude Code, Claude Desktop, Cursor, and VS Code.

What You Get

Once connected, your AI agent has access to these tools:

  • html_to_pdf — Convert HTML/CSS to PDF using WeasyPrint. Supports PDF/A and PDF/UA compliance standards. Best for professional documents.
  • html_to_pdf_wk — Convert HTML to PDF using wkhtmltopdf. Supports JavaScript rendering. Available on the free tier.
  • merge_pdfs — Combine multiple PDFs into a single document.
  • pdf_to_image — Convert PDF pages to PNG or JPEG images.
  • write_text_on_pdf — Overlay text on existing PDF documents.

Prerequisites

  • A PdfBroker.io account (free tier available)
  • Your Client ID and Client Secret from the PdfBroker.io portal (Members → API Credentials)
  • Node.js 18+ installed (required for the npm wrapper used by Claude Desktop and Cursor)

Setup for Claude Code

Claude Code supports custom HTTP headers on remote MCP servers, so it connects directly — no npm wrapper needed.

Run this command in your terminal:

claude mcp add-json pdfbroker '{
  "type": "http",
  "url": "https://mcp.pdfbroker.io/",
  "headers": {
    "X-PdfBroker-ClientId": "YOUR_CLIENT_ID",
    "X-PdfBroker-ClientSecret": "YOUR_CLIENT_SECRET"
  }
}'

Replace YOUR_CLIENT_ID and YOUR_CLIENT_SECRET with your actual credentials from the PdfBroker.io portal.

To verify the connection, run /mcp inside a Claude Code session. You should see pdfbroker listed with its tools.

Setup for Claude Desktop

Claude Desktop uses stdio-based MCP servers. PdfBroker.io provides an npm wrapper (@pdfbroker/mcp-server) that handles the connection.

Open Claude Desktop, go to Settings → Developer → Edit Config, and add:

{
  "mcpServers": {
    "pdfbroker": {
      "command": "npx",
      "args": ["-y", "@pdfbroker/mcp-server"],
      "env": {
        "PDFBROKER_CLIENT_ID": "YOUR_CLIENT_ID",
        "PDFBROKER_CLIENT_SECRET": "YOUR_CLIENT_SECRET"
      }
    }
  }
}

Save the file and restart Claude Desktop completely (Cmd+Q on macOS, right-click tray → Quit on Windows, then reopen). After restart, look for the hammer icon at the bottom of the chat window — click it to verify the PdfBroker tools are listed.

Setup for Cursor

Create or edit .cursor/mcp.json in your project root:

{
  "mcpServers": {
    "pdfbroker": {
      "command": "npx",
      "args": ["-y", "@pdfbroker/mcp-server"],
      "env": {
        "PDFBROKER_CLIENT_ID": "YOUR_CLIENT_ID",
        "PDFBROKER_CLIENT_SECRET": "YOUR_CLIENT_SECRET"
      }
    }
  }
}

Restart Cursor to load the configuration. The PdfBroker tools will appear in Cursor's MCP tool list.

Setup for VS Code

Create or edit .vscode/mcp.json in your workspace:

{
  "servers": {
    "pdfbroker": {
      "command": "npx",
      "args": ["-y", "@pdfbroker/mcp-server"],
      "env": {
        "PDFBROKER_CLIENT_ID": "YOUR_CLIENT_ID",
        "PDFBROKER_CLIENT_SECRET": "YOUR_CLIENT_SECRET"
      }
    }
  }
}

Open GitHub Copilot chat in Agent mode. Use the Select Tools icon to verify the PdfBroker tools are available.

Your First PDF

Once connected, try a prompt like this:

Create a one-page PDF with a heading "Project Status Report", today's date, and a summary table with three columns: Task, Status, and Owner. Use the html_to_pdf tool with A4 paper size.

The AI agent will:

  1. Generate a complete HTML document with CSS styling
  2. Call the html_to_pdf tool with the HTML content
  3. Return a download link to the generated PDF

The download link is valid for 30 minutes. Click it to save your PDF.

Tips for Better Results

Be specific about layout. "A4 landscape with 2cm margins" produces better results than "make a PDF."

Mention compliance when needed. If you need an accessible document, say "use PdfUA1 conformance level" in your prompt. For archival documents, request "PdfA1b conformance."

Use html_to_pdf for professional documents. The WeasyPrint engine supports CSS Paged Media — headers, footers, page numbers, and named pages. It produces significantly better output than wkhtmltopdf for multi-page documents.

Use html_to_pdf_wk for quick outputs. If your document uses JavaScript (charts, dynamic content), the wkhtmltopdf engine handles that. It's also available on the free tier.

Iterate on design. Ask the AI to "make the table headers blue" or "add a company logo as a base64 image." The AI can refine the HTML and regenerate the PDF in seconds.

Troubleshooting

Tools don't appear after setup: Make sure Node.js 18+ is installed (node --version). The npm wrapper requires it. Also verify you've fully restarted the AI client after editing the config.

Authentication errors: Double-check your Client ID and Client Secret. They're available in the PdfBroker.io portal under Members → API Credentials. Ensure your subscription is active.

"PDF generation failed" errors: Check that your HTML is well-formed. The WeasyPrint engine is strict about valid HTML. Common issues include unclosed tags and missing <html> or <body> wrappers.

What's Next