Skip to content
PPDFInvoiceAPI
DOCS/ Use with AI agents (MCP)

GUIDES

Use with AI agents (MCP)

PDFInvoiceAPI hosts a remote MCP server — point any agent at one URL with your API key and it can render PDFs. No install, no glue code.

What it is

PDFInvoiceAPI hosts a remote MCP (Model Context Protocol) server at https://pdfinvoiceapi.com/mcp. It speaks Streamable HTTP and authenticates with the same Authorization: Bearer sk_live_… API key as the HTTP API. Point an MCP-capable client — Claude Code, Cursor, Claude Desktop, or your own agent host — at the URL and the agent gets a native render_pdf tool. There is nothing to install: each call forwards to POST /v1/render on our edge, so the tool has the exact same capabilities, limits and credit cost as a direct API call.

Get an API key

Every connection needs a live key. Sign up (free — no credit card) and you get a one-time grant of 25 free renders to start; copy a key from Dashboard → API keys. When you are ready for steady volume, subscribe on the pricing page. Use the key in place of sk_live_YOUR_KEY everywhere below.

Claude Code

One command registers the remote server over HTTP with your key as a header:

claude mcp add --transport http pdfinvoiceapi \
  https://pdfinvoiceapi.com/mcp \
  --header "Authorization: Bearer sk_live_YOUR_KEY"

That writes the server into your Claude Code config. Then ask Claude to "render an invoice PDF for INV-1024" and it will call render_pdf and hand back the PDF.

Cursor, Claude Desktop & other clients

Any client that supports remote (Streamable HTTP) MCP servers takes a mcpServers entry pointing at the URL, with the bearer token in headers:

{
  "mcpServers": {
    "pdfinvoiceapi": {
      "url": "https://pdfinvoiceapi.com/mcp",
      "headers": {
        "Authorization": "Bearer sk_live_YOUR_KEY"
      }
    }
  }
}

For a client that only speaks stdio (no native remote support), bridge to the same URL with the community mcp-remote proxy — still nothing of ours to install:

{
  "mcpServers": {
    "pdfinvoiceapi": {
      "command": "npx",
      "args": [
        "-y",
        "mcp-remote",
        "https://pdfinvoiceapi.com/mcp",
        "--header",
        "Authorization: Bearer sk_live_YOUR_KEY"
      ]
    }
  }
}

The render_pdf tool

The server exposes a single tool, render_pdf: render a professional PDF (invoice, receipt, contract, document) from inline html or a template plus data, and get the PDF back. Provide exactly one of html or template. Inputs:

FieldTypeDescription
htmlstringInline HTML to render to a PDF. Exactly one of html or template.
templatestringA stored template id (e.g. tpl_invoice) OR an inline template string with {{placeholders}}, merged with data.
dataobjectKey/value data merged into template. Ignored when html is sent.
pdfobjectOptional page options: format (A4 default, Letter, Legal, …), landscape, printBackground, scale (0.1–2) and margin.

Output: an MCP embedded resource — the rendered PDF as a base64 application/pdf blob — plus a short text confirmation. On a bad request the tool returns an error message the agent can read. See the POST /v1/render reference and PDF options for every field, and Errors for failure cases. Each successful render costs one credit, billed to the account that owns the key.

Local stdio (optional)

The remote URL above is the recommended path. As an optional alternative, a local stdio MCP server (pdfinvoiceapi-mcp, run via npx, key passed through PDFINVOICEAPI_API_KEY) is on the way. Note: this package is not published yet — prefer the remote URL (or the mcp-remote bridge above) for now.

{
  "mcpServers": {
    "pdfinvoiceapi": {
      "command": "npx",
      "args": ["-y", "pdfinvoiceapi-mcp"],
      "env": { "PDFINVOICEAPI_API_KEY": "sk_live_YOUR_KEY" }
    }
  }
}