HTML2PDF

HTML to PDF MCP Server
  • html

3

GitHub Stars

html

Language

6 months ago

First Indexed

2 months ago

Catalog Refreshed

Documentation & install

Readme and setup notes from the catalogue, plus a client-ready config you can copy for your MCP host.

Installation

Add the following to your MCP client configuration file.

Configuration

View docs
{
  "mcpServers": {
    "jesamkim-html2pdf": {
      "command": "node",
      "args": [
        "/absolute/path/to/html2pdf/dist/index.js"
      ]
    }
  }
}

You have a dedicated MCP server that converts HTML into PDF by using Puppeteer’s browser rendering, enabling high-fidelity output from HTML files or HTML strings. This server is useful when you need automated, repeatable HTML-to-PDF rendering as part of an MCP workflow. It supports full CSS and JavaScript rendering, configurable page formats, margins, headers/footers, and options to wait for network idle or reuse browser instances for performance.

How to use

To use this server with your MCP client, first ensure the server is configured as an MCP endpoint and available on your network or locally. You will interact with the convert_html_to_pdf tool through your MCP client by specifying the HTML input (path or content) and the desired PDF options. The tool executes a headless browser rendering process to produce a PDF that preserves layout, styles, and embedded scripts.

How to install

Prerequisites you need before installing: Node.js 18+.

Install dependencies and build the project.

Run the project build and start commands exactly as shown.

npm install
npm run build

Configuration and usage notes

Configure your MCP client to connect to the HTML to PDF server using the following MCP server entry. This config runs the server locally via Node and uses an explicit path to the compiled index.js.

{
  "mcpServers": {
    "html2pdf": {
      "command": "node",
      "args": ["/absolute/path/to/html2pdf/dist/index.js"],
      "description": "Convert HTML to PDF with browser rendering"
    }
  }
}

Converting HTML to PDF with the tool

Use the convert_html_to_pdf tool to produce a PDF from either a local HTML file or raw HTML content. You can specify formatting options such as page size, margins, orientation, whether to print backgrounds, and header/footer templates.

{
  "htmlPath": "./sample.html",
  "outputPath": "./output.pdf",
  "format": "A4",
  "printBackground": true,
  "marginTop": "10mm",
  "marginBottom": "10mm"
}

Direct testing

You can run a direct test to verify the conversion flow locally by executing the test script.

npx tsx test-conversion.ts

Notes and tips

The server uses a reusable browser instance to improve performance across multiple conversions. Expect initial PDF generation to include the browser startup time, with subsequent conversions typically faster due to the reused browser.

Available tools

convert_html_to_pdf

Converts HTML to PDF using a browser renderer with options for format, margins, orientation, header/footer, backgrounds, wait for network idle, and timeout.

Built by
VeilStrat
AI signals for GTM teams
© 2026 VeilStrat. All rights reserved.All systems operational
HTML2PDF MCP Server - jesamkim/html2pdf | VeilStrat