mcpField
I
imgpage

imgpage

Local
github.com/CloudCorpRecordsMedia & Design0Updated 2d ago

About imgpage

imgpage is a local bridge to the hosted html2img service for generating images or PDFs from HTML and capturing web pages. It is for clients that need rendered output from markup or a live URL.

Key features

  1. 01Render HTML and CSS as PNG
  2. 02Generate A4 vector PDFs
  3. 03Capture live pages by URL
  4. 04Screenshot full pages or elements
  5. 05Return shareable CDN URLs

Use cases

  1. 01Preview an HTML document as an image
  2. 02Create a selectable-text PDF from markup
  3. 03Capture a live page or selected element
  4. 04Share rendered output through a CDN URL

MCP support

Exposes two upstream rendering tools to MCP clients: HTML rendering and URL screenshots. It forwards tool calls to html2img and returns upstream results unchanged.

Configuration

Local server config is the same for every client. Copy it into your client’s MCP config file.

mcp.json · Universal config
{
"mcpServers": {
"cloudcorprecords-imgpage": {
"command": "npx",
"args": [
"-y",
"@reneturcios/imgpage"
]
}
}
}
Run commandnpx -y @reneturcios/imgpage

Local servers need a runtime on your machine (e.g. Node.js 18+). Config file locations differ by client; see your client’s docs.

Packages
npm@reneturcios/imgpage0.1.0
ocighcr.io/cloudcorprecords/imgpage:0.1.0

Tools

2

Saved tool list · updated 2d ago

ParameterTypeRequiredDescription
cssstringNoOptional additional CSS to inject into the page.
dpiintegerNoScale factor / device pixel ratio (1-4) for higher-resolution output.
htmlstringYesThe full HTML markup to render. Include CSS in an inline <style> block. Publicly accessible remote image URLs work; use base64 data URIs for images that are not hosted anywhere.
widthintegerNoViewport width in pixels (1-5000). Defaults to 1920.
formatenumNoOutput format. "png" (default) returns an image sized by width and height. "pdf" returns an A4 portrait vector PDF with selectable, searchable text and automatic pagination; width, height, dpi and fullpage are ignored. Use "pdf" for documents such as invoices, reports, certificates and tickets. Use "png" for social cards, OG images and anything displayed at fixed pixel dimensions.png | pdf
heightintegerNoViewport height in pixels (1-5000). Defaults to 1080.
fullpagebooleanNoCapture the full scrollable page instead of just the viewport.
ms_delayintegerNoMilliseconds to wait before capturing (1-5000), e.g. to let fonts or animations settle.
wait_for_selectorstringNoWait until this CSS selector is present before capturing.

Details

From the project README

imgpage

imgpage is a small local bridge to the hosted html2img MCP server, which turns markup and web pages into rendered output. Give it a complete, self-contained HTML document — styles in an inline style block — and it comes back as a PNG image sized to a viewport you choose, or as an A4 vector PDF with selectable text when you ask for the pdf format. Or give it the address of a live page and it screenshots that page instead, whole page or just one element, again as PNG or PDF. Every render also returns a shareable CDN URL; PDF renders return the URL only.

This package renders nothing itself. It answers the tool list locally, exactly as captured from the live endpoint, and forwards each tool call upstream, returning whatever comes back untouched. There are two tools, and per the captured descriptions each call consumes one credit on your own html2img plan. Nothing in this package can buy credits, start a checkout, top up an account, or mint a key: it only spends against a plan you already have, through the two rendering calls below.

Tools

  • generate-image-from-html — render HTML and CSS into a PNG image, or into an A4 vector PDF with format pdf. Required: html (the full markup; include CSS in an inline style block; publicly accessible remote image URLs work, and images that are not hosted anywhere should be embedded as base64 data URIs). Optional: css, width (1-5000, default 1920), height (1-5000, default 1080), fullpage, dpi (1-4), ms_delay (1-5000), wait_for_selector, and format (png or pdf; with pdf, width, height, dpi and fullpage are ignored). Returns the rendered image plus a shareable CDN URL; PDF renders return the URL only. Consumes one credit per call.
  • screenshot-url — capture a live web page by URL as a PNG screenshot, or as an A4 vector PDF with format pdf. Required: url (the fully-qualified URL of the page). Optional: css, width (1-5000, default 1920), height (1-5000, default 1080), fullpage, selector (capture only the matching element), dpi (1-4), ms_delay (1-5000), wait_for_selector, and format (png or pdf; with pdf, width, height, dpi, fullpage and selector are ignored). Returns the rendered image plus a shareable CDN URL; PDF renders return the URL only. Consumes one credit per call.

Configuration

  • HTML2IMG_MCP_URL (optional) — override the upstream endpoint. Defaults to https://app.html2img.com/mcp. (The override hook is this rebuild's own labelled reconstruction.)
  • HTML2IMG_API_KEY (optional) — when set, every upstream request carries an Authorization: Bearer <key> header, for the caller's own html2img API key. When it is not set, no key header is sent. (The header name and Bearer form are pinned by the original's registry record, which declares a required secret Authorization header; the record pins no package env name, so forwarding the key from this env var is a labelled reconstruction — the original surface was captured keyless.)
Forwarding mechanics

On the first tool call the client opens a streamable HTTP session upstream: a JSON-RPC initialize request (protocolVersion 2025-03-26, clientInfo name imgpage), then a notifications/initialized notification, then the tools/call request carrying the caller's arguments unchanged. When the upstream answers initialize with an Mcp-Session-Id header, that value rides on every later request of the session, which is reused for the life of the process. Replies may arrive as plain JSON or as server-sent events; both are read.

Successful upstream results pass through verbatim, including any isError flag the upstream sets. Failures — a JSON-RPC error, a non-2xx status, an unreadable response, or a request that cannot be completed — come back as an isError result whose text starts with imgpage error: (this rendering is this rebuild's own labelled reconstruction).

CLI

Each tool is also a subcommand taking one JSON argument string:

npx @reneturcios/imgpage generate-image-from-html '{"html":"<h1>Hello</h1>"}'
npx @reneturcios/imgpage screenshot-url '{"url":"https://example.com"}'
npx @reneturcios/imgpage --version

Exit codes: 0 on success, 1 on an isError result, 2 on a usage error.

MCP server

npx -y @reneturcios/imgpage mcp

MCP client config:

{
  "mcpServers": {
    "imgpage": {
      "command": "npx",
      "args": ["-y", "@reneturcios/imgpage", "mcp"]
    }
  }
}

Docker

docker run -i ghcr.io/cloudcorprecords/imgpage
docker run --rm ghcr.io/cloudcorprecords/imgpage --version

The container's default command is mcp, so the first form is a stdio MCP server; any other arguments reach the CLI normally.

Development

npm install
npm run build
npm test
npm run dev

The test suite runs entirely against a stubbed JSON-RPC upstream — no live network calls.

License

MIT — see LICENSE.

Comments

Markdown supported

New to MCP?

From what the protocol is to installing your first server, these answers cover most first questions.

An open protocol that defines how AI applications connect to external tools and data in a uniform way. Clients talk to the model; MCP servers provide tools, resources and prompt templates. They exchange standard messages, so one server can be reused by many clients.