HTML to PDF in Claude Code

HTML to PDF in Claude Code

Convert HTML or any public URL to PDF from Claude Code with the html-pdf.com remote MCP server. Run one command to connect, then just ask Claude.

Quick answer: run claude mcp add --transport http html-pdf https://html-pdf.com/mcp --header "Authorization: Bearer $HTML_PDF_KEY", then ask Claude "Render invoice.html to a PDF".

Get an API key

You need a key before you connect. Sign up with one call and copy the api_key from the response (it is shown once). Then open the link we email you to confirm your address. That adds 100 free credits, and 1 credit = 1 PDF page.

curl -X POST https://html-pdf.com/v1/signup \
  -H "Content-Type: application/json" \
  -d '{"email": "you@example.com"}'

You can also get a key by email at https://html-pdf.com/login. Then export it:

export HTML_PDF_KEY=hp_live_...

Connect

This step adds the remote MCP server (Streamable HTTP) to Claude Code. There is nothing to install and no npx.

claude mcp add --transport http html-pdf https://html-pdf.com/mcp \
  --header "Authorization: Bearer $HTML_PDF_KEY"

Run /mcp inside Claude Code to check that html-pdf is connected. You get four tools: html_to_pdf, url_to_pdf, get_credits, and buy_credits.

No key yet? Add the server without the header and Claude Code opens an html-pdf.com login in your browser. New accounts get 100 free credits.

Try it

Once connected, you just ask in plain words. You don't write any code. For example:

The tool returns a download link valid for 24 hours, the page count and your remaining credits.

Tips

These requests help you get cleaner PDFs and repeatable builds.

Troubleshooting

Most issues come from an empty key variable or pages that need more time to load.

FAQ

How do I add a PDF MCP server to Claude Code?

Run claude mcp add --transport http html-pdf https://html-pdf.com/mcp with an Authorization: Bearer header holding your key. Then check it with /mcp.

Do I need to install anything locally?

No. html-pdf.com is a remote MCP server, so there is no npx, Chrome or Puppeteer to install. Rendering happens on our servers.

Is there a free tier?

Yes. Every new account gets 100 free credits once you confirm your email, with no card. 1 credit = 1 PDF page, and failed renders cost nothing.

Does it support page numbers?

Yes. Use <span class="pageNumber"></span> and <span class="totalPages"></span> in the footer and set a bottom margin so the footer has room.

Full reference: API docs · MCP server

This page as markdown · text