# mcp-pdf [Health: Active]

**Category:** 💻 Developer Tools  
**Repository:** https://github.com/mcp-z/mcp-pdf  
**GitHub Stars:** 3  
**npm Downloads (last month):** 919  
**Views:** 9  
**Installs:** 0  
**Upvotes:** 0  
**Directory Page:** https://allmcps.com/mcp/mcp-pdf-2

## Description
MCP server for PDF generation using PDFKit

## Tools
Capabilities this server exposes over MCP:

- **pdf-document** — Create a flowing PDF document with automatic pagination.

Best for: Reports, articles, letters, contracts, and documents with sequential content.

Content flows naturally from top to bottom. Pages break automatically when content exceeds page height. Use "pageBreak" to force page breaks, "divider" for horizontal rules, and "spacer" for vertical spacing.

Supported content types:
- text: Body text with optional formatting (bold, italic, color, alignment)
- heading: Section headings (larger font, bold by default)
- image: Inline images that flow with content
- divider: Horizontal line separators
- spacer: Vertical whitespace
- pageBreak: Force new page

Default margins: Varies by page size (e.g., 72pt/1" for Letter, ~56pt for A4).
- **pdf-image** — Generate PNG image(s) from PDF pages.

Use this to visually verify PDF output without opening external applications.

**Pages Options:**
- Single page: `pages: 1` or `pages: 3`
- Multiple pages: `pages: [1, 3, 5]`
- All pages: `pages: "all"`
- Default: page 1 only

**Viewport Scale Recommendations:**
- **0.25 (thumbnail)**: ~150px wide, smallest file (~15-30KB). Use for quick verification.
- **0.5 (preview)**: ~300px wide, good balance (~40-80KB). **Recommended default.**
- **1.0 (full)**: ~612px wide, detailed view (~150-300KB). Use when details matter.

Lower scales produce smaller files, reducing context usage when sharing images.
- **pdf-layout** — Create a PDF with precise positioning using Yoga flexbox layout.

Best for: Dashboards, slides, certificates, flyers, and designs requiring exact placement.

All items are positioned absolutely on specific pages. Use the "page" property to target different pages (e.g., page: 2 for multi-slide presentations). Pages are created as needed.

Use groups for flexbox containers - they support direction, gap, justify, alignItems, and alignment properties for sophisticated layouts.

Default margins: 0 (full canvas access for precise positioning).
- **pdf-resume** — Generate a professional resume PDF from JSON Resume format. Supports layout customization, date/locale formatting, styling, fonts, and automatic page breaks.
- **text-measure** — Measure text width and height before rendering.

Returns exact dimensions based on font, font size, and text content. Use this to:
- Calculate text width to set proper container sizes
- Determine if text will fit in a given space
- Plan multi-line layouts by specifying width constraint

Width is measured as single-line natural width. Height accounts for text wrapping when width is specified.

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

```json
"mcpServers": {
  "mcp-pdf": {
    "command": "npx",
    "args": ["-y","@mcp-z/cli"]
  }
}
```

## Documentation

## What mcp-pdf MCP server does

The mcp-pdf MCP server exposes PDF creation and layout operations through the Model Context Protocol. It uses PDFKit and runs on the local machine, so generated files do not require a remote API or an API key. The available operations cover both flowing content and exact positioning.

Use `pdf-document` for content that should flow across pages with automatic pagination. Use `pdf-layout` when elements need explicit positions, such as in slides, flyers, or other designed pages. `pdf-resume` creates documents from JSON Resume data. The server also includes `pdf-image` for rendering PDF pages as PNG files and `text-measure` for checking text dimensions before placing it in a layout.

## How it works

MCP clients invoke the server's tools with structured arguments. A document-generation call returns a file URI together with metadata for the generated PDF. The tools can be inspected and called with the `@mcp-z/cli` package, or they can be connected to an MCP client through a saved server configuration.

Two transports are available. Stdio starts the package as a local child process, while HTTP exposes the MCP endpoint at `/mcp`. The HTTP example runs the server on port 9010. Both transport modes support the protocol revisions identified in the project documentation, including the stateless 2026 revision, where clients do not send an initialization handshake or session ID.

## Setup and configuration

The mcp-pdf MCP server requires Node.js 22.13 or newer. The documented examples use `npx`, which is supplied with npm, so a separate global installation is not required. A stdio configuration points the client at `npx -y @mcp-z/mcp-pdf`. An HTTP configuration uses the local endpoint `http://localhost:9010/mcp` and starts the package with `--port=9010`.

Save the chosen configuration as `.mcp.json` in the directory where the commands will run. The project also documents an `@mcp-z/cli up` workflow that can launch HTTP servers using the configuration's `start` command. For a direct test, inspect the registered tools with `npx -y @mcp-z/cli inspect --servers pdf --tools`, then call a tool through the CLI.

## Tools and capabilities

- `pdf-document`: Produces flowing documents and handles page breaks automatically.
- `pdf-layout`: Builds layouts with precise element positioning for formats such as slides and flyers.
- `pdf-resume`: Generates a resume document from JSON Resume content.
- `pdf-image`: Converts PDF pages into PNG images.
- `text-measure`: Measures text before layout calculations are applied.

The repository also lists a `resource-fetching` prompt and external resources covering PDFKit documentation, the JSON Resume schema, and a JSON Resume editor. These entries provide protocol-accessible references; the server does not list additional external service integrations.

## Limitations and notes

The material describes local execution and does not identify any hosted deployment, API-key flow, or external integrations. Node.js 22.13 or later is required. The available description does not specify the full argument schema, styling options, supported fonts, image inputs, or PDF output restrictions for each tool; consult the project's complete tool reference for those details.

The HTTP transport requires a locally running server and uses the `/mcp` endpoint. Protocol behavior differs between the supported revisions: the documented 2026 revision is stateless, while clients using the other supported revision follow its session and initialization requirements.

_Full upstream README: https://allmcps.com/mcp/mcp-pdf-2/readme_

