mcp-pandoc: A Document Conversion MCP Server
使用pandoc进行文档格式转换的MCP Server。
mcp-pandoc 快速开始指南
概述
mcp-pandoc 是一个基于 Model Context Protocol 的文档格式转换服务器,使用 pandoc 引擎在不同文档格式之间转换内容,同时保留格式和结构。
支持的格式
- 基本格式:纯文本 (.txt)、Markdown (.md)、HTML (.html)
- 高级格式:PDF (.pdf)、DOCX (.docx)、RST (.rst)、LaTeX (.tex)、EPUB (.epub)
注意:PDF 转换需要安装 TeX Live
安装
方法 1:通过 Smithery 自动安装
npx -y @smithery/cli install mcp-pandoc --client claude
方法 2:手动配置
编辑 Claude Desktop 配置文件:
- MacOS:
~/Library/Application Support/Claude/claude_desktop_config.json
- Windows:
%APPDATA%/Claude/claude_desktop_config.json
添加以下配置:
{
"mcpServers": {
"mcp-pandoc": {
"command": "uvx",
"args": ["mcp-pandoc"]
}
}
}
前置条件
对于 PDF 转换,必须安装 TeX Live:
# Ubuntu/Debian
sudo apt-get install texlive-xetex
# macOS
brew install texlive
# Windows
# 安装 MiKTeX 或 TeX Live: https://miktex.org/ 或 https://tug.org/texlive/
使用示例
转换内容到不同格式
Convert this markdown text to HTML:
# Hello World
This is a test.
保存到文件(高级格式需要)
Convert this text to PDF and save as /path/to/document.pdf
在文件之间转换
Convert /path/to/input.md to DOCX and save as /path/to/output.docx
注意事项
- 高级格式(PDF, DOCX等)需要提供完整的文件路径(包括文件名和扩展名)
- 未指定输出路径时,基本格式会在聊天中显示,高级格式会保存到临时目录
- PDF 转换必须预先安装 TeX Live
更多详情和演示,请访问 GitHub 仓库。