Markdown To PDF Server
БесплатноНе проверенEnables AI assistants to convert Markdown files and content to beautifully formatted PDF documents using Playwright's Chromium engine.
Описание
Enables AI assistants to convert Markdown files and content to beautifully formatted PDF documents using Playwright's Chromium engine.
README
A Model Context Protocol (MCP) server that enables AI assistants like Claude to convert Markdown files and content to beautifully formatted PDF documents. Built with Node.js and Playwright for high-quality, browser-based PDF generation.
What is This?
This MCP server adds PDF conversion capabilities to Claude Desktop and other MCP-compatible AI assistants. Simply ask Claude to "convert my markdown file to PDF" and it handles the conversion using this server.
Features
- 🎨 Beautiful Defaults: GitHub-style markdown rendering out of the box
- 🎯 Custom Styling: Full control with custom CSS
- 📄 Multiple Formats: Support for A4, Letter, Legal, and more
- 🔄 Flexible Input: Convert from files or direct markdown content
- 🖨️ Print Options: Landscape/portrait, margins, background graphics
- ⚡ Fast: Powered by Playwright's Chromium engine
Installation
You can use this MCP server in two ways:
Option 1: Use Directly from GitHub (Recommended)
No cloning required! Use npx to run directly from the GitHub repository.
Configuration
Edit your Claude Desktop config file:
Windows: %APPDATA%\Claude\claude_desktop_config.json
macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
{
"mcpServers": {
"pdf-generator": {
"command": "npx",
"args": ["-y", "github:warrenandre/MCP_MD_TO_PDF"]
}
}
}
That's it! The first time you use it, npx will automatically download and set up the server. Future uses will be faster as it caches the installation.
Benefits:
- No local installation needed
- Always uses the latest version from GitHub
- Minimal setup
- Works on any machine with Node.js
Option 2: Run Locally (For Development/Customization)
If you want to modify the server or run it locally:
Step 1: Clone the Repository
git clone https://github.com/warrenandre/MCP_MD_TO_PDF.git
cd MCP_MD_TO_PDF
Step 2: Install Dependencies
npm install
Step 3: Install Playwright
Playwright needs to download Chromium (first time only):
npx playwright install chromium
Step 4: Configure Claude Desktop
Edit your Claude Desktop config file:
Windows: %APPDATA%\Claude\claude_desktop_config.json
{
"mcpServers": {
"MD_TO_PDF": {
"command": "node",
"args": ["C:\\path\\to\\MCP_MD_TO_PDF\\index.js"]
}
}
}
macOS: ~/Library/Application Support/Claude/claude_desktop_config.json
{
"mcpServers": {
"MD_TO_PDF": {
"command": "node",
"args": ["/path/to/MCP_MD_TO_PDF/index.js"]
}
}
}
Important: Replace the path with the actual absolute path to your index.js file.
Final Step (Both Options)
Restart Claude Desktop for the configuration to take effect.
Test it: Open Claude and try:
Convert sample.md to output.pdf
How to Use
Once configured, simply ask Claude to convert markdown to PDF using natural language:
Basic Conversion
Convert document.md to document.pdf
Custom Page Format
Convert report.md to report.pdf using Letter format in landscape mode
With Custom CSS
Convert notes.md to styled-notes.pdf with custom CSS:
body { font-family: Georgia, serif; font-size: 14pt; }
h1 { color: #2c3e50; }
Direct Content Conversion
Create a PDF from this markdown content:
# Meeting Notes
- Item 1
- Item 2
Save as meeting.pdf
Get Default Styling
Show me the default CSS for PDF generation
MCP Tools Reference
This server provides three tools that Claude can use:
1. convert_markdown_to_pdf
Convert a Markdown file to PDF.
Parameters:
markdownPath(required): Path to input .md fileoutputPath(required): Path where PDF will be savedcustomCss(optional): Custom CSS stylingformat(optional): Paper format - 'A4', 'Letter', 'Legal', 'A3', 'A5', 'Tabloid' (default: 'A4')landscape(optional): Use landscape orientation (default: false)printBackground(optional): Print background graphics (default: true)
Example request:
Convert README.md to documentation.pdf
2. convert_markdown_content_to_pdf
Convert markdown content directly to PDF without reading from a file.
Parameters:
markdownContent(required): Markdown text to convertoutputPath(required): Path where PDF will be savedcustomCss(optional): Custom CSS stylingformat(optional): Paper format (default: 'A4')landscape(optional): Use landscape orientation (default: false)printBackground(optional): Print background graphics (default: true)
Example request:
Convert this markdown to PDF: # Hello World\n\nThis is a **test**.
Save it as output.pdf
3. get_default_css
Get the default CSS template used for styling.
Use this to:
- See the default styling
- Use as a starting point for customization
- Understand available CSS classes
Example request:
Show me the default CSS for PDF generation
Default CSS Styling
The server includes GitHub-style markdown CSS by default with:
- Clean typography with system fonts
- Syntax highlighting for code blocks
- Styled tables, blockquotes, and lists
- Responsive images
- Professional headings with borders
Use get_default_css tool to see the complete default stylesheet.
PDF Options
Paper Formats
- A4: 210mm × 297mm (default)
- Letter: 8.5in × 11in
- Legal: 8.5in × 14in
- A3: 297mm × 420mm
- A5: 148mm × 210mm
- Tabloid: 11in × 17in
Margins
Default margins: 1cm on all sides
Custom margins in customCss:
@page {
margin: 2cm 1.5cm;
}
Troubleshooting
Server Not Showing Up in Claude
For GitHub Installation (Option 1):
- Ensure Node.js is installed (
node --version) - Check the config file syntax is correct (valid JSON)
- Restart Claude Desktop completely
- Check Claude logs for errors (see locations below)
For Local Installation (Option 2):
- Verify the path in config is correct and absolute
- Ensure
index.jsexists at that location - Restart Claude Desktop completely
- Check Claude logs for startup errors
Claude Log Locations:
- Windows:
%APPDATA%\Claude\logs\ - macOS:
~/Library/Logs/Claude/
Playwright Not Installed
Error: "Executable doesn't exist at ..."
Solution:
npx playwright install chromium
This typically only affects local installations (Option 2), as GitHub installation handles dependencies automatically.
File Not Found Errors
Error: "ENOENT: no such file or directory"
Solutions:
- Use absolute paths (e.g.,
C:\Users\...\file.md) - Ensure the file exists and has read permissions
- Check the file extension is
.md
PDF Looks Different Than Expected
Solutions:
- Ask Claude to show the default CSS:
Show me the default CSS - Test with custom CSS to override defaults
- Enable
printBackground: truefor colors and backgrounds - Try different paper formats (Letter, A4, etc.)
Permission Denied
Error: "EACCES: permission denied"
Solutions:
- Ensure the output directory exists and is writable
- Check file permissions on the output path
- Try saving to a different location (e.g., Desktop)
Technical Details
Architecture
This is a Model Context Protocol (MCP) server that:
- Registers tools that AI assistants can discover and use
- Communicates via stdio (standard input/output)
- Receives tool invocation requests in JSON format
- Executes the requested PDF conversion
- Returns results back to the AI assistant
Technology Stack
- Node.js (ES Modules) - Runtime environment
- @modelcontextprotocol/sdk - MCP protocol implementation
- Playwright (Chromium) - Headless browser for PDF generation
- Marked - Markdown to HTML parser
Conversion Process
- Parse: Markdown → HTML (via Marked library)
- Style: Apply CSS (default or custom)
- Render: Load HTML in headless Chromium (via Playwright)
- Generate: Export rendered page to PDF with specified options
Why Playwright?
Playwright provides:
- True browser rendering (same as Chrome)
- Full CSS support including print media queries
- High-quality PDF generation
- Support for complex layouts, fonts, and graphics
Learn more about MCP: modelcontextprotocol.io
Development
Running Locally for Testing
If you've cloned the repository (Option 2):
node index.js
The server will start and communicate via stdio. You can test it with your MCP client.
Testing with Claude
Create a test markdown file:
echo "# Test Document\n\nThis is a **test**." > test.mdAsk Claude:
Convert test.md to test.pdfCheck the output PDF in your working directory.
Modifying the Server
- Change default CSS: Edit the
DEFAULT_CSSconstant inindex.js - Add new tools: Add to the tools array in
ListToolsRequestSchemahandler - Customize PDF options: Modify the
htmlToPdffunction - Update dependencies: Run
npm update
Contributing
Contributions are welcome! Please feel free to submit issues or pull requests on GitHub.
License
MIT
Links
- GitHub Repository: https://github.com/warrenandre/MCP_MD_TO_PDF
- Model Context Protocol: https://modelcontextprotocol.io
- Playwright: https://playwright.dev
- Marked: https://marked.js.org
Questions or Issues? Please open an issue on GitHub.
Установка Markdown To PDF Server
У этого сервера нет опубликованного пакета — он собирается из исходников. Открой репозиторий и следуй инструкции в README.
▸ github.com/warrenandre/MCP_MD_TO_PDFFAQ
Markdown To PDF Server MCP бесплатный?
Да, Markdown To PDF Server MCP бесплатный — установка в пару кликов через Unyly без оплаты.
Нужен ли API-ключ для Markdown To PDF Server?
Нет, Markdown To PDF Server работает без API-ключей и переменных окружения.
Markdown To PDF Server — hosted или self-hosted?
Self-hosted: сервер запускается локально на твоей машине командой из раздела установки.
Как установить Markdown To PDF Server в Claude Desktop, Claude Code или Cursor?
Открой Markdown To PDF Server на unyly.org, выбери вкладку своего клиента (Claude Desktop, Claude Code, Cursor) и нажми Install — конфиг сгенерируется автоматически, без правки JSON.
Похожие MCP
Playwright
Browser automation, scraping, screenshots
автор: MicrosoftPuppeteer
Browser automation and web scraping.
автор: modelcontextprotocolopentabs-dev/opentabs
Plugin-based MCP server + Chrome extension that gives AI agents access to web applications through the user's authenticated browser session. 100+ plugins with a
автор: opentabs-devrobhunter/agentdeals
1,500+ developer infrastructure deals, free tiers, and startup programs across 54 categories. Search deals, compare vendors, plan stacks, and track pricing chan
автор: robhunterCompare Markdown To PDF Server with
Не уверен что выбрать?
Найди свой стек за 60 секунд
Автор?
Embed-бейдж для README
Похожее
Все в категории browse
