Huoshui File Converter
A secure MCP (Model Context Protocol) server for document format conversion within a specified working directory.
Features
- 🔒 Sandbox Security: All operations restricted to a configured working directory
- 📄 Format Support: Convert between Markdown, DOCX, HTML, PDF, and TXT
- 🚀 MCP Integration: Full MCP protocol support with prompts, resources, and tools
- ⚙️ Flexible Configuration: CLI arguments, environment variables, or current directory
- 🔍 Smart Detection: Intelligent file format detection by content analysis
Quick Start
Installation
Option 1: From MCP Registry (Recommended)
This server is available in the Model Context Protocol Registry. Install it using your MCP client.
mcp-name: io.github.huoshuiai42/huoshui-file-converter
Option 2: Using uvx
uvx huoshui-file-converter
Option 3: Using pip
pip install huoshui-file-converter
Basic Usage
# Use current directory
uvx huoshui-file-converter
# Specify working directory (recommended)
uvx huoshui-file-converter --dir "/path/to/documents"
# Short form
uvx huoshui-file-converter -d "~/Documents"
MCP Client Configuration
For Claude Desktop or other MCP clients:
{
"mcpServers": {
"huoshui-converter": {
"command": "uvx",
"args": ["huoshui-file-converter", "--dir", "/Users/yourname/Documents"]
}
}
}
Configuration Options
Priority Order
- CLI Argument (highest priority):
--diror-d - Environment Variable:
HUOSHUI_WORKING_DIR - Smart Default: Documents folder if current directory is problematic
- Current Directory (fallback)
Examples
# CLI argument (best for MCP clients)
uvx huoshui-file-converter --dir "/project/docs"
# Environment variable
export HUOSHUI_WORKING_DIR="/project/docs"
uvx huoshui-file-converter
# Current directory fallback
cd /project/docs
uvx huoshui-file-converter
Supported Conversions
| From | To |
|---|---|
| Markdown | DOCX, HTML, PDF |
| DOCX | Markdown, HTML, PDF |
| HTML | Markdown, DOCX, PDF |
| TXT | Markdown, DOCX, HTML, PDF |
MCP Tools & Resources
Tools
convert_document: Convert files between formatsdetect_format: Intelligent format detection
Resources
file_list: Browse directory contents (optimized for large directories)limit: Control number of files shown (default: 100)supported_only: Show only convertible files
file_get: Get detailed file informationconversion_capability_list: List supported conversions
Prompts
role_and_rules: AI assistant behavior guidelines
Performance Features
- Fast Directory Listing: Extension-based format detection for large directories
- Smart File Limits: Default 100-file limit prevents UI freezing
- Large File Handling: Files >50MB are marked and handled specially
- Selective Display: Option to show only supported file formats
- Memory Efficient: Avoids reading file contents during directory browsing
Security Features
- Path Validation: Prevents directory traversal attacks
- Working Directory Restriction: All operations sandboxed to configured directory
- Startup Validation: Checks directory existence and permissions
- Relative Path Enforcement: Absolute paths are rejected
Command Line Options
$ uvx huoshui-file-converter --help
usage: huoshui-file-converter [-h] [--dir PATH] [--version]
Huoshui Document Converter - MCP Server for file conversion within a working directory
options:
-h, --help show this help message and exit
--dir PATH, -d PATH
Working directory for file operations (default: current directory or HUOSHUI_WORKING_DIR env var)
--version, -v show program's version number and exit
Examples:
uvx huoshui-file-converter # Use current directory
uvx huoshui-file-converter --dir /docs # Use specific directory
uvx huoshui-file-converter -d ./project # Use relative directory
Configuration Priority:
1. CLI argument (--dir/-d)
2. Environment variable (HUOSHUI_WORKING_DIR)
3. Current working directory
Error Handling
The server validates the working directory on startup:
✅ Working directory configured: /Users/name/Documents
📂 Source: CLI argument
Common errors and solutions:
| Error | Solution |
|---|---|
| Directory not found | Create directory or fix path |
| No write access | Check permissions (chmod on Unix) |
| Path outside sandbox | Use relative paths only |
Development
Requirements
- Python 3.8+
- pypandoc
- pandoc (system dependency)
- LaTeX (for PDF conversion)
Testing
# Test configuration
uvx huoshui-file-converter --dir "/tmp/test"
# Check startup messages
# ✅ Working directory configured: /tmp/test
# 📂 Source: CLI argument
Documentation
License
[Your license here]
Metadata
Release files for huoshui-file-converter 0.1.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| huoshui_file_converter-0.1.1.tar.gz | 16.0 MB | Without provenance | Details for huoshui_file_converter-0.1.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| huoshui_file_converter-0.1.1-py3-none-any.whl | Python 3 | none | any | Details for huoshui_file_converter-0.1.1-py3-none-any.whl |
Total release size: 16.0 MB
Release files / huoshui_file_converter-0.1.1.tar.gz
| Download URL | huoshui_file_converter-0.1.1.tar.gz |
|---|---|
| Size | 16.0 MB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
c4fe6a57f122455e7ae11047956d9b28fe5f851b79e5cf93187978bb303b5f28
|
|
BLAKE2b-256 checksum How to use checksums |
86d759f07ca46732f9deedade13a301d2c98e0094be658e53a78d81e5ef4794f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.9
|
Release files / huoshui_file_converter-0.1.1-py3-none-any.whl
| Download URL | huoshui_file_converter-0.1.1-py3-none-any.whl |
|---|---|
| Size | 12.1 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
ef93bec7747ae6d6474eb4c09d212df43d8e706ca7f71d137944fa30f37d77d0
|
|
BLAKE2b-256 checksum How to use checksums |
a9e73229596bd74f7f250dbcdcb5d45326de291eed1f94012f083e893e295b00
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.9
|
Security for huoshui-file-converter 0.1.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.