mcp-pandoc
mcp-pandoc: An MCP server for AI-driven document format conversion using Pandoc.

mcp-pandoc Solution Overview
mcp-pandoc is a versatile MCP server designed for seamless document format conversion using Pandoc. As a valuable tool within the MCP ecosystem, it empowers AI models to process and transform content between various formats, including Markdown, HTML, PDF, DOCX, and more.
This server addresses the developer need for robust document handling, enabling AI to generate reports, convert web pages, or prepare documents for different platforms. By integrating mcp-pandoc, AI models can effortlessly convert content, preserving formatting and structure.
The server utilizes the Pandoc Python package, ensuring reliable and accurate conversions. It supports both basic formats like TXT and advanced formats like EPUB, requiring a file path for the latter. mcp-pandoc enhances AI workflows by providing a standardized interface for document conversion, making it an essential asset for any AI-driven content processing application. It can be easily installed via Smithery or manual configuration.
mcp-pandoc Key Capabilities
Format Agnostic Conversion
mcp-pandoc's core function is to convert documents between various formats, including markdown, HTML, PDF, DOCX, RST, LaTeX, EPUB, and plain text. It leverages Pandoc's robust conversion capabilities to ensure that the content's structure and formatting are preserved as much as possible during the transformation. This allows AI models to process and generate content in different formats seamlessly. For example, an AI model might generate content in markdown, which can then be converted to PDF for reporting or DOCX for editing in Microsoft Word. This feature solves the problem of format incompatibility, enabling AI models to interact with a wider range of data sources and output formats. The underlying technology uses the Pandoc Python library, which interfaces with the Pandoc command-line tool.
File and Content Conversion
The server supports two primary modes of operation: converting content directly provided as a string and converting content from a specified file. This flexibility allows users to convert snippets of text or entire documents, depending on their needs. For instance, a user could provide a markdown-formatted string to the contents
parameter and specify output_format
as HTML to quickly generate an HTML preview. Alternatively, they could specify an input_file
and output_file
to convert a large document from LaTeX to EPUB. This dual functionality addresses the need for both quick, inline conversions and more extensive document processing. The server uses conditional logic to determine whether to read from the contents
parameter or the input_file
path.
Advanced Format Support
mcp-pandoc supports advanced formats like PDF, DOCX, RST, LaTeX, and EPUB, which often require specific file paths for input and output. This is crucial for maintaining the integrity and structure of these formats during conversion. For example, converting a markdown file to PDF requires specifying an output file path where the PDF will be saved. This ensures that the PDF is correctly generated and can be accessed later. This feature addresses the complexity of handling advanced formats, providing a simple and consistent interface for AI models to work with them. The server validates the presence of output_file
for advanced formats and uses Pandoc's command-line options to specify the input and output paths.
Dependency Management
To ensure proper functionality, mcp-pandoc explicitly manages its dependencies, particularly the requirement for TeX Live for PDF conversions. The documentation provides clear instructions on how to install TeX Live on different operating systems, ensuring that users can successfully perform PDF conversions. This proactive dependency management prevents common errors and ensures a smooth user experience. For example, the server checks for the presence of xelatex
(a TeX Live component) and provides an informative error message if it is missing. This feature addresses the challenge of managing external dependencies in a complex software environment. The server uses shell commands to check for the presence of TeX Live and provides installation instructions based on the operating system.