mcp-pandoc
mcp-pandoc: MCP-сервер преобразования документов
Официально включен в проект с открытым исходным кодом серверов Model Context Protocol . 🎉
Обзор
Сервер Model Context Protocol для преобразования форматов документов с использованием pandoc . Этот сервер предоставляет инструменты для преобразования содержимого между различными форматами документов с сохранением форматирования и структуры.
Обратите внимание, что mcp-pandoc в настоящее время находится на ранней стадии разработки. Поддержка PDF находится в стадии разработки, а функциональность и доступные инструменты могут быть изменены и расширены по мере того, как мы продолжаем совершенствовать сервер.
Кредит: В этом проекте для преобразования документов используется пакет Pandoc Python , который является основой этого проекта.
Related MCP server: md2pdf-mcp
Демо

Продолжение следует...
Инструменты
convert-contentsПреобразует контент между поддерживаемыми форматами
Входные данные:
contents(строка): Исходное содержимое для преобразования (обязательно, если не указан input_file)input_file(строка): Полный путь к входному файлу (обязательно, если содержимое не указано)input_format(string): Исходный формат содержимого (по умолчанию markdown)output_format(string): Целевой формат (по умолчанию markdown)output_file(строка): Полный путь к выходному файлу (обязательно для форматов pdf, docx, rst, latex, epub)
Поддерживаемые форматы ввода/вывода:
уценка
html
pdf
docx
первый
латекс
epub
текст
Примечание: для расширенных форматов (pdf, docx, rst, latex, epub) требуется путь к выходному файлу.
Поддерживаемые форматы
Поддерживаемые в настоящее время форматы:
Основные форматы (прямое преобразование):
Обычный текст (.txt)
Уценка (.md)
HTML-код (.html)
Расширенные форматы (требуются полные пути к файлам):
PDF (.pdf) — требуется установка TeX Live
DOCX (.docx)
РСТ (.rst)
LaTeX (.tex)
EPUB-файл (.epub)
Примечание: для расширенных форматов:
Требуются полные пути к файлам с именем файла и расширением.
Для преобразования PDF требуется установка TeX Live (см. раздел Критические требования -> Для macOS:
brew install texlive)Если выходной путь не указан:
Базовые форматы: отображает преобразованный контент в чате.
Расширенные форматы: можно сохранять во временном каталоге системы (/tmp/ в системах Unix)
Использование и конфигурация
ПРИМЕЧАНИЕ. Обязательно завершите установку обязательных пакетов, указанных ниже в разделе «Критические требования».
Использовать опубликованный
{
"mcpServers": {
"mcp-pandoc": {
"command": "uvx",
"args": ["mcp-pandoc"]
}
}
}⚠️ Важные примечания
Критические требования
Установка Пандока
Требуется : установить
pandoc— основной механизм конвертации документов.Установка:
# macOS brew install pandoc # Ubuntu/Debian sudo apt-get install pandoc # Windows # Download installer from: https://pandoc.org/installing.htmlПроверьте :
pandoc --version
Установка УФ-пакета
Требуется : установить пакет
uv(включая командуuvx)Установка:
# macOS brew install uv # Windows/Linux pip install uvПроверьте :
uvx --version
Предварительные условия для конвертации PDF: необходимы только в том случае, если вам нужно конвертировать и сохранять PDF.
Перед попыткой конвертации PDF необходимо установить TeX Live.
Команды установки:
# Ubuntu/Debian sudo apt-get install texlive-xetex # macOS brew install texlive # Windows # Install MiKTeX or TeX Live from: # https://miktex.org/ or https://tug.org/texlive/
Требования к пути к файлу
При сохранении или конвертации файлов ОБЯЗАТЕЛЬНО указывайте полные пути к файлам, включая имя файла и расширение.
Инструмент не генерирует автоматически имена файлов и расширения.
Примеры
✅ Правильное использование:
# Converting content to PDF
"Convert this text to PDF and save as /path/to/document.pdf"
# Converting between file formats
"Convert /path/to/input.md to PDF and save as /path/to/output.pdf"❌ Неправильное использование:
# Missing filename and extension
"Save this as PDF in /documents/"
# Missing complete path
"Convert this to PDF"
# Missing extension
"Save as /documents/story"Распространенные проблемы и решения
Конвертация PDF не удалась
Ошибка: «xelatex не найден»
Решение: Сначала установите TeX Live (см. команды установки выше)
Ошибка преобразования файла
Ошибка: «Неверный путь к файлу»
Решение: Укажите полный путь, включая имя файла и расширение.
Пример:
/path/to/document.pdfвместо просто/path/to/
Не удалось преобразовать формат
Ошибка: «Неподдерживаемый формат»
Решение: Используйте только поддерживаемые форматы:
Базовые: txt, html, markdown
Расширенный: pdf, docx, rst, latex, epub
Быстрый старт
Установить
Вариант 1: Установка вручную с помощью файла конфигурации claude_desktop_config.json
На MacOS:
open ~/Library/Application\ Support/Claude/claude_desktop_config.jsonВ Windows:
%APPDATA%/Claude/claude_desktop_config.json
а) Только для локального развития и вклада в этот репозиторий
ℹ️ Замените на путь к вашему локально клонированному проекту
"mcpServers": {
"mcp-pandoc": {
"command": "uv",
"args": [
"--directory",
"<DIRECTORY>/mcp-pandoc",
"run",
"mcp-pandoc"
]
}
}б) Конфигурация опубликованных серверов — потребители должны использовать эту конфигурацию
"mcpServers": {
"mcp-pandoc": {
"command": "uvx",
"args": [
"mcp-pandoc"
]
}
}Вариант 2: Автоматическая установка конфигурации опубликованных серверов через Smithery
Выполните следующую команду bash, чтобы автоматически установить опубликованный mcp-pandoc pypi для Claude Desktop через Smithery :
npx -y @smithery/cli install mcp-pandoc --client claudeЕсли у вас возникли какие-либо проблемы, используйте «Конфигурацию опубликованных серверов» выше, а не этот cli.
Примечание : Чтобы использовать локально настроенный mcp-pandoc, выполните шаг «Конфигурация разработки/неопубликованных серверов» выше.
Разработка
Строительство и издательское дело
Чтобы подготовить пакет к распространению:
Синхронизируем зависимости и обновляем файл блокировки:
uv syncСборка дистрибутивов пакетов:
uv buildЭто создаст исходный код и дистрибутивы wheel в каталоге dist/ .
Опубликовать в PyPI:
uv publishПримечание: вам необходимо задать учетные данные PyPI с помощью переменных среды или флагов команд:
Токен:
--tokenилиUV_PUBLISH_TOKENИли имя пользователя/пароль:
--username/UV_PUBLISH_USERNAMEи--password/UV_PUBLISH_PASSWORD
Отладка
Поскольку серверы MCP работают через stdio, отладка может быть сложной. Для лучшего опыта отладки мы настоятельно рекомендуем использовать MCP Inspector .
Вы можете запустить MCP Inspector через npm с помощью этой команды:
npx @modelcontextprotocol/inspector uv --directory /Users/vivekvells/Desktop/code/ai/mcp-pandoc run mcp-pandocПосле запуска Инспектор отобразит URL-адрес, к которому вы можете перейти в своем браузере, чтобы начать отладку.
Внося вклад
Мы приветствуем вклады в улучшение mcp-pandoc! Вот как вы можете принять участие:
Сообщить о проблемах : Нашли ошибку или хотите запросить функцию? Откройте проблему на нашей странице GitHub Issues .
Отправьте запросы на извлечение : улучшите кодовую базу или добавьте функции, создав запрос на извлечение.
Available Tools
1 toolconvert-contentsA
Converts content between different formats. Transforms input content from any supported format into the specified output format.
🚨 CRITICAL REQUIREMENTS - PLEASE READ:
PDF Conversion:
You MUST install TeX Live BEFORE attempting PDF conversion:
Ubuntu/Debian:
sudo apt-get install texlive-xetexmacOS:
brew install texliveWindows: Install MiKTeX or TeX Live from https://miktex.org/ or https://tug.org/texlive/
PDF conversion will FAIL without this installation
File Paths - EXPLICIT REQUIREMENTS:
When asked to save or convert to a file, you MUST provide:
Complete directory path
Filename
File extension
Example request: 'Write a story and save as PDF'
You MUST specify: '/path/to/story.pdf' or 'C:\Documents\story.pdf'
The tool will NOT automatically generate filenames or extensions
File Location After Conversion:
After successful conversion, the tool will display the exact path where the file is saved
Look for message: 'Content successfully converted and saved to: [file_path]'
You can find your converted file at the specified location
If no path is specified, files may be saved in system temp directory (/tmp/ on Unix systems)
For better control, always provide explicit output file paths
Supported formats:
Basic (returned inline): txt, html, markdown, ipynb
Advanced (REQUIRE complete file paths): pdf, docx, rst, latex, epub, odt, pptx
pptx is WRITE-ONLY: it can be produced, but not used as an input format ✅ CORRECT Usage Examples:
'Convert this text to HTML' (basic conversion)
Tool will show converted content
'Save this text as PDF at /documents/story.pdf'
Correct: specifies path + filename + extension
Tool will show: 'Content successfully converted and saved to: /documents/story.pdf'
❌ INCORRECT Usage Examples:
'Save this as PDF in /documents/'
Missing filename and extension
'Convert to PDF'
Missing complete file path
When requesting conversion, ALWAYS specify:
The content or input file
The desired output format
For advanced formats: complete output path + filename + extension Example: 'Convert this markdown to PDF and save as /path/to/output.pdf'
🎨 DOCX, ODT & PPTX STYLING: 4. Custom Styling with Reference Documents:
Use reference_doc parameter to apply professional styling to DOCX, ODT and PPTX output
The reference document MUST match the output format: .docx for docx, .odt for odt, .pptx for pptx
Create custom templates with your branding, fonts, and formatting
Perfect for corporate reports, academic papers, and professional documents
Example: 'Convert this report to DOCX using /templates/corporate-style.docx as reference and save as /reports/Q4-report.docx'
🎯 PANDOC FILTERS (NEW FEATURE): 5. Pandoc Filter Support:
Use filters parameter to apply custom Pandoc filters during conversion
Filters are Python scripts that modify document content during processing
Perfect for Mermaid diagram conversion, custom styling, and content transformation
Example: 'Convert this markdown with mermaid diagrams to DOCX using filters=["./filters/mermaid-to-png-vibrant.py"] and save as /reports/diagram-report.docx'
📋 Creating Reference Documents:
Generate template: pandoc -o template.docx --print-default-data-file reference.docx
Customize in Word/LibreOffice: fonts, colors, headers, margins
Use for consistent branding across all documents
📋 Filter Requirements:
Filters must be executable Python scripts
Use absolute paths or paths relative to current working directory
Filters are applied in the order specified
Common filters: mermaid conversion, color processing, table formatting
📄 Defaults File Support (NEW FEATURE): 7. Pandoc Defaults File Support:
Use defaults_file parameter to specify a YAML configuration file
Similar to using pandoc -d option in the command line
Allows setting multiple options in a single file
Options in the defaults file can include filters, reference-doc, and other Pandoc options
Example: 'Convert this markdown to DOCX using defaults_file="/path/to/defaults.yaml" and save as /reports/report.docx'
Note: After conversion, always check the success message for the exact file location.
Inputs: filters, contents, input_file, output_file, +4 more.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 1 tool
There is only one tool, so there is no possibility of an agent mistaking it for another. Its purpose is clearly defined as content conversion, with no overlapping tools.
Although there is only one tool, the name 'convert-contents' follows a clear verb_noun convention and is semantically appropriate. With no other tools, there are no naming conflicts or mixed conventions.
A single tool for Pandoc conversion feels minimal, though it can cover many conversions through its parameters. It is on the thin side of the acceptable range for a focused converter server.
The tool supports conversion across a wide range of formats, including inline returns and file outputs, plus advanced options like reference documents, filters, and defaults files. For a conversion-only server, this covers the domain thoroughly with no obvious operational gaps.
Maintenance
Related MCP Connectors
Document conversion MCP server: PDF to Markdown, image OCR, spreadsheet parsing.
Document-to-Markdown MCP server — convert PDF, Office and HTML into LLM-ready Markdown.
Generate PDF, Word (.docx) and PowerPoint (.pptx) documents from Markdown over MCP.
Hosted MCP server: convert PDFs to clean, LLM-ready Markdown with tables, formulas and OCR.
Related MCP Servers
- AlicenseBqualityDmaintenanceA universal MCP server for document processing, conversion, and automation. Handle PDF, DOCX, HTML, Markdown, and more through a unified API and toolset.1328 npm140MIT
- MIT
- AlicenseAqualityDmaintenanceA secure MCP server for converting documents between Markdown, DOCX, HTML, PDF, and TXT formats within a sandboxed working directory.3MIT
- AlicenseNot gradedqualityDmaintenanceAn MCP server for converting between document formats (DOCX/PDF to Markdown and Markdown to DOCX) with academic styling support.24 PyPI1MIT