Markdown to PDF MCP Server

Markdown to PDF MCP servers enable AI models to convert Markdown documents into PDF files, supporting syntax highlighting, custom styling, and flexible output options.

GitHub starsnpm versionnpm downloads

Overview

The Markdown2PDF MCP Server enables AI models to convert Markdown documents into PDF files. It's part of the Model Context Protocol (MCP) system, providing a standardized way to generate high-quality PDFs from Markdown content.

Created by:

Developed by 2b3pro

Key Features

📝

Markdown to PDF Conversion

Convert Markdown documents to PDF files with a single command
🎨

Custom Styling & Syntax Highlighting

Apply custom CSS styles and enjoy syntax highlighting for code blocks
📄

Flexible Output Options

Configure paper format, orientation, borders, watermarks, and page numbers
🚀

Efficient & Reliable

Utilizes Chrome's rendering engine for modern PDF generation and reliable resource loading

Available Tools

Quick Reference

ToolPurposeCategory
create_pdf_from_markdownConvert Markdown content to a PDF fileConversion

Detailed Usage

create_pdf_from_markdown
Converts Markdown content into a PDF file with various customization options.
use_mcp_tool({
  server_name: "markdown2pdf",
  tool_name: "create_pdf_from_markdown",
  arguments: {
    markdown: "# Hello World\n\nThis is a test document.",
    outputFilename: "output.pdf",
    paperFormat: "a4",
    paperOrientation: "portrait",
    paperBorder: "1.5cm",
    watermark: "DRAFT",
    watermarkScope: "first-page",
    showPageNumbers: true,
  }
});

Required parameters: markdown (string), outputFilename (string). Optional parameters: paperFormat (string, e.g., 'a4', 'letter'), paperOrientation (string, 'portrait' or 'landscape'), paperBorder (string, CSS units), watermark (string, max 15 chars, uppercase), watermarkScope ('all-pages' or 'first-page'), showPageNumbers (boolean).

Installation

{
  "mcpServers": {
    "markdown2pdf": {
      "command": "npx",
      "args": [
        "-y",
        "markdown2pdf-mcp@latest"
      ],
      "env": {
        "M2P_OUTPUT_DIR": "/path/to/output/directory"
      }
    }
  }
}

Sources