io.github.wmarceau/md-to-pdf
Converts markdown files into professional PDF documents with automatic table of contents and interactive navigation.
README
Markdown to PDF Converter
Convert markdown (.md) files into professional, interactive PDF documents with automatic table of contents.
mcp-name: io.github.wmarceau/md-to-pdf
Features
- Automatic Table of Contents - Generated from markdown headers
- Interactive Navigation - Clickable TOC links to sections
- Professional Styling - Clean, readable PDF output
- Code Block Support - Syntax highlighting preserved
- Table Support - Markdown tables convert to PDF tables
- Image Support - Embedded images in PDFs
- Batch Conversion - Process multiple files at once
- MCP Integration - Use as an MCP server for AI assistants
Use Cases
- Convert documentation to shareable PDFs
- Create professional reports from markdown
- Generate user manuals with navigation
- Archive markdown content in PDF format
- Prepare presentations or handouts
- AI-powered document generation workflows
Project Structure
md-to-pdf/
├── src/
│ ├── md_to_pdf.py # Core conversion logic
│ └── convert.sh # Wrapper script (sets library paths)
├── mcp-server/
│ └── md_to_pdf_mcp.py # MCP server wrapper
├── registry/
│ └── manifest.json # MCP Registry manifest
├── workflows/
│ └── convert-md-to-pdf.md # Conversion workflow guide
├── testing/ # Multi-agent test infrastructure
├── VERSION # Current version
├── CHANGELOG.md # Version history
├── SKILL.md # MCP skill documentation
└── README.md # This file
Requirements
- Python 3.8+
- markdown2 (markdown parsing)
- weasyprint (PDF generation)
- pygments (code syntax highlighting)
- mcp (MCP server - for MCP mode only)
macOS Additional Requirements
brew install pango cairo
Quick Start
CLI Usage
# Set library path (macOS)
export DYLD_LIBRARY_PATH=/opt/homebrew/lib:$DYLD_LIBRARY_PATH
# Convert single file
python src/md_to_pdf.py input.md output.pdf
# Using wrapper script
./src/convert.sh input.md output.pdf
# Batch convert
python src/md_to_pdf.py "docs/*.md" --output-dir pdfs/
# With custom styling
python src/md_to_pdf.py input.md output.pdf --css custom.css
# Without table of contents
python src/md_to_pdf.py input.md output.pdf --no-toc
MCP Server Usage
# Install MCP SDK
pip install mcp
# Run MCP server
python mcp-server/md_to_pdf_mcp.py
MCP Tools
| Tool | Description |
|---|---|
convert_markdown_to_pdf |
Convert markdown to PDF with optional TOC |
extract_toc |
Extract table of contents structure |
get_default_styles |
Get default CSS for customization |
See SKILL.md for detailed MCP tool documentation.
Version
Current version: 1.0.0
License
MIT License
Recommended Servers
playwright-mcp
A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.
Magic Component Platform (MCP)
An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.
Audiense Insights MCP Server
Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.
VeyraX MCP
Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.
graphlit-mcp-server
The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.
Kagi MCP Server
An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.
E2B
Using MCP to run code via e2b.
Neon Database
MCP server for interacting with Neon Management API and databases
Exa Search
A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.
Qdrant Server
This repository is an example of how to create a MCP server for Qdrant, a vector search engine.