# boxpdf-html [Health: Active]

**Category:** 💻 Developer Tools  
**Repository:** https://github.com/earonesty/boxpdf-html  
**GitHub Stars:** 2  
**npm Downloads (last month):** 49  
**Views:** 1  
**Installs:** 0  
**Upvotes:** 0  
**Directory Page:** https://allmcps.com/mcp/boxpdf-html

## Description
Render HTML to PDF (html_to_pdf) plus boxpdf library docs and templates, for AI agents.

## Claude Desktop Quick Installation
Install path detected from listing signals. Uses `npx` (confidence: high):

```json
"mcpServers": {
  "boxpdf-html": {
    "command": "npx",
    "args": ["-y","@boxpdf/html-reader"]
  }
}
```

## Documentation

## What the boxpdf-html MCP server does

The boxpdf-html MCP server converts authored HTML into PDF documents through the Model Context Protocol. Its primary `html_to_pdf` tool accepts an HTML string and optional CSS, then either writes the result to an `outputPath` or returns the PDF inline as a base64 resource. Agents can choose Letter, A4, Legal, or Tabloid pages, set margins, provide a base URL, supply font files, and enable debug output.

The package is built on `@boxpdf/writer` and is intended for document layouts where useful static output matters more than browser-level pixel emulation. Typical inputs include invoices, receipts, reports, emails, and other structured documents. The server also includes `boxpdf_docs`, which returns focused guidance for topics such as quickstarts, fonts, themes, tables, pagination, streaming, the HTML API, and Cloudflare.

## How it works

Run the server with the `mcp` command through the package executable. It communicates over stdio, so an MCP client launches it as a local process. A Claude setup, for example, uses `npx -y @boxpdf/html-reader mcp` as the server command.

For each conversion, the agent supplies HTML and may add CSS, local resource settings, embedded font paths, page size, margins, or a destination path. `allowRemote` defaults to `false`, blocking HTTP and HTTPS image fetches unless the agent explicitly enables them. The process does not execute JavaScript and normally makes no network requests.

The server returns warnings and unsupported-CSS diagnostics with every `html_to_pdf` call. This lets an agent revise markup when a CSS feature is not represented by the renderer. PDFs larger than 1 MB are summarized instead of being inlined when no output path is supplied. Files written to `outputPath` use the filesystem permissions of the agent process.

MCP resources include guides and readmes under `boxpdf-html://` and `boxpdf://` URIs. Five template sources are available for receipt, boarding pass, resume, order confirmation, and certificate documents.

## Setup and configuration

Install the scoped npm package with `@boxpdf/html-reader`; the older `boxpdf-html` package and command remain supported. To register the MCP server with Claude, run:

```sh
claude mcp add boxpdf-html -- npx -y @boxpdf/html-reader mcp
```

No environment variable is required to start the MCP server. Font paths are supplied as tool arguments, not discovered from the host system. The renderer uses pdf-lib's built-in Helvetica family by default. For brand fonts, Unicode coverage, or exact text metrics, pass regular, bold, italic, and bold-italic TTF or OTF files as appropriate.

## Tools and capabilities

The boxpdf-html MCP server exposes these agent-facing capabilities:

- `html_to_pdf`: Converts HTML and optional CSS to PDF, with page size, margin, base URL, fonts, remote-image policy, debugging, and output-path options.
- `boxpdf_docs`: Provides focused documentation for direct use of the boxpdf libraries.
- MCP resources: Supplies guides, readmes, and five document template sources.

The underlying package also offers JavaScript APIs for applications that need more control. `htmlToPdf` returns PDF bytes, while `htmlToBoxpdf` produces boxpdf nodes and diagnostics for custom rendering flows. `streamHtmlToPdf` supports bounded two-pass conversion for large inputs, including incremental output. These APIs are library features rather than additional MCP tools.

## Limitations and notes

The renderer is not a browser engine: it does not run JavaScript and does not aim to reproduce browser pixels. CSS support is therefore limited to what the boxpdf HTML renderer implements; the tool reports unsupported CSS so callers can respond.

Fonts must be provided explicitly when the built-in Helvetica family is insufficient. The server does not discover system fonts or ship a browser font stack. Remote images are blocked by default. Enabling `allowRemote` changes that behavior and should be considered when controlling external resource access.

Large documents can be handled through the package's streaming API, but some layouts have safety limits. Flex and grid containers, positioned or transformed elements, uninterrupted text nodes, and selectors dependent on sibling position may prevent safe fragmentation or cause streaming to fail with an explanatory error.

_Full upstream README: https://allmcps.com/mcp/boxpdf-html/readme_

