An MCP server that enables LLMs to create and edit HTML documents with embedded styles, images, and videos.
- Create HTML documents with unique, human-readable IDs
- Update existing documents
- Add images and videos (automatically copied to document folder)
- Export to HTML, PDF, or DOCX (requires Pandoc)
- List and retrieve documents
- Terminal mode for testing
Each document is stored in its own folder:
{ROOT_DIR}/my-document-a3f9/
├── index.html # HTML with embedded <style>
├── metadata.json # Document metadata
└── media/ # Images and videos
├── image1.png
└── video1.mp4
Document IDs are generated from the document name:
- Input: "My Report"
- Output: "my-report-a3f9" (slugified name + 4-char random suffix)
Set the root directory via environment variable:
export SIMPLE_HTML_ROOT_DIR="/path/to/documents"Default: ~/.simple_html_docs
./run.sh install # Install dependencies
./run.sh build # Build binary to bin/simple_html_docgen# Create a document
./run.sh create "My Report" "<h1>Hello World</h1><p>This is a test.</p>"
# List documents
./run.sh list
# Get document
./run.sh get my-report-a3f9
# Update document
./run.sh update my-report-a3f9 "<h1>Updated Content</h1>"
# Add media
./run.sh add-media my-report-a3f9 /path/to/image.png image
# Export to PDF
./run.sh export my-report-a3f9 pdfCreate a new HTML document.
Parameters:
name(string, required): Document namehtml_content(string, required): HTML content
Returns:
{
"status": "succeeded",
"document_id": "my-report-a3f9",
"name": "My Report",
"file_path": "/path/to/my-report-a3f9/index.html",
"created_at": "2024-01-15T10:30:00Z",
"updated_at": "2024-01-15T10:30:00Z"
}Update an existing document's HTML content.
Parameters:
document_id(string, required): Document IDhtml_content(string, required): New HTML content
Add an image or video file to a document.
Parameters:
document_id(string, required): Document IDsource_path(string, required): Absolute path to media filemedia_type(string, required): "image" or "video"
Returns:
{
"status": "succeeded",
"document_id": "my-report-a3f9",
"relative_path": "media/image1.png",
"media_type": "image"
}Use the relative_path in HTML:
<img src="media/image1.png" alt="Image">Retrieve a document by ID.
Parameters:
document_id(string, required): Document ID
List all documents.
Returns:
{
"status": "succeeded",
"count": 2,
"documents": [
{
"document_id": "my-report-a3f9",
"name": "My Report",
"file_path": "/path/to/my-report-a3f9/index.html",
"created_at": "2024-01-15T10:30:00Z",
"updated_at": "2024-01-15T10:30:00Z"
}
]
}Export a document to HTML, PDF, or DOCX.
Parameters:
document_id(string, required): Document IDformat(string, required): "html", "pdf", or "docx"
Returns:
{
"status": "succeeded",
"document_id": "my-report-a3f9",
"format": "pdf",
"output_path": "/path/to/my-report-a3f9/my-report-a3f9.pdf"
}For PDF and DOCX export, install Pandoc:
macOS:
brew install pandoc
brew install basictex # For PDF supportLinux:
sudo apt-get install pandoc texlive-xetexWindows: Download from https://pandoc.org/installing.html
./run.sh testcmd/main.go- Entry point with terminal modepkg/config/- Configuration from env varspkg/document/- Core document logicpkg/storage/- File operationspkg/export/- Export functionalitypkg/handler/- MCP protocol implementation
MIT License