Code2Img

Render code images from your agent.

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

Remote (no install) — any client that speaks Streamable HTTP

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" }
    }
  }
}

Claude Code (CLI)

One command, remote transport.

claude mcp add --transport http code2img https://code2img.app/mcp \
  --header "Authorization: Bearer YOUR_API_KEY"

Claude Desktop (stdio, npx)

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" }
    }
  }
}

Cursor (stdio, npx)

File: ~/.cursor/mcp.json

{
  "mcpServers": {
    "code2img": {
      "command": "npx",
      "args": ["-y", "code2img-mcp"],
      "env": { "CODE2IMG_API_KEY": "YOUR_API_KEY" }
    }
  }
}

VS Code (stdio, npx)

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" }
    }
  }
}

Windsurf (stdio, npx)

File: ~/.codeium/windsurf/mcp_config.json

{
  "mcpServers": {
    "code2img": {
      "command": "npx",
      "args": ["-y", "code2img-mcp"],
      "env": { "CODE2IMG_API_KEY": "YOUR_API_KEY" }
    }
  }
}

Tools

render_code_imageRender a snippet → image + 30-day public URL
list_themesValid Shiki theme ids
list_languagesValid language ids
list_backgroundsGradient presets and patterns
create_share_linkPublic page with OpenGraph preview, expiring
get_usageQuota left for this key
get_share_urlsYour recent share pages

Notes

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