Converts Markdown files and raw content into professionally styled PDF documents with support for headers, tables, and syntax highlighting.
Supports the automatic rendering of Mermaid diagrams, including flowcharts and sequence diagrams, directly within generated PDFs.
Allows the use of YAML front matter to define and apply document metadata and properties during the conversion process.
Click on "Install Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@md-mermaid-to-pdf-mcpConvert my README.md file to an A4 PDF named documentation.pdf"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
md-mermaid-to-pdf-mcp
A powerful Model Context Protocol (MCP) server that converts Markdown files and content to beautifully styled PDFs with Mermaid diagram support.
β¨ Features
π Two conversion modes: File-to-PDF and content-to-PDF
π Mermaid diagrams: Automatic rendering of flowcharts, sequence diagrams, and more
π¨ Modern styling: Professional typography with Inter font and syntax highlighting
π Multiple formats: A4, A3, A5, Letter, Legal, Tabloid
βοΈ Configurable margins: Custom spacing in inches, mm, cm
π Front matter support: YAML metadata for document properties
π― Accessibility: Tagged PDFs with proper outline structure
π Quick Start
Option 1: Use with npx (Recommended)
npx md-mermaid-to-pdf-mcpOption 2: Global Installation
npm install -g md-mermaid-to-pdf-mcp
md-mermaid-to-pdf-mcpπ§ Claude Desktop Integration
Add to your Claude Desktop configuration:
Windows: %APPDATA%\Claude\claude_desktop_config.json
macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
{
"mcpServers": {
"markdown-pdf": {
"command": "npx",
"args": ["md-mermaid-to-pdf-mcp"]
}
}
}Restart Claude Desktop after configuration.
π Usage Examples
Convert Markdown File to PDF
"Convert my README.md file to PDF and save it as documentation.pdf"Convert Markdown Content to PDF
"Take this markdown content and create a PDF with A4 format:
# My Document
This is **bold** text with a [link](https://example.com)
"Custom Formatting
"Convert the markdown file with custom margins of 1 inch on all sides and Letter format"Mermaid Diagrams
# Process Flow
```mermaid
graph TD
A[Start] --> B{Decision}
B -->|Yes| C[Action 1]
B -->|No| D[Action 2]
C --> E[End]
D --> E
## π οΈ Available Tools
### `convert_markdown_to_pdf`
Converts a markdown file to PDF.
**Parameters:**
- `markdownPath` (string): Path to the markdown file
- `outputPath` (string): Where to save the PDF
- `format` (optional): Page format (A4, A3, A5, Letter, Legal, Tabloid)
- `margin` (optional): Custom margins object
### `markdown_content_to_pdf`
Converts markdown content directly to PDF.
**Parameters:**
- `markdownContent` (string): Markdown content to convert
- `outputPath` (string): Where to save the PDF
- `title` (optional): Document title
- `format` (optional): Page format
- `margin` (optional): Custom margins object
## π¨ Supported Markdown Features
- **Headers**: H1-H6 with modern styling
- **Text formatting**: Bold, italic, strikethrough
- **Lists**: Ordered and unordered with custom bullets
- **Tables**: Styled with alternating row colors
- **Code blocks**: Syntax highlighting for 100+ languages
- **Blockquotes**: Elegant left-border styling
- **Links**: Styled with hover effects
- **Images**: Embedded with proper scaling
- **Mermaid diagrams**: Flowcharts, sequence, gantt, and more
## π Requirements
- Node.js 18+
- Chrome/Chromium (automatically installed with Puppeteer)
## π§ Configuration Examples
### Custom Margins
```json
{
"margin": {
"top": "1in",
"right": "0.5in",
"bottom": "1in",
"left": "0.5in"
}
}Front Matter Support
---
title: My Document
author: John Doe
date: 2024-01-01
---
# Document Content
Your markdown content here...π€ Contributing
Fork the repository
Create your feature branch (
git checkout -b feature/amazing-feature)Commit your changes (
git commit -m 'Add amazing feature')Push to the branch (
git push origin feature/amazing-feature)Open a Pull Request
π License
This project is licensed under the MIT License - see the LICENSE file for details.
π Issues & Support
Found a bug or need help? Please open an issue on GitHub.
π Show Your Support
Give a βοΈ if this project helped you!