An MCP server that provides multiple file conversion tools for AI agents, supporting various document and image format conversions including DOCX to PDF, PDF to DOCX, image conversions, Excel to CSV, HTML to PDF, and Markdown to PDF.
简体中文 | English
This MCP server provides multiple file conversion tools for converting various document and image formats. This project is built using the Model Context Protocol (MCP) and is designed to serve AI agents that need file conversion capabilities.
Clone the Repository
git clone https://github.com/wowyuarm/file-converter-mcp.git cd file-converter-mcp
Create a Virtual Environment (optional but recommended)
python -m venv venv source venv/bin/activate # On Unix-based systems venv\Scripts\activate # On Windows
Install Dependencies
Install the required packages using pip:
pip install mcp docx2pdf pdf2docx pillow pandas pdfkit markdown
Alternatively, if you are using uv:
uv add "mcp[cli]" docx2pdf pdf2docx pillow pandas pdfkit markdown
Note: Some conversion libraries may have additional system dependencies. Please check their documentation for details.
To test the server, run:
mcp dev file_converter_server.py
Optionally, you can install the server on Claude Desktop with:
mcp install file_converter_server.py --name "File Converter"
The MCP server exposes the following tools:
Command: docx2pdf
input_file: path/to/document.docx
file_content_base64: [base64 encoded string]
Command: pdf2docx
input_file: path/to/document.pdf
file_content_base64: [base64 encoded string]
Command: convert_image
input_file: path/to/image.png
output_format: jpg
file_content_base64: [base64 encoded string]
input_format: png
output_format: jpg
Command: excel2csv
Command: html2pdf
Command: convert_file
input_file: path/to/file.docx
input_format: docx
output_format: pdf
file_content_base64: [base64 encoded string]
input_format: docx
output_format: pdf
These are maintained for backward compatibility. All main tools now support content-based input directly.
Command: convert_content
Command: docx2pdf_content
Command: pdf2docx_content
Command: markdown2pdf_content
The server includes robust file path handling that:
All conversion tools now support two methods of input:
Path-Based Conversion (traditional approach)
@File Converter
docx2pdf
input_file: file.docx
Content-Based Conversion (works even when path lookup fails)
@File Converter
docx2pdf
file_content_base64: [base64 encoded string]
This dual-mode approach provides maximum flexibility and reliability:
When using with Claude, if a file upload fails to be found:
Try using the original filename with a preceding path:
@File Converter
docx2pdf
input_file: /tmp/file.docx
If that fails, obtain the file content directly from Claude:
@File Converter
docx2pdf
file_content_base64: [base64 content obtained from Claude]
{"success": false, "error": "error message"}
{"success": true, "data": "base64 encoded file content"}
Contributions are welcome! If you'd like to contribute, please follow the guidelines in CONTRIBUTING.md (中文版: 贡献指南, English: Contributing Guidelines).
This project is licensed under the MIT License – see the LICENSE file for details.
Visit the GitHub repository at: https://github.com/wowyuarm/file-converter-mcp
Discover shared experiences
Shared threads will appear here, showcasing real-world applications and insights from the community. Check back soon for updates!