Markdown to PDF MCP Server
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., "@Markdown to PDF MCP ServerConvert README.md to 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.
Markdown to PDF MCP Server
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.
Related MCP server: Gen-PDF MCP 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_PDFStep 2: Install Dependencies
npm installStep 3: Install Playwright
Playwright needs to download Chromium (first time only):
npx playwright install chromiumStep 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.pdfHow to Use
Once configured, simply ask Claude to convert markdown to PDF using natural language:
Basic Conversion
Convert document.md to document.pdfCustom Page Format
Convert report.md to report.pdf using Letter format in landscape modeWith 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.pdfGet Default Styling
Show me the default CSS for PDF generationMCP 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.pdf2. 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.pdf3. 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 generationDefault 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 locationRestart 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 chromiumThis 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 CSSTest with custom CSS to override defaults
Enable
printBackground: truefor colors and backgroundsTry 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.jsThe 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.jsAdd new tools: Add to the tools array in
ListToolsRequestSchemahandlerCustomize PDF options: Modify the
htmlToPdffunctionUpdate 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.
This server cannot be installed
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Latest Blog Posts
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/warrenandre/MCP_MD_TO_PDF'
If you have feedback or need assistance with the MCP directory API, please join our Discord server