文件转换MCP服务器
](https://smithery.ai/server/@convertguru/file-convert-mcp)
用于在各种格式之间转换文件的模型上下文协议(MCP)服务器。
File Convert是一个MCP服务器,旨在处理各种文件格式的转换,包括图像、办公文档、音频、视频、文本和数据文件。它旨在提供无缝转换为流行格式,如PDF、JPG、MP4和HTML等。该服务器提供了一套强大的工具,可以将各种文件类型转换为易于访问且广泛兼容的格式,如PDF、JPG、PNG、TXT。
✨ 特性
- 智能文件类型检测: 使用AI、TrID和魔术字节的组合进行准确的文件类型识别。
- 多功能文件转换: 支持多种文件类型和以下流行格式之间的转换:
- 图像: 处理各种格式,包括许多传统格式。转换为PDF、JPG、PNG。 - 办公文件: 转换为PDF、TXT、HTML。 - 音频/视频: 转换为MP3、MP4。 - 数据库: 转换为CSV。 - 各种文件: 还为其他文件类型提供转换功能。
🛠️ 需求
- python 需要3.12或更高版本。
- uv工具: 安装 Python uv工具 用于高效的依赖关系管理和MCP服务器的易于执行。
- API密钥(开发): 截至2025年5月,MCP正处于测试阶段 当前不需要API密钥 为了发展。为了未来的生产使用,请 联系转化者。大师团队 以获得API密钥。
🚀 使用桌面应用程序
若要将此服务器与桌面应用程序集成,请将以下配置添加到应用程序的服务器设置中。如有必要,调整绝对路径至 uv/uvx 可执行文件(或 uv.exe/uvx.exe 在Windows上)。
使用 uvx (推荐):
{
"mcpServers": {
"file-convert": {
"command": "uvx",
"args": ["--from", "git+https://github.com/convertguru/file-convert-mcp.git", "file-convert-mcp"],
"env": {
"CONVERT_GURU_API_KEY": "your_api_key_here"
}
}
}
}如果您已在本地克隆了存储库(根据需要调整路径):
{
"mcpServers": {
"file-convert": {
"command": "/home/User/.local/bin/uv",
"args": ["--directory", "/home/User/file-convert-mcp/src/file_convert_mcp", "run", "server.py"],
"env": {
"CONVERT_GURU_API_KEY": "your_api_key_here"
}
}
}
}使用本地 uvx:
{
"mcpServers": {
"file-convert": {
"command": "uvx",
"args": ["--from", "/home/User/file-convert-mcp", "file-convert-mcp"],
"env": {
"CONVERT_GURU_API_KEY": "your_api_key_here"
}
}
}
}环境变量
MCP服务器支持以下环境变量:
CONVERT_GURU_API_KEY:你的转换。古鲁API密钥(开发可选)TRANSPORT:MCP服务器的传输方法
- "stdio" (默认):标准输入/输出传输 - "http":具有REST API终结点的HTTP传输(可流式传输)
PORT:HTTP传输的端口号(默认值:8000,仅在以下情况下使用TRANSPORT=http)
使用HTTP传输时,服务器提供其他端点:
GET /health-健康检查端点GET /tools-可用MCP工具列表
此外,请参阅本指南,了解如何 在Claude Desktop中设置MCP工具.
通过Smithery安装
要安装文件,请通过以下方式自动转换Claude Desktop的mcp 史密瑟里:
npx -y @smithery/cli install @convertguru/file-convert-mcp --client claude🛠️ 发展
按照以下步骤开始本地开发:
1.克隆存储库:
git clone https://github.com/convertguru/file-convert-mcp.git2.获取并缓存Python依赖项(可选, uvx 自动处理):
cd file-convert-mcp
uv sync
cd ..3.使用API密钥创建.env文件(目前为可选):
echo "CONVERT_GURU_API_KEY=your_api_key_here" > file-convert-mcp/.env4.使用各种工具在本地运行MCP服务器 uv 命令:
# Using uvx with .env file from the local directory
cd file-convert-mcp
UV_ENV_FILE=.env uvx --from ./file-convert-mcp file-convert-mcp
# OR using uv directly to run the server script
uv run file-convert-mcp/src/file_convert_mcp/server.py
# OR specifying the directory for uv
uv --directory file-convert-mcp/src/file_convert_mcp run server.py
# OR navigating into the server directory
cd file-convert-mcp/src/file_convert_mcp
uv run server.py
# OR using uvx to fetch the core from the GitHub repository + local .env file
UV_ENV_FILE=.env uvx --from git+https://github.com/convertguru/file-convert-mcp.git file-convert-mcp
# OR run with HTTP transport on custom port
TRANSPORT=http PORT=9000 uv run file-convert-mcp/src/file_convert_mcp/server.py
# OR run with stdio transport (default)
TRANSPORT=stdio uv run file-convert-mcp/src/file_convert_mcp/server.py5.使用您的配置创建.env文件(现在是可选的):
# Basic configuration
echo "CONVERT_GURU_API_KEY=your_api_key_here" > file-convert-mcp/.env
# OR with transport configuration
echo "CONVERT_GURU_API_KEY=your_api_key_here" > file-convert-mcp/.env
echo "TRANSPORT=http" >> file-convert-mcp/.env
echo "PORT=8000" >> file-convert-mcp/.env6.如果需要,修改服务器逻辑: 编辑位于以下位置的主服务器文件 src/file_convert_mcp/server.py.
7.清理 uv 缓存(如果需要): 如果 uv 已在中缓存了旧版本的代码 ~/.cache/uv,您可能需要清除缓存。或者,使用 uv 随着 -n 或 --no-cache 选择绕过它。
⚙️ 可用工具
MCP服务器提供以下工具:
detect_file_type:分析上传文件的前200个字节并使用Convert。上师API确定其类型。convert_file:将给定的文件转换为指定的输出格式。所需的文件扩展名应作为ext_out参数。
📜 许可证
访问我们 https://convert.guru
此项目根据MIT许可证获得许可-请参阅 许可证 文件以获取完整的详细信息。
