
Mcp Document Converter
io.github.xt765由 GitHub 帳號 xt765 發布v0.2.2更新於 Oct 24, 2026
Convert PDF, DOCX, HTML, Markdown, and Text for AI assistant context injection.
概覽
一個本機 MCP 伺服器,可在 Markdown、HTML、DOCX、PDF 與純文字之間轉換文件,方便助理讀取或產生這些格式。
- 可以做什麼
- 轉換文件:在格式之間轉換,可指定來源路徑、輸出路徑、目標格式、CSS、範本與中繼資料選項,未指定來源格式時依副檔名自動辨識。查詢格式支援:列出支援的格式、檢視完整轉換矩陣、檢查某組來源格式到目標格式是否可行,以及取得單一格式的詳細資訊。輸出可包含程式碼語法高亮、自訂 CSS 樣式,並保留標題、作者與建立時間等中繼資料。
- 適用情境
- 當助理需要把 PDF、Word 檔案、HTML 頁面或 Markdown 筆記轉成其他格式以便注入上下文,或從 Markdown 產生帶樣式的 HTML 或 PDF 時適用。文件格式轉換是工作流程中常見環節時值得加入。
- 執行需求
- 以本機程序在使用者機器上執行,可從 PyPI 安裝(pip install mcp-document-converter)或以 uvx 啟動;README 也提供從 Git 儲存庫執行的方式。需要 Python 及所列相依套件,PDF 輸出依賴 WeasyPrint。未宣告驗證、API 金鑰或請求標頭。選用環境變數 MCP_CONVERTER_LOG_LEVEL 與 MCP_CONVERTER_TEMP_DIR 可控制日誌等級與暫存目錄。
安裝
在 SourceWeft 中
- 開啟 儀表板中的 Mcp Document Converter,將其新增到工作區。
- 為需要使用其工具的對話啟用該服務。
Desktop only,透過 STDIO。 STDIO 服務會啟動本機處理程序,因此需要 SourceWeft 桌面主機。
其他 MCP 客戶端
參照 儲存庫 中的啟動說明。
README
MCP Document Converter
MCP (Model Context Protocol) Document Converter - A powerful MCP tool for converting documents between multiple formats, enabling AI agents to easily transform documents.
[License] [Python] [PyPI Version] [PyPI Downloads] [MCP Registry] [MCP Marketplace]
Features
- Multi-format Support: Supports 5 mainstream document formats: Markdown, HTML, DOCX, PDF, and Text
- Bidirectional Conversion: Any format can be converted to any other format (5×5=25 conversion combinations)
- MCP Protocol: Compliant with MCP standards, can be used as a tool for AI assistants like Trae IDE
- Plugin Architecture: Easy to extend with new parsers and renderers
- Syntax Highlighting: HTML and PDF outputs support code syntax highlighting
- Style Customization: Support for custom CSS styles
- Metadata Preservation: Preserves document title, author, creation time, and other metadata during conversion
📚 Documentation
User Guide · API Reference · Contributing · Changelog · License
Architecture
Core Components
- DocumentIR (Intermediate Representation): Unified abstraction for all documents, containing document tree, metadata, assets, etc.
- BaseParser (Parser Base Class): Defines the parser interface, parses various formats into DocumentIR
- BaseRenderer (Renderer Base Class): Defines the renderer interface, renders DocumentIR into various formats
- ConverterRegistry (Registry): Manages all parsers and renderers, provides format lookup and auto-matching
- DocumentConverter (Conversion Engine): Coordinates parsers and renderers to complete document conversion
Supported Formats
Input Formats (Parsers)
Output Formats (Renderers)
Conversion Matrix
Installation
Using pip (Recommended)
From Source
MCP Tools
This server provides the following tools:
convert_document
Convert a document from one format to another.
Arguments:
source_path(string, required): Path to the source document.target_format(string, required): Target format (html,pdf,markdown,docx,text).output_path(string, optional): Path for the output file.source_format(string, optional): Format of the source file (auto-detected if not provided).options(object, optional): Additional options liketemplate,css, andpreserve_metadata.
Configuration
Using in Trae IDE / Claude Desktop
Add the following to your MCP configuration file:
Option 1: Using PyPI (Recommended)
Option 2: Using GitHub repository
Option 3: Using Gitee repository (Faster access in China)
Option 4: Using pip (Manual installation)
First install the package:
Then add to configuration:
Using in Cherry Studio
Cherry Studio is a powerful open-source desktop AI client assistant that supports integrating various tools through the MCP protocol
Configuration Example:
Usage Example:
Usage
As an MCP Tool
After configuration, AI assistants can directly call the following tools:
1. convert_document (Recommended)
Use a unified interface to convert any supported document type.
2. list_supported_formats
List all supported document formats.
3. get_conversion_matrix
Get the complete format conversion matrix.
4. can_convert
Check if conversion from source format to target format is supported.
5. get_format_info
Get detailed information about a specific format.
As a Python Library
Tool Interface Details
convert_document
Convert a document from one format to another.
Parameters:
Options:
Example:
Extension Development
Adding a New Parser
Adding a New Renderer
Registering Extensions
Testing
Environment Variables
Dependencies
Core Dependencies
mcp>= 1.26.0 - MCP protocol implementationpydantic>= 2.12.5 - Data validation
Parser Dependencies
markdown>= 3.5.0 - Markdown parsingbeautifulsoup4>= 4.12.0 - HTML parsingpython-docx>= 1.1.0 - DOCX parsingpypdf>= 6.7.4 - PDF parsingchardet>= 5.0.0 - Encoding detectionpyyaml>= 6.0.0 - YAML parsing
Renderer Dependencies
weasyprint>= 60.0 - PDF renderingpygments>= 2.17.0 - Code highlightingjinja2>= 3.1.6 - Template enginereportlab>= 4.0.0 - PDF generation
Development Dependencies
pytest>= 7.0.0 - Testing frameworkpytest-asyncio>= 0.21.0 - Async testing supportpytest-cov>= 4.0.0 - Coverage reportingbasedpyright>= 1.0.0 - Type checkingruff>= 0.1.0 - Linting and formatting
License
MIT License
Contributing
Issues and Pull Requests are welcome!
Related Projects
- MCP Document Reader - MCP document reader supporting multiple document formats
- Model Context Protocol - Official Model Context Protocol documentation
來源:README.md,提交 2b57af4
工具
0版本歷史
1- v0.2.2最新Sep 16, 2026
評分
已滿足適用檢查項的 50%
該評分衡量此收錄條目的完整程度,依據註冊中心條目、端點與公開來源計算得出。它不是對伺服器本身的評價,也不表示伺服器安全或目前可用:可連通性是帶日期的檢查結果,評分也不包含安裝量或使用者評價。
- 近 30 天內可連通25 分
請保持端點能夠回應 MCP 握手;SourceWeft 每 30 天探測一次。
- 已宣告認證方式10 分
請在註冊中心條目中宣告憑證請求標頭,或保持端點能夠回應探測,以便判定其認證方式。
- 已列出工具15 分
請讓伺服器在無憑證時回應 tools/list,或發布可在沙箱中無憑證啟動的軟體包。
- 描述必需15 分
- 圖示10 分
- 文件15 分
- 授權條款10 分
