Back to MCP directory
publicPublicdnsLocal runtime

file-converter-mcp

一个基于MCP协议的文件格式转换服务,支持多种文档和图片格式的相互转换

article

README

🚀 文件转换器

这是一个功能强大的文件转换工具,支持多种文件格式之间的相互转换。它能为用户提供高效、可靠的文件处理解决方案。

🚀 快速开始

本文件转换器支持多种文件格式之间的相互转换,为你提供高效、可靠的文件处理解决方案。

✨ 主要特性

多格式支持

工具支持以下主要功能:

  • 文档转换:Word、PDF、HTML/Markdown 互转。
  • 数据导出:将 CSV 文件导出为其他格式。

灵活的输入方式

用户可以选择两种方式提供文件:

  1. 路径输入

    @文件转换器
    docx2pdf
    input_file: file.docx
    
  2. 内容输入(Base64)

    @文件转换器
    docx2pdf_content
    file_content_base64: 含有文件内容的Base64字符串
    

高效处理流程

  1. 文件解析:自动识别文件格式。
  2. 内容转换:使用合适工具进行格式转换。
  3. 结果输出:返回 Base64 编码的转换后文件。

错误处理

  • 输入验证:确保文件路径和内容有效。
  • 异常捕捉:记录详细错误信息,便于排查问题。
  • 恢复机制:处理失败时自动清理临时文件。

高可用性设计

  • 容错机制:采用多线程处理任务,防止系统崩溃。
  • 负载均衡:支持高并发请求,保证服务稳定。

📦 安装指南

通过 Git 克隆仓库

git clone https://github.com/wowyuarm/file-converter-mcp.git
cd file-converter-mcp

依赖管理

项目使用 poetry 管理依赖,推荐安装最新版本:

curl -L https://get-poetry.py | python
poetry install

💻 使用示例

基础用法

  1. 启动服务

    poetry run start
    
  2. 使用工具

    @文件转换器
    工具名
    输入参数:值
    

高级用法

将 Word 文件转换为 PDF:

@文件转换器
docx2pdf
input_file: file.docx

📚 详细文档

项目结构

file-converter-mcp/
├── main.py          # 主程序入口
├── config/         # 配置文件夹
│   ├── settings.py # 应用配置
│   └── logging.py   # 日志配置
├── converters/     # 各种格式转换器实现
│   ├── docx_to_pdf.py
│   ├── html_to_pdf.py
│   └── csv_to_xlsx.py
└── utils/          # 工具函数
    ├── file_handler.py
    └── base64_utils.py

支持的文件格式

  • Microsoft Word (docx)
  • Adobe PDF (pdf)
  • HTML 和 Markdown (md, markdown)
  • CSV (csv)

🤝 贡献指南

欢迎各位开发者参与项目!如需贡献,请参考 CONTRIBUTING.md

📄 许可证

本项目遵循 MIT 许可证,具体内容请参阅 LICENSE 文件。

🌐 项目地址

GitHub 仓库:https://github.com/wowyuarm/file-converter-mcp

help

Runtime guide

cloud

Hosted runtime

Hosted servers run from a provider-managed environment. You usually connect the MCP client to the hosted endpoint or follow the provider's authorization flow, without keeping a local process alive

  1. Open provider connection page
  2. Authorize or copy endpoint
  3. Connect from your MCP client
terminal

Local runtime / other methods

Local servers run on your own machine or infrastructure. You normally copy the server_config into your MCP client, install the required package, and provide env variables from env_schema when needed

  1. Copy server_config
  2. Install required package
  3. Fill env variables and restart client