Huoshui Pdf Converter

io.github.huoshuiai42由 GitHub 帳號 huoshuiai42 發布v1.0.0更新於 Oct 24, 2026

An MCP server that provides PDF file conversion

已驗證STDIO僅桌面效率與工作流檔案與儲存

概覽

AI 產生的概覽

一個本機 MCP 伺服器,可將 PDF 檔轉為 Markdown,也可將 Markdown 轉為 PDF,支援 Unicode 與中日韓字元。

可以做什麼
將 PDF 檔轉為 Markdown,可選擇擷取圖片並保留版面格式,結果寫入指定的輸出路徑。將 Markdown 檔轉為 PDF,可設定頁面尺寸、邊界與字級,並自動選擇轉換引擎。列出支援的格式與轉換引擎。在轉換前驗證輸入檔案。
適用情境
適合需要把 PDF 文件轉成可編輯 Markdown 文字,或把 Markdown 筆記、報告產生成 PDF 的情境,尤其是含中文、日文或韓文的內容。它在使用者電腦上本機執行,適合檔案留在自己裝置上的桌面環境。
執行需求
以本機程序在使用者電腦上執行(僅桌面端),從 PyPI 套件 huoshui-pdf-converter 安裝,例如透過 uvx 或 python -m 啟動。需要具備相依套件的 Python 環境;未宣告帳號、API 金鑰或環境變數。輸出中日韓文字需要系統已安裝對應的 Unicode 字型。
安裝前請注意
轉換工具會讀取輸入檔案並寫入助理指定的輸出路徑,應只指向預期位置。未顯示需要憑證、付費或向第三方傳送資料。輸出品質取決於系統已安裝字型,README 提到匯入錯誤時可能需要安裝額外相依套件。

安裝

在 SourceWeft 中

  1. 開啟 儀表板中的 Huoshui Pdf Converter,將其新增到工作區。
  2. 為需要使用其工具的對話啟用該服務。

Desktop only,透過 STDIO。 STDIO 服務會啟動本機處理程序,因此需要 SourceWeft 桌面主機。

其他 MCP 客戶端

參照 儲存庫 中的啟動說明。

README

活水 PDF 转换器 (Huoshui PDF Converter)

[License: MIT] [Python 3.10+] [MCP] [PyPI version]

A high-quality, cross-platform PDF ↔ Markdown converter implemented as an MCP (Model Context Protocol) server. Supports bidirectional conversion with full Unicode/CJK character support.

Features

Core Capabilities

  • PDF → Markdown: Extract text and images with layout preservation
  • Markdown → PDF: Generate beautiful PDFs with multiple rendering engines
  • Unicode Support: Full support for Chinese, Japanese, Korean, and other Unicode characters
  • Cross-Platform: Works on Windows, macOS, and Linux
  • MCP Integration: Use with Claude Desktop or any MCP-compatible client

Technical Features

  • Pure Python: No external system dependencies required
  • Automatic Font Detection: Finds and uses system Unicode fonts
  • Smart Engine Selection: Automatically switches engines based on content
  • Comprehensive Error Handling: Graceful degradation and detailed logging
  • Async Architecture: Non-blocking operations for better performance

Installation

From MCP Registry (Recommended)

This server is available in the Model Context Protocol Registry. Install it using your MCP client.

mcp-name: io.github.huoshuiai42/huoshui-pdf-converter

As a Python Package

bash
pip install huoshui-pdf-converter

Or using uv (recommended):

bash
uv pip install huoshui-pdf-converter

As an MCP Server

Add to your Claude Desktop configuration:

macOS: ~/Library/Application Support/Claude/claude_desktop_config.json Windows: %APPDATA%\Claude\claude_desktop_config.json Linux: ~/.config/Claude/claude_desktop_config.json

json
{  "mcpServers": {    "huoshui-pdf-converter": {      "command": "uvx",      "args": ["huoshui-pdf-converter"],      "env": {}    }  }}

Or if you prefer to use a specific Python environment:

json
{  "mcpServers": {    "huoshui-pdf-converter": {      "command": "python",      "args": ["-m", "huoshui_pdf_converter.server"],      "env": {}    }  }}

Usage

Command Line Interface

bash
# Convert PDF to Markdownhuoshui-pdf pdf-to-md input.pdf output.md
# Convert Markdown to PDFhuoshui-pdf md-to-pdf input.md output.pdf
# With optionshuoshui-pdf md-to-pdf input.md output.pdf --page-size A4 --margin 2cm --font-size 12

As a Python Library

python
import asynciofrom huoshui_pdf_converter import PDFToMarkdownConverter, MarkdownToPDFConverter
async def main():    # PDF to Markdown    pdf_converter = PDFToMarkdownConverter()    result = await pdf_converter.convert(        pdf_path="input.pdf",        output_path="output.md",        extract_images=True,        preserve_formatting=True    )
    # Markdown to PDF    md_converter = MarkdownToPDFConverter()    result = await md_converter.convert(        markdown_path="input.md",        output_path="output.pdf",        page_size="A4",        margin="2cm",        font_size=12    )
asyncio.run(main())

MCP Tools

When used as an MCP server, the following tools are available:

  1. pdf_to_markdown: Convert PDF files to Markdown

    json
    {  "pdf_path": "path/to/input.pdf",  "output_path": "path/to/output.md",  "extract_images": true,  "preserve_formatting": true}
  2. markdown_to_pdf: Convert Markdown files to PDF

    json
    {  "markdown_path": "path/to/input.md",  "output_path": "path/to/output.pdf",  "page_size": "A4",  "margin": "2cm",  "font_size": 12}
  3. list_supported_formats: Get supported formats and engines

  4. validate_file: Validate input files before conversion

Supported Formats

Input Formats

  • PDF: All standard PDF files (PDF 1.0 - 1.7)
  • Markdown: CommonMark and GitHub Flavored Markdown

Output Options

  • Page Sizes: A4, A3, Letter, Legal
  • Margins: Customizable (e.g., "1cm", "0.5in")
  • Font Sizes: Any size in points
  • Images: PNG, JPEG extraction from PDFs

Unicode and Font Support

The converter automatically detects and uses appropriate fonts for different languages:

  • macOS: Arial Unicode, PingFang SC, STHeiti
  • Windows: Microsoft YaHei, SimSun, Arial Unicode MS
  • Linux: Noto Sans CJK, Source Han Sans, WenQuanYi

Architecture

Conversion Engines

PDF → Markdown

  • PyMuPDF (MuPDF): High-quality text and image extraction

Markdown → PDF

  • ReportLab: Best Unicode support, cross-platform compatibility
  • xhtml2pdf: Good HTML/CSS rendering (fallback)
  • fpdf2: Basic PDF generation (last resort)

Engine Selection Logic

  1. Detects CJK characters → Uses ReportLab
  2. Complex formatting → Uses xhtml2pdf
  3. Basic documents → Uses any available engine

Development

Setup Development Environment

bash
# Clone the repositorygit clone https://github.com/yourusername/huoshui-pdf-converter.gitcd huoshui-pdf-converter
# Install dependenciesuv pip install -e ".[dev]"
# Run testspython test_converter.py

Project Structure

huoshui-pdf-converter/├── huoshui_pdf_converter/│   ├── __init__.py│   ├── server.py           # MCP server implementation│   ├── pdf_converter.py    # PDF to Markdown converter│   └── markdown_converter.py # Markdown to PDF converter├── pyproject.toml├── README.md├── LICENSE└── test_converter.py

Troubleshooting

Common Issues

  1. Chinese characters not displaying:

    • Ensure Arial Unicode or similar fonts are installed
    • The converter will automatically detect and use appropriate fonts
  2. Import errors:

    • Install all dependencies: pip install huoshui-pdf-converter[all]
  3. MCP connection issues:

    • Check Claude Desktop logs
    • Ensure Python is in your PATH

Logging

Enable debug logging:

python
import logginglogging.basicConfig(level=logging.DEBUG)

Contributing

Contributions are welcome! Please:

  1. Fork the repository
  2. Create a feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes (git commit -m 'Add amazing feature')
  4. Push to the branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

License

This project is licensed under the MIT License - see the LICENSE file for details.

Acknowledgments

  • Built with FastMCP for Model Context Protocol support
  • Uses PyMuPDF for PDF parsing
  • Uses ReportLab for PDF generation
  • Inspired by the need for better PDF ↔ Markdown conversion tools

Support

來源:README.md,提交 ab5f444

工具

0
SourceWeft 尚未在沙箱中啟動過該軟體包,因此其工具未知。

版本歷史

1
  1. v1.0.0最新Sep 16, 2026

評分

已滿足適用檢查項的 50%

該評分衡量此收錄條目的完整程度,依據註冊中心條目、端點與公開來源計算得出。它不是對伺服器本身的評價,也不表示伺服器安全或目前可用:可連通性是帶日期的檢查結果,評分也不包含安裝量或使用者評價。

  • 近 30 天內可連通25 分

    請保持端點能夠回應 MCP 握手;SourceWeft 每 30 天探測一次。

  • 已宣告認證方式10 分

    請在註冊中心條目中宣告憑證請求標頭,或保持端點能夠回應探測,以便判定其認證方式。

  • 已列出工具15 分

    請讓伺服器在無憑證時回應 tools/list,或發布可在沙箱中無憑證啟動的軟體包。

  • 描述必需15 分
  • 圖示10 分
  • 文件15 分
  • 授權條款10 分