
HTML to Image
STDIOWeb page screenshot capture server with automatic Cloudinary upload integration
Web page screenshot capture server with automatic Cloudinary upload integration
A sophisticated Model Context Protocol (MCP) server that captures high-quality screenshots of web pages and automatically uploads them to Cloudinary for easy sharing and storage.
Before installing, make sure you have:
git clone [email protected]:alperenkocyigit/html-to-image-mcp.git cd html-to-image-mcp
pip install -r requirements.txt
python setup.py
.env
file in the project root:CLOUDINARY_CLOUD_NAME=your_cloud_name CLOUDINARY_API_KEY=your_api_key CLOUDINARY_API_SECRET=your_api_secret
docker build -t html-to-image-mcp .
docker run -e CLOUDINARY_CLOUD_NAME=your_cloud_name \ -e CLOUDINARY_API_KEY=your_api_key \ -e CLOUDINARY_API_SECRET=your_api_secret \ html-to-image-mcp
Visit smithery and follow instructions
https://smithery.ai/server/@alperenkocyigit/html-to-image-mcp
python server.py
The server will run on STDIO transport, ready to receive MCP requests.
take_screenshot
Captures a screenshot of a webpage and uploads it to Cloudinary.
Parameter | Type | Required | Default | Description |
---|---|---|---|---|
url | string | ✅ Yes | - | URL of the webpage to screenshot. Must start with https:// or http:// |
width | integer | ❌ Optional | 1280 | Viewport width in pixels |
height | integer | ❌ Optional | 720 | Viewport height in pixels |
fullPage | boolean | ❌ Optional | false | Capture full page height instead of viewport only |
Basic screenshot:
{ "name": "take_screenshot", "arguments": { "url": "https://example.com" } }
Custom dimensions:
{ "name": "take_screenshot", "arguments": { "url": "https://github.com", "width": 1920, "height": 1080 } }
Full page capture:
{ "name": "take_screenshot", "arguments": { "url": "https://news.ycombinator.com", "width": 1280, "height": 720, "fullPage": true } }
{ "status": 200, "message": "Screenshot captured and uploaded successfully", "url": "https://res.cloudinary.com/your-cloud/image/upload/v1234567890/screenshots/abc123.png", "public_id": "screenshots/abc123", "dimensions": { "width": 1280, "height": 720, "fullPage": false } }
Variable | Description | Required |
---|---|---|
CLOUDINARY_CLOUD_NAME | Your Cloudinary cloud name | ✅ |
CLOUDINARY_API_KEY | Your Cloudinary API key | ✅ |
CLOUDINARY_API_SECRET | Your Cloudinary API secret | ✅ |
.env
file or environment variablesgraph TB subgraph "MCP Client Environment" A[MCP Client<br/>Claude/VS Code/etc] --> B[JSON-RPC Request<br/>take_screenshot] end subgraph "HTML to Image MCP Server" B --> C{URL Validation} C -->|Valid URL| D[Pyppeteer<br/>Browser Launch] C -->|Invalid URL| E[Error Response<br/>Invalid URL format] D --> F[Headless Chromium<br/>Browser Instance] F --> G[Page Navigation<br/>viewport: width x height] G --> H[Screenshot Capture<br/>PNG format] H --> I[Temporary File<br/>Creation] I --> J[Cloudinary Upload<br/>folder: screenshots] end subgraph "External Services" K[Target Website<br/>https://example.com] L[Cloudinary CDN<br/>Image Storage] end subgraph "Response Flow" J --> M[Upload Success] M --> N[JSON Response<br/>secure_url, public_id] N --> O[MCP Client<br/>Receives Image URL] end G --> K J --> L %% Error paths G -->|Navigation Timeout| P[Error Response<br/>Navigation failed] J -->|Upload Failed| Q[Error Response<br/>Cloudinary upload failed] %% Styling classDef client fill:#e1f5fe classDef server fill:#f3e5f5 classDef external fill:#e8f5e8 classDef error fill:#ffebee class A,O client class C,D,F,G,H,I,J,M,N server class K,L external class E,P,Q error
html-to-image-mcp/
├── server.py # Main MCP server implementation
├── app.py # Utility functions for screenshot capture
├── setup.py # Chromium download and setup
├── requirements.txt # Python dependencies
├── Dockerfile # Container configuration
├── smithery.yaml # Smithery deployment config
└── README.md # This documentation
# Test Chromium installation python setup.py # Test screenshot functionality python -c " import asyncio from app import url_to_cloudinary_url_async print(asyncio.run(url_to_cloudinary_url_async('https://example.com'))) "
git checkout -b feature-name
docker build -t html-to-image-mcp .
docker run -d \ --name html-to-image \ -e CLOUDINARY_CLOUD_NAME=your_cloud_name \ -e CLOUDINARY_API_KEY=your_api_key \ -e CLOUDINARY_API_SECRET=your_api_secret \ html-to-image-mcp
version: '3.8' services: html-to-image-mcp: build: . environment: - CLOUDINARY_CLOUD_NAME=your_cloud_name - CLOUDINARY_API_KEY=your_api_key - CLOUDINARY_API_SECRET=your_api_secret restart: unless-stopped
"Chromium download failed"
# Install required system dependencies (Ubuntu/Debian) sudo apt-get update sudo apt-get install -y \ gconf-service libasound2 libatk1.0-0 libc6 libcairo2 libcups2 \ libdbus-1-3 libexpat1 libfontconfig1 libgcc1 libgconf-2-4 \ libgdk-pixbuf2.0-0 libglib2.0-0 libgtk-3-0 libnspr4 \ libpango-1.0-0 libpangocairo-1.0-0 libstdc++6 libx11-6 \ libx11-xcb1 libxcb1 libxcomposite1 libxcursor1 libxdamage1 \ libxext6 libxfixes3 libxi6 libxrandr2 libxrender1 libxss1 \ libxtst6 ca-certificates fonts-liberation libappindicator1 \ libnss3 lsb-release xdg-utils wget
"Invalid URL format"
https://
or http://
"Cloudinary upload failed"
"Navigation timeout"
fullPage: false
for better performanceThe server validates URLs to ensure they:
https://
or http://
The server provides detailed error messages for:
This project is licensed under the MIT License - see the LICENSE file for details.
Contributions are welcome! Please feel free to submit a Pull Request. For major changes, please open an issue first to discuss what you would like to change.
Made by Alperen Koçyiğit with ❤️ for the MCP community