Markdownify MCP Server - UTF-8 Enhanced

local-only server

The server can only run on the client’s local machine because it depends on local resources.

Integrations

  • Provides comprehensive conversion of various file formats to Markdown, preserving formatting and structure in the conversion process

  • Converts YouTube videos to Markdown format, including extraction of video transcripts when available

Markdownify MCP 服务器 - UTF-8 增强

这是原始 Markdownify MCP 项目的增强版本,改进了 UTF-8 编码支持并优化了对多语言内容的处理。

中文詳細

增强功能

  • 添加了全面的 UTF-8 编码支持
  • 优化多语言内容处理
  • 修复 Windows 系统上的编码问题
  • 改进的错误处理机制

与原始项目的主要区别

  1. 增强编码支持:
    • 所有操作均支持完整的 UTF-8
    • 正确处理中文、日文、韩文和其他非 ASCII 字符
    • 修复了 Windows 特定的编码问题(cmd.exe 和 PowerShell 兼容性)
  2. 改进的错误处理:
    • 英文和中文的详细错误信息
    • 更好地处理网络问题异常
    • 转换失败时的优雅回退机制
  3. 扩展功能:
    • 增加了对批量处理多个文件的支持
    • 增强 YouTube 视频转录处理
    • 改进了从各种文件格式提取元数据的功能
    • 更好地保存文档格式
  4. 性能优化:
    • 优化大文件转换的内存使用情况
    • 更快地处理多语言内容
    • 减少依赖冲突
  5. 更好的开发体验:
    • 全面的调试选项
    • 详细日志系统
    • 特定于环境的配置支持
    • 清晰的中英文文档

特征

支持将各种文件类型转换为Markdown:

  • PDF 文件
  • 图像(含元数据)
  • 音频(带转录)
  • Word 文档 (DOCX)
  • Excel 电子表格 (XLSX)
  • PowerPoint 演示文稿 (PPTX)
  • 网页内容:
    • YouTube 视频文字记录
    • 搜索结果
    • 通用网页
  • 现有的 Markdown 文件

快速入门

  1. 克隆此存储库:
    git clone https://github.com/JDJR2024/markdownify-mcp-utf8.git cd markdownify-mcp-utf8
  2. 安装依赖项:
    pnpm install
    注意:这还将安装uv和相关的 Python 依赖项。
  3. 构建项目:
    pnpm run build
  4. 启动服务器:
    pnpm start

要求

  • Node.js 16.0 或更高版本
  • Python 3.8 或更高版本
  • pnpm 包管理器
  • Git

详细安装指南

1. 环境设置

  1. 安装 Node.js:
  2. 安装 pnpm:
    npm install -g pnpm pnpm --version
  3. 安装 Python:
    • Python官方网站下载
    • 确保在安装过程中将 Python 添加到 PATH
    • 验证安装: python --version
  4. (仅限 Windows)配置 UTF-8 支持:
    # Set system-wide UTF-8 setx PYTHONIOENCODING UTF-8 # Set current session UTF-8 set PYTHONIOENCODING=UTF-8 # Enable UTF-8 in command prompt chcp 65001

2. 项目设置

  1. 克隆存储库:
    git clone https://github.com/JDJR2024/markdownify-mcp-utf8.git cd markdownify-mcp-utf8
  2. 创建并激活Python虚拟环境:
    # Windows python -m venv .venv .venv\Scripts\activate # Linux/macOS python3 -m venv .venv source .venv/bin/activate
  3. 安装项目依赖项:
    # Install Node.js dependencies pnpm install # Install Python dependencies (will be handled by setup.sh) ./setup.sh
  4. 构建项目:
    pnpm run build

3.验证

  1. 启动服务器:
    pnpm start
  2. 测试安装:
    # Convert a web page python convert_utf8.py "https://example.com" # Convert a local file python convert_utf8.py "path/to/your/file.docx"

使用指南

基本用法

  1. 转换网页:
    python convert_utf8.py "https://example.com"
    转换后的 markdown 将保存为converted_result.md
  2. 转换本地文件:
    # Convert DOCX python convert_utf8.py "document.docx" # Convert PDF python convert_utf8.py "document.pdf" # Convert PowerPoint python convert_utf8.py "presentation.pptx" # Convert Excel python convert_utf8.py "spreadsheet.xlsx"
  3. 转换 YouTube 视频:
    python convert_utf8.py "https://www.youtube.com/watch?v=VIDEO_ID"

高级用法

  1. 环境变量:
    # Set custom UV path export UV_PATH="/custom/path/to/uv" # Set custom output directory export MARKDOWN_OUTPUT_DIR="/custom/output/path"
  2. 批处理:使用 URL 或文件路径创建批处理文件(例如convert_batch.txt ):
    https://example1.com https://example2.com file1.docx file2.pdf
    然后运行:
    while read -r line; do python convert_utf8.py "$line"; done < convert_batch.txt

故障排除

  1. 常见问题:
    • 如果发现编码错误,请确保正确设置 UTF-8
    • 对于 Windows 上的权限问题,请以管理员身份运行
    • 对于 Python 路径问题,请确保虚拟环境已激活
  2. 调试:
    # Enable debug output export DEBUG=true python convert_utf8.py "your_file.docx"

用法

命令行

将网页转换为 Markdown 格式:

python convert_utf8.py "https://example.com"

转换本地文件:

python convert_utf8.py "path/to/your/file.docx"

桌面应用程序集成

要将此服务器与桌面应用程序集成,请将以下内容添加到应用程序的服务器配置中:

{ "mcpServers": { "markdownify": { "command": "node", "args": [ "{ABSOLUTE_PATH}/dist/index.js" ], "env": { "UV_PATH": "/path/to/uv" } } } }

故障排除

  1. 编码问题
    • 如果遇到字符编码问题,请确保将PYTHONIOENCODING环境变量设置为utf-8
    • Windows 用户可能需要运行chcp 65001来启用 UTF-8 支持
  2. 权限问题
    • 确保您具有足够的文件读/写权限
    • 在 Windows 上,您可能需要以管理员身份运行

致谢

本项目基于 Zach Caceres 的原作。感谢原作者的杰出贡献。

执照

本项目继续遵循 MIT 许可证。详情请参阅LICENSE文件。

贡献

欢迎贡献代码!提交 Pull 请求前,请先:

  1. 确保您的代码遵循项目的编码标准
  2. 添加必要的测试和文档
  3. 更新 README 中的相关章节

接触

对于问题或建议:

  1. 提交问题: https://github.com/JDJR2024/markdownify-mcp-utf8/issues
  2. 创建拉取请求: https://github.com/JDJR2024/markdownify-mcp-utf8/pulls
  3. 邮箱: jdidndosmmxmx@gmail.com
ID: 51hyoj300s