Markdownify MCP 服务器 - UTF-8 增强
这是原始 Markdownify MCP 项目的增强版本,改进了 UTF-8 编码支持并优化了对多语言内容的处理。
增强功能
添加了全面的 UTF-8 编码支持
优化多语言内容处理
修复 Windows 系统上的编码问题
改进的错误处理机制
与原始项目的主要区别
增强编码支持:
所有操作均支持完整的 UTF-8
正确处理中文、日文、韩文和其他非 ASCII 字符
修复了 Windows 特定的编码问题(cmd.exe 和 PowerShell 兼容性)
改进的错误处理:
英文和中文的详细错误信息
更好地处理网络问题异常
转换失败时的优雅回退机制
扩展功能:
增加了对批量处理多个文件的支持
增强 YouTube 视频转录处理
改进了从各种文件格式提取元数据的功能
更好地保存文档格式
性能优化:
优化大文件转换的内存使用情况
更快地处理多语言内容
减少依赖冲突
更好的开发体验:
全面的调试选项
详细日志系统
特定于环境的配置支持
清晰的中英文文档
特征
支持将各种文件类型转换为Markdown:
PDF 文件
图像(含元数据)
音频(带转录)
Word 文档 (DOCX)
Excel 电子表格 (XLSX)
PowerPoint 演示文稿 (PPTX)
网页内容:
YouTube 视频文字记录
搜索结果
通用网页
现有的 Markdown 文件
快速入门
克隆此存储库:
git clone https://github.com/JDJR2024/markdownify-mcp-utf8.git cd markdownify-mcp-utf8安装依赖项:
pnpm install注意:这还将安装
uv
和相关的 Python 依赖项。构建项目:
pnpm run build启动服务器:
pnpm start
要求
Node.js 16.0 或更高版本
Python 3.8 或更高版本
pnpm 包管理器
Git
详细安装指南
1. 环境设置
安装 Node.js:
从Node.js 官方网站下载
验证安装:
node --version
安装 pnpm:
npm install -g pnpm pnpm --version安装 Python:
从Python官方网站下载
确保在安装过程中将 Python 添加到 PATH
验证安装:
python --version
(仅限 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. 项目设置
克隆存储库:
git clone https://github.com/JDJR2024/markdownify-mcp-utf8.git cd markdownify-mcp-utf8创建并激活Python虚拟环境:
# Windows python -m venv .venv .venv\Scripts\activate # Linux/macOS python3 -m venv .venv source .venv/bin/activate安装项目依赖项:
# Install Node.js dependencies pnpm install # Install Python dependencies (will be handled by setup.sh) ./setup.sh构建项目:
pnpm run build
3.验证
启动服务器:
pnpm start测试安装:
# Convert a web page python convert_utf8.py "https://example.com" # Convert a local file python convert_utf8.py "path/to/your/file.docx"
使用指南
基本用法
转换网页:
python convert_utf8.py "https://example.com"转换后的 markdown 将保存为
converted_result.md
转换本地文件:
# 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"转换 YouTube 视频:
python convert_utf8.py "https://www.youtube.com/watch?v=VIDEO_ID"
高级用法
环境变量:
# Set custom UV path export UV_PATH="/custom/path/to/uv" # Set custom output directory export MARKDOWN_OUTPUT_DIR="/custom/output/path"批处理:使用 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
故障排除
常见问题:
如果发现编码错误,请确保正确设置 UTF-8
对于 Windows 上的权限问题,请以管理员身份运行
对于 Python 路径问题,请确保虚拟环境已激活
调试:
# Enable debug output export DEBUG=true python convert_utf8.py "your_file.docx"
用法
命令行
将网页转换为 Markdown 格式:
转换本地文件:
桌面应用程序集成
要将此服务器与桌面应用程序集成,请将以下内容添加到应用程序的服务器配置中:
故障排除
编码问题
如果遇到字符编码问题,请确保将
PYTHONIOENCODING
环境变量设置为utf-8
Windows 用户可能需要运行
chcp 65001
来启用 UTF-8 支持
权限问题
确保您具有足够的文件读/写权限
在 Windows 上,您可能需要以管理员身份运行
致谢
本项目基于 Zach Caceres 的原作。感谢原作者的杰出贡献。
执照
本项目继续遵循 MIT 许可证。详情请参阅LICENSE文件。
贡献
欢迎贡献代码!提交 Pull 请求前,请先:
确保您的代码遵循项目的编码标准
添加必要的测试和文档
更新 README 中的相关章节
接触
对于问题或建议:
hybrid server
The server is able to function both locally and remotely, depending on the configuration or use case.
Tools
文档转换服务器,可将各种文件格式(PDF、文档、图像、音频、网络内容)转换为 Markdown,并改进多语言和 UTF-8 支持。
Related Resources
Related MCP Servers
- AsecurityAlicenseAqualityConverts various file types and web content to Markdown format. It provides a set of tools to transform PDFs, images, audio files, web pages, and more into easily readable and shareable Markdown text.Last updated -1072,163MIT License
Skrape MCP Serverofficial
AsecurityAlicenseAqualityThis server converts webpages into clean, structured Markdown optimized for language model consumption, removing unnecessary content and supporting JavaScript rendering.Last updated -12MIT License- AsecurityFlicenseAqualityA server that converts various file formats (PDF, images, Office documents, etc.) to Markdown descriptions using Cloudflare AI services.Last updated -1434
- -securityFlicense-qualityConverts various file types (documents, images, audio, web content) to markdown format without requiring Docker, supporting PDF, Word, Excel, PowerPoint, images, audio files, web URLs, and more.Last updated -2229