Seven MCP tools let an AI client render a code image, browse themes and backgrounds, create expiring share pages and read the remaining quota. Same API, same limits, same watermark as the REST API. The stdio package is code2img-mcp on npm — the snippets below install it directly; the tarball at /downloads/code2img-mcp.tgz remains available as a fallback.
Endpoint https://code2img.app/mcp · Streamable HTTP · auth header Authorization: Bearer YOUR_API_KEY · keys in your dashboard
Claude Code, Cursor, Windsurf and VS Code accept a URL plus headers.
{
"mcpServers": {
"code2img": {
"type": "http",
"url": "https://code2img.app/mcp",
"headers": { "Authorization": "Bearer YOUR_API_KEY" }
}
}
}One command, remote transport.
claude mcp add --transport http code2img https://code2img.app/mcp \
--header "Authorization: Bearer YOUR_API_KEY"File: ~/Library/Application Support/Claude/claude_desktop_config.json (macOS) or %APPDATA%\Claude\claude_desktop_config.json (Windows).
{
"mcpServers": {
"code2img": {
"command": "npx",
"args": ["-y", "code2img-mcp"],
"env": { "CODE2IMG_API_KEY": "YOUR_API_KEY" }
}
}
}File: ~/.cursor/mcp.json
{
"mcpServers": {
"code2img": {
"command": "npx",
"args": ["-y", "code2img-mcp"],
"env": { "CODE2IMG_API_KEY": "YOUR_API_KEY" }
}
}
}File: .vscode/mcp.json (workspace) — VS Code uses "servers" instead of "mcpServers".
{
"servers": {
"code2img": {
"command": "npx",
"args": ["-y", "code2img-mcp"],
"env": { "CODE2IMG_API_KEY": "YOUR_API_KEY" }
}
}
}File: ~/.codeium/windsurf/mcp_config.json
{
"mcpServers": {
"code2img": {
"command": "npx",
"args": ["-y", "code2img-mcp"],
"env": { "CODE2IMG_API_KEY": "YOUR_API_KEY" }
}
}
}render_code_image | Render a snippet → image + 30-day public URL |
|---|---|
list_themes | Valid Shiki theme ids |
list_languages | Valid language ids |
list_backgrounds | Gradient presets and patterns |
create_share_link | Public page with OpenGraph preview, expiring |
get_usage | Quota left for this key |
get_share_urls | Your recent share pages |
OAuth is planned for the remote endpoint; today it authenticates with API keys, which is what every MCP client supports. Every tool call consumes the key's quota exactly once: the server is a client of the public API, so there is no second rule book to keep in sync. Themes, languages and backgrounds are the same catalogs the editor uses.
Full REST reference: /docs · machine-readable: openapi.json · llms.txt