MCP server

Give MCP hosts DOMShot tools.

Run domshot mcp over stdio so an MCP-compatible host can inspect pages, choose candidates, create contact sheets, and capture polished PNGs from tools like Codex, Claude Code, and other agent hosts.

What MCP means here

MCP lets an agent host discover and call tools provided by another program. In DOMShot, the MCP server exposes screenshot tools to the agent. The agent can ask DOMShot to inspect a page, plan useful shots, capture one element, or create a complete shot pack without manually running shell commands.

Use MCP when the agent host supports tools and should decide when DOMShot is useful during a larger task, such as writing a feature section with screenshots.

Install

Install the npm package where your agent can run local commands. Global install is the simplest setup because tools like Codex and Claude Code can start domshot from anywhere. Playwright Chromium is still needed for normal browser captures.

npm install -g @usedomshot/cli
npx playwright install chromium

Check the install with domshot --help and domshot mcp --help.

To update later, run npm install -g @usedomshot/cli@latest. You do not need to change the MCP config unless you intentionally pinned a package version.

Client config

Add DOMShot as an MCP server in your host's config. The exact config file location depends on the host, but the command is the same.

{
  "mcpServers": {
    "domshot": {
      "command": "domshot",
      "args": ["mcp"]
    }
  }
}

Expected result: the host lists DOMShot tools such as capture_domshot and create_domshot_shot_pack.

Use DOMShot with Codex, Claude Code, and other agents

DOMShot works with agents through MCP. Once connected, the agent can inspect a page, find the right card, modal, chart, or section, and save clean PNG files locally.

Claude Code

Add DOMShot as a local MCP server. Claude Code can then ask DOMShot to inspect a page and save the exact element it needs.

claude mcp add --transport stdio domshot -- domshot mcp

Codex

Add this to your Codex config, usually ~/.codex/config.toml, then restart Codex.

[mcp_servers.domshot]
command = "domshot"
args = ["mcp"]

Any MCP host

Use this JSON shape when an app asks for an MCP server command and arguments.

{
  "mcpServers": {
    "domshot": {
      "command": "domshot",
      "args": ["mcp"]
    }
  }
}

What to ask your agent

Ask for the result you want in normal language. The agent decides when to inspect first, when to capture, and whether it needs a retry.

One focused image Use DOMShot to inspect this page and capture the main pricing card as a PNG.

A finished asset set Use DOMShot to create a shot pack for the feature cards on this landing page.

A prepared browser tab Use DOMShot to capture the selected dashboard card from my current Chrome tab.

If setup does not work

Most setup issues are either the command not being on the agent's PATH, the local browser not being installed, or the agent asking for a target that is too vague.

Problem Fix
domshot is not found Install globally with npm install -g @usedomshot/cli@latest, then restart the agent host.
Chromium is missing Run npx playwright install chromium.
The wrong element is captured Ask the agent to inspect first, use verify, or use a more specific target such as primary pricing card.
The image needs a better background Ask the agent to call capture_domshot with style: "auto" so DOMShot can choose transparent, paper, or graphite styling.
The page requires login Use the current-page CDP workflow so DOMShot can capture from a Chrome tab you already prepared.

Tools

The tools are grouped by how much decision-making they do. Start with inspection or planning when the page is unfamiliar. Use capture tools when the target is already clear.

Tool Use
capture_domshotCapture one selected element by selector or target.
inspect_domshot_pageInspect visible candidates for an intent or target.
recommend_domshot_shotsRecommend useful candidates and styles.
create_domshot_planPlan shots before writing PNG files.
capture_domshot_planCapture screenshots from a saved plan.
create_domshot_contact_sheetWrite a labeled contact sheet for visual review.
capture_domshot_setCapture several similar elements.
create_domshot_shot_packCreate polished PNGs, a contact sheet, and a report.

Example shot pack input

Use this when an agent is creating a homepage, blog, docs, or feature section and needs several useful images. DOMShot will inspect the page, choose candidates, style them, and write assets to the output folder.

{
  "url": "https://example.com",
  "intent": "homepage feature section",
  "target": "feature cards",
  "count": 4,
  "outputDir": "artifacts/homepage",
  "style": "auto"
}

Expected output: JSON text with file paths, selected items, warnings, a contact sheet path, and a report path. The image payloads are written to disk, not returned inline.

Example current-page CDP input

Use this for logged-in or private pages where the user has already opened Chrome and reached the right tab. DOMShot attaches through Chrome's debugging port and captures from the current browser session.

{
  "intent": "dashboard feature visuals",
  "target": "dashboard cards",
  "count": 4,
  "outputDir": "artifacts/dashboard",
  "style": "auto",
  "browser": {
    "mode": "cdp",
    "endpointURL": "http://127.0.0.1:9222"
  }
}

Keep outputs from private pages in local ignored folders and do not paste private URLs, selectors, screenshots, cookies, or auth state into public docs or issues.

Result shape

MCP tools return JSON text with paths, dimensions, selectors, warnings, decisions, confidence, contact sheet paths, report paths, and fallback status. V1 writes files to disk and does not return base64 image payloads.

{
  "path": "/absolute/path/artifacts/card.png",
  "width": 1200,
  "height": 1200,
  "selector": "[data-card='pricing']",
  "fallback": false,
  "bytes": 12345
}

fallback: false means the main DOM render path worked. fallback: true means DOMShot used visible pixels because the DOM render path was blocked or unsupported.

Agent guidance

Use DOMShot as the eyes and camera. Let the agent decide the story, review confidence and warnings, compare contact sheets, and retry with a narrower target, kinds, steps, or selector when needed.

Use inspect_domshot_page when the agent is not sure what elements exist.

Use create_domshot_plan when the agent should decide before writing images.

Use create_domshot_shot_pack when the agent needs final assets for a content section.