Overview
Document conversion between formats (Markdown, PDF, DOCX, HTML, LaTeX, and more).
Setup
Run with npx:
npx -y @modelcontextprotocol/server-pandocConfiguration
Added to claude_desktop_config.jsonDocumentation
Pandoc MCP
Overview
Pandoc MCP is a Model Context Protocol server that provides document conversion capabilities powered by Pandoc, the universal document converter. Pandoc can convert between dozens of markup formats, making it an essential tool for AI agents that need to work with documents in various formats.
With support for Markdown, HTML, PDF, DOCX, LaTeX, ODT, EPUB, and many more formats, Pandoc MCP enables AI agents to read, convert, and generate documents across different formats seamlessly.
Features
- Universal Conversion: Convert between 40+ document formats
- Markdown Support: Multiple Markdown flavors (CommonMark, GitHub, Pandoc, etc.)
- PDF Generation: Convert to PDF via LaTeX or HTML
- DOCX Support: Read and write Microsoft Word documents
- HTML Conversion: Convert to/from clean HTML
- LaTeX Support: Full LaTeX document processing
- EPUB Support: Create and convert e-books
- Custom Templates: Use custom conversion templates
Installation
npx -y @modelcontextprotocol/server-pandoc
Configuration
Add to your claude_desktop_config.json:
{
"mcpServers": {
"pandoc": {
"command": "npx",
"args": ["-y", "@modelcontextprotocol/server-pandoc"]
}
}
}
Prerequisites
Pandoc MCP requires Pandoc to be installed on your system:
# macOS
brew install pandoc
# Ubuntu/Debian
sudo apt install pandoc
# Windows
# Download from https://pandoc.org/installing.html
# Also install LaTeX for PDF generation (optional)
# macOS
brew install --cask mactex-no-gui
# Ubuntu/Debian
sudo apt install texlive-latex-base
Available Tools
| Tool | Description |
|---|---|
convert | Convert a document from one format to another |
to_markdown | Convert any format to Markdown |
to_html | Convert any format to HTML |
to_pdf | Convert any format to PDF |
to_docx | Convert any format to DOCX |
to_latex | Convert any format to LaTeX |
to_epub | Convert any format to EPUB |
list_formats | List supported input/output formats |
Usage Examples
Convert Markdown to PDF
# Convert a Markdown file to PDF
result = to_pdf(
input_file="article.md",
output_file="article.pdf",
options={
"metadata": {
"title": "My Article",
"author": "John Doe",
},
"toc": True, # Include table of contents
}
)
print(f"Converted to PDF: {result.output_file}")
Convert DOCX to Markdown
# Convert a Word document to Markdown
result = to_markdown(
input_file="document.docx",
output_file="document.md",
)
print(result.content)
Convert HTML to PDF
# Convert HTML to PDF with custom CSS
result = to_pdf(
input_file="report.html",
output_file="report.pdf",
options={
"css": "styles/print.css",
"metadata": {
"title": "Monthly Report",
}
}
)
Batch Conversion
# Convert multiple files
files = ["chapter1.md", "chapter2.md", "chapter3.md"]
for file in files:
to_pdf(
input_file=file,
output_file=file.replace(".md", ".pdf"),
)
print(f"Converted {file}")
Create EPUB from Markdown
# Create an e-book
result = to_epub(
input_file="book.md",
output_file="book.epub",
options={
"metadata": {
"title": "My Book",
"author": "John Doe",
"language": "en",
},
"toc": True,
"epub_chapters": True,
}
)
Convert with Custom Template
# Use a custom LaTeX template for PDF
result = to_pdf(
input_file="document.md",
output_file="document.pdf",
options={
"template": "custom-template.tex",
"metadata": {
"title": "Custom Styled Document",
}
}
)
Supported Formats
Input Formats
- Markdown (CommonMark, GitHub, Pandoc)
- HTML
- DOCX
- ODT
- LaTeX
- RTF
- EPUB
- Textile
- MediaWiki
- and 30+ more
Output Formats
- Markdown
- HTML
- PDF (via LaTeX or HTML)
- DOCX
- ODT
- LaTeX
- EPUB
- RTF
- and 30+ more
Pros
- ✅ Universal Converter: 40+ format support
- ✅ High Quality: Well-maintained, battle-tested tool
- ✅ Open Source: Free and actively developed
- ✅ Customizable: Templates, metadata, options
- ✅ CLI and Library: Both command-line and programmatic use
- ✅ Cross-Platform: Works on macOS, Linux, Windows
Cons
- ❌ Pandoc Required: Must install Pandoc separately
- ❌ LaTeX for PDF: PDF generation requires LaTeX installation
- ❌ Complex Conversions: Some format conversions may lose formatting
- ❌ Learning Curve: Many options and parameters
When to Use
Use Pandoc MCP when:
- You need to convert documents between formats
- You want to generate PDFs from Markdown
- You need to read documents in various formats
- You're creating e-books or publications
- You need batch document conversion
Avoid Pandoc MCP when:
- You only work with one format
- You need perfect formatting preservation (complex documents)
- You can't install Pandoc on your system
