Provides tools to convert Markdown content into PDF documents with customizable paper formats and orientations
MCP PDF Server
An MCP (Model Context Protocol) server exposing tools to render Markdown into PDF.
What’s included
- MCP tools:
pdf_from_markdown
(primary) andmd_to_pdf
(alias). - Accepts inline Markdown or a file path.
- Options for paper format and orientation; sensible
output/
defaults.
Prerequisites
- Node.js 18+ recommended.
Install
Build
Run (stdio)
Configure in your MCP-compatible client by pointing to the compiled binary or npm start
command.
MCP Tools
- Tool ids:
pdf_from_markdown
(primary) andmd_to_pdf
(alias for discoverability)- Purpose: Generate a PDF from Markdown.
- Inputs:
markdown
(string, optional): Inline Markdown content. If set,path
is ignored.path
(string, optional): Absolute or relative path to a.md
file. Ignored ifmarkdown
is provided.outputPath
(string, optional): Desired output PDF path. Defaults tooutput/<timestamp>.pdf
and creates missing directories.paperFormat
(string, optional):A4
|Letter
|Legal
(default:A4
).paperOrientation
(string, optional):portrait
|landscape
(default:portrait
).- Provide exactly one of
markdown
orpath
. If both are set,markdown
takes precedence.
- Output:
- Returns a text message containing the absolute path to the created PDF.
- Example (inline):
- Example (file path):
Tool Schema (compact)
Client configuration (example) If your MCP client supports JSON configuration for a stdio server, a minimal entry might look like:
Notes
- Uses Playwright (Chromium) to render HTML from Markdown and print to PDF.
- On first install, Playwright may download a browser. You can also point it to an existing Chrome/Chromium.
One‑liner with npx
- After this package is published to npm, you can run the server directly:
npx -y md-2-pdf-mcp
(runs themd-2-pdf-mcp
bin)- Or explicitly:
npx -y -p md-2-pdf-mcp mcp-pdf
- The package defines
bin
entries and apostinstall
that installs Chromium.
- From the local repo (without publishing):
npx --yes .
- This uses the
bin
in package.json and theprepare
script to build.
This server cannot be installed
local-only server
The server can only run on the client's local machine because it depends on local resources.
Enables conversion of Markdown content into PDF documents with customizable paper formats and orientations. Supports both inline Markdown text and file path inputs, automatically generating PDFs using Playwright and Chromium.