codetoimage-mcp-server
v0.2.0Pixel-perfect HTML/CSS to PNG/JPG/WebP for AI agents — inline image or 24h hosted URL.
These tools were reported by the server itself during our smoke test (tools/list), not copied from the README.
render_html_to_image
Render HTML (and optional CSS) into a PNG/JPEG/WebP image using codetoimage.app. Instead of raw HTML you can pass `template_id` (a template saved in the dashboard) plus `variables` to fill its {{placeholders}}, and `preset` for named platform sizes (og, instagram-story, ...). Returns the image inline so the conversation can display it directly. Use this when you need to *see* or hand back a finished image (cards, OG previews, charts, badges). If the caller needs a URL to embed elsewhere (Instagram Graph API, OpenGraph meta, Slack unfurl), use `render_html_to_url` instead.
| Parameter | Type | Description |
|---|---|---|
background | string | Background color, e.g. '#ffffff' or 'rgb(10,10,10)'. |
css | string | Optional CSS injected as a <style> block. |
format | string | Output format. Default: png. |
height | integer | Viewport height in pixels (default 600). |
html | string | Full HTML (typically including <body>…</body>). Inline styles work; for larger CSS use the `css` field. Required unless `template_id` is provided. |
preset | string | Named viewport size: og 1200×630, twitter-card 1200×628, facebook-post 1200×630, linkedin-post 1200×627, instagram-square 1080×1080, instagram-portrait 1080×1350, instagram-story 1080×1920, you… |
quality | integer | Encoder quality (JPEG/WebP only, 1-100). |
template_id | string | ID of a template saved in the codetoimage dashboard (Templates page). Use INSTEAD of `html` – the saved HTML/CSS renders with {{placeholders}} filled from `variables`. |
transparent | boolean | Transparent background (PNG/WebP only; paid plans). |
variables | object | Values for {{placeholders}} in the template (or in `html` if provided). Values are HTML-escaped server-side. Missing placeholders render as empty. |
width | integer | Viewport width in pixels (default 800). |
render_html_to_url
Render HTML (and optional CSS) to an image and return a temporary hosted URL (instead of inline bytes). Supports the same `template_id` + `variables` + `preset` inputs as render_html_to_image. Use this when the caller needs to *reference* the image elsewhere – Instagram Graph API, OpenGraph meta tags, Slack unfurls, embedding in docs/posts. URL is valid for 24 hours.
| Parameter | Type | Description |
|---|---|---|
background | string | |
css | string | |
format | string | |
height | integer | |
html | string | |
preset | string | Named viewport size: og 1200×630, twitter-card 1200×628, facebook-post 1200×630, linkedin-post 1200×627, instagram-square 1080×1080, instagram-portrait 1080×1350, instagram-story 1080×1920, you… |
quality | integer | |
template_id | string | ID of a template saved in the codetoimage dashboard (Templates page). Use INSTEAD of `html` – the saved HTML/CSS renders with {{placeholders}} filled from `variables`. |
transparent | boolean | |
variables | object | Values for {{placeholders}} in the template (or in `html` if provided). Values are HTML-escaped server-side. Missing placeholders render as empty. |
width | integer |