home / mcp / markdown2pdf mcp server
MCP Server for converting markdown to PDF
Configuration
View docs{
"mcpServers": {
"2b3pro-markdown2pdf-mcp": {
"command": "node",
"args": [
"/path/to/markdown2pdf-mcp/build/index.js"
],
"env": {
"M2P_VERBOSE": "true",
"M2P_OUTPUT_DIR": "YOUR_OUTPUT_DIR"
}
}
}
}You have a Markdown2PDF MCP Server that converts Markdown documents into PDF files. It supports syntax highlighting, custom styling through CSS, optional page numbers, and configurable watermarks. This server is designed to be used with MCP clients to generate PDFs from Markdown content on demand.
You interact with the server through an MCP client by invoking the create_pdf_from_markdown tool. Provide the Markdown content you want converted and, optionally, formatting options such as output filename, page size, orientation, border, watermark, and whether to show page numbers. The tool renders Mermaid diagrams when you include Mermaid code blocks and uses the built-in syntax highlighting for code blocks.
Prerequisites you need installed on your machine:
Install from source and build the project with these steps. Run each command on its own line.
# Clone the project
git clone https://github.com/2b3pro/markdown2pdf-mcp.git
# Navigate to the project directory
cd markdown2pdf-mcp
# Install dependencies
npm install
# Build the project
npm run buildConfigure how your server writes output and how verbose you want its logs to be. You can also run the server on demand with npx to avoid a permanent local install.
{
"mcpServers": {
"markdown2pdf": {
"args": ["/path/to/markdown2pdf-mcp/build/index.js"],
"env": {
"M2P_OUTPUT_DIR": "/path/to/output/directory",
"M2P_VERBOSE": "true"
}
}
}
}If you prefer not to install the package locally, you can start the server on demand using npx. This installs a temporary workspace and launches the MCP server from the packaged entrypoint.
npx -y markdown2pdf-mcp@latestThe tool automatically handles file name conflicts by appending incremental numbers (for example: output.pdf, output-1.pdf, output-2.pdf). For large Markdown files, the server adjusts timeouts and memory usage to ensure stable rendering. If you include a watermark, you can specify the scope (all pages or only the first page) and optionally enable page numbers in the PDF footer.
Converts Markdown to PDF. Accepts markdown content and optional parameters like outputFilename, paperFormat, paperOrientation, paperBorder, watermark, watermarkScope, and showPageNumbers.