Skip to main content

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

Metadata

Release files for md-to-pdf-mcp 1.0.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for md-to-pdf-mcp 1.0.2
File Size Uploaded
md_to_pdf_mcp-1.0.2.tar.gz 524.0 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for md-to-pdf-mcp 1.0.2
File Interpreter ABI Platform
md_to_pdf_mcp-1.0.2-py3-none-any.whl Python 3 none any Details

Total release size: 531.7 kB

Release files / md_to_pdf_mcp-1.0.2.tar.gz

Download URL md_to_pdf_mcp-1.0.2.tar.gz
Size 524.0 kB
Tags Source
SHA-256 checksum
How to use checksums
67bbe58beb3b65c18880cb2fdd46ee3350c9056c7a0c3c63ac1a917a2410c205
BLAKE2b-256 checksum
How to use checksums
8bec39365459fd4ed7df803f089a0bce26b3adcab489139ed53643262ac55fc1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.5

Release files / md_to_pdf_mcp-1.0.2-py3-none-any.whl

Download URL md_to_pdf_mcp-1.0.2-py3-none-any.whl
Size 7.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
5da5e7bb09529f2ab94ef35e0dbd1393fd0c14b1c050677557e1df347d03a13e
BLAKE2b-256 checksum
How to use checksums
1b841b06b55a8c6703c659779a6652579548600211024171f127bc11e6730c59
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.5

Release history Release notifications | RSS feed

This release

1.0.2 This release

2 release files

1.0.1

2 release files

1.0.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page