Markdown2PDF

Provides a fast, reliable way to convert Markdown to PDF with syntax highlighting, custom styling, and optional watermarks.
  • javascript

0

GitHub Stars

javascript

Language

7 months ago

First Indexed

3 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": {
    "lamentis1-mcp_pdf": {
      "command": "node",
      "args": [
        "/path/to/markdown2pdf-mcp/build/index.js"
      ],
      "env": {
        "M2P_VERBOSE": "true",
        "M2P_OUTPUT_DIR": "/path/to/output/directory"
      }
    }
  }
}

You can convert Markdown content to PDF quickly with this MCP server. It supports syntax highlighting, custom styling, optional page numbers, and configurable watermarks, making it a practical tool for turning documentation, notes, or reports into polished PDFs.

How to use

Use an MCP-enabled client to send Markdown content to the server and request a PDF. You provide the Markdown text, and you can optionally specify the output filename, page size and orientation, a CSS-based styling override, a watermark, and whether to show page numbers. The server handles rendering, including code block highlighting and Mermaid diagrams. If a Mermaid diagram has a syntax error, the error message appears in the PDF to help you fix it.

Key capabilities you can leverage when you create a PDF from Markdown include: headers, text formatting (bold, italic, strikethrough), lists, tables, blockquotes, links, images, task lists, and Mermaid diagrams.

How to install

Prerequisites: you need Node.js and npm installed on your system. You will install the MCP server package, then start the server to accept conversion requests.

Install the package from npm

npm install markdown2pdf-mcp

Build the project if you clone the source and want to run from a local build

# Build the project after cloning
npm run build

Start the server to begin handling conversion requests

npm start

Configuration

Configure where PDFs are saved and enable verbose logging if needed. The server can write outputs to a specific directory and can be started with additional environment variables for debugging.

{
  "mcpServers": {
    "markdown2pdf": {
      "command": "node",
      "args": ["/path/to/markdown2pdf-mcp/build/index.js"],
      "env": {
        "M2P_OUTPUT_DIR": "/path/to/output/directory",
        "M2P_VERBOSE": "true"
      }
    }
  }
}

In this configuration, the server writes PDFs to the specified output directory. If a file name already exists, a new file is created by appending an incremental number (for example, output.pdf, output-1.pdf, output-2.pdf).

Large Markdown files are supported with dynamic timeouts (up to five minutes for very large documents), sufficient memory allocation for rendering, and progress information. If a document is very large (1300+ lines), you will receive a warning, timeouts increase automatically, and detailed error messages appear if processing fails.

If you want more verbose logs for debugging, enable the M2P_VERBOSE environment variable as shown above.

Available tools

create_pdf_from_markdown

Converts provided Markdown content to a PDF file, with options for output filename, paper format and orientation, border, watermark, page numbers, and watermark scope.

Built by
VeilStrat
AI signals for GTM teams
© 2026 VeilStrat. All rights reserved.All systems operational