iris README

The project's README from github.com/brijr/iris. As one markdown file: README.md.

iris

ChatGPT Image Aug 18, 2026, 12_50_00 PM

A camera for coding agents. One fast command or MCP tool call produces one trustworthy image.

iris example.com                        # 1440×900 @2x → example.com.png
iris --full --dark tailwindcss.com      # full page, dark color scheme
iris --size iphone stripe.com           # 390×844 @3x with a mobile UA
iris --selector '#hero' --padding 24 app.dev # first matching element, tightly framed
iris -o shots/ a.com b.com c.com        # batch, captured concurrently
cat urls.txt | iris - -o shots/         # batch from stdin (# comments ok)
iris -o hero.jpg --wait-for 'h1' app.dev
iris --selector 'h1' --json app.dev      # machine-readable JSON Lines

iris --full bridger.to →

Full-page capture of bridger.to, taken by iris

Install

curl -fsSL https://raw.githubusercontent.com/brijr/iris/main/install.sh | sh

Or with a Rust toolchain:

cargo install iris-screenshot

The crates.io package is named iris-screenshot; the installed command is iris.

The only runtime dependency is an installed Chrome-family browser (Chrome, Chromium, Edge, or Brave). Building from source requires Rust 1.88 or newer.

Give your coding agent eyes

Iris includes a local stdio MCP server in the same binary. Add it to Codex:

codex mcp add iris -- iris mcp

Or use the equivalent configuration in another MCP client:

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

The server exposes one tool, capture, which returns the image inline with structured metadata. It writes nothing by default; pass output when the agent also needs a file.

{
  "url": "localhost:3000",
  "selector": "#pricing-card",
  "padding": 24,
  "size": "desktop",
  "dark": false,
  "format": "png",
  "timeout_seconds": 30,
  "output": "/tmp/pricing-card.png"
}

Bare localhost, .localhost, and loopback addresses use HTTP automatically. Other bare hosts use HTTPS. Run iris mcp --help to select a Chrome binary for the server.

MCP clients may need a fresh agent task before the newly registered capture tool appears.

Setup Prompt

Give this setup prompt to your coding agent:

Set up Iris as your visual camera in this coding environment.

Goal: install Iris, connect its local MCP server to this agent client, and prove
both the CLI and MCP paths work. Do not modify the application repository.

1. Check for an installed Chrome-family browser, `iris --version`, and an
   existing Iris MCP configuration.
2. If Iris is missing or outdated, install it with:

   curl -fsSL https://raw.githubusercontent.com/brijr/iris/main/install.sh | sh

   Or, when Rust is available:

   cargo install iris-screenshot

   Make sure the resulting `iris` command is on PATH.
3. Register the stdio MCP server without duplicating an existing entry.

   For Codex:

   codex mcp add iris -- iris mcp
   codex mcp get iris

   For another MCP client, configure command `iris` with args `["mcp"]`.
4. Prove the CLI works:

   iris https://example.com --selector h1 --padding 8 --scale 1 --json \
     -o /tmp/iris-smoke.png

   Confirm `status: ok` and a readable, non-empty PNG.
5. Reload the MCP configuration or start a fresh agent task if required. Call
   Iris's `capture` tool once for `https://example.com`, selecting the first
   `h1` with 8px padding and scale 1. Confirm an inline PNG and structured
   dimensions are returned.
6. Report the installed Iris version, MCP configuration, CLI smoke result, MCP
   smoke result, and any remaining blocker.

Do not claim MCP success from the CLI test alone. Do not add browser automation,
interaction scripting, or review tooling; use Iris only as the camera.

What it does for you

Element capture is intentionally CSS-selector based: Iris captures the first match in document order. --selector conflicts with --full; --padding requires it. Cross-origin iframe contents and capturing every match are not supported.

{"status":"ok","url":"https://example.com/","output":"/absolute/example.com.png","mode":"element","selector":"h1","padding":24,"css_width":180,"css_height":72,"scale":2.0,"format":"png","bytes":14231}

Benchmarking

Capture time includes navigation and Iris's correctness waits, so compare the same URL, capture mode, viewport, scale, Chrome version, and hardware. Prefer a deterministic local page when comparing releases; public URLs add network and server variance.

For a repeatable one-shot CLI benchmark from this repository, install hyperfine and run:

cargo build --release
hyperfine --warmup 1 --runs 10 \
  './target/release/iris file://$PWD/tests/fixtures/precise-capture.html \
    --selector .capture-target --padding 24 --scale 1 \
    -o /tmp/iris-benchmark.png'

The CLI starts a Chrome process for every invocation. MCP keeps one Chrome process alive for the server's lifetime, so benchmark it separately: initialize once, record the first capture, then report the median and p95 of at least ten identical subsequent calls. Measure from JSON-RPC request to complete tool response and exclude model time.

Reference results (not a performance guarantee):

Iris Machine Chrome Workload Result
0.4.1 Apple M2 Max, macOS 26.5.2 151.0.7922.138 One-shot CLI, 10 runs after one warmup 1.00 s median
0.4.1 Apple M2 Max, macOS 26.5.2 151.0.7922.138 MCP first capture 965 ms
0.4.1 Apple M2 Max, macOS 26.5.2 151.0.7922.138 MCP next 10 captures 366 ms median, 383 ms p95

All reference runs used the local precise-capture.html fixture, .capture-target, 24px padding, PNG, and scale 1. Record iris --version, the Chrome version, and the exact command with any published result.

Flags

-o, --out <PATH>       output file (single URL) or directory (batch)
-s, --size <SIZE>      WxH, or desktop (1440x900@2x) | iphone (390x844@3x) | ipad (1024x1366@2x)
    --full             capture the full page height
    --selector <CSS>   capture the first element matching a CSS selector
    --padding <PX>     nonnegative CSS-pixel padding around a selected element
    --dark             emulate prefers-color-scheme: dark
    --format <FMT>     png | jpg | webp (a recognized --out extension wins)
    --wait <MS>        extra settle delay after smart waiting
    --wait-for <CSS>   wait until a selector exists before capturing
    --scale <N>        device scale factor (overrides the preset's)
    --jobs <N>         concurrent captures (default: min(4, URLs))
    --timeout <SECS>   per-page budget (default: 30)
    --chrome <PATH>    browser binary (auto-detected; also via $CHROME)
    --json             emit one JSON object per completed capture

iris mcp [--chrome <PATH>] serves the single-image capture tool over stdio. Batch capture, browser interaction scripting, diffs, and review workflows remain outside Iris.

License

MIT

iris (brijr/iris)

Searching Database…

517 ·GitHub
这是什么?Iris 是一个命令行工具兼 MCP 服务器,通过 DevTools 协议驱动你真实安装的 Chrome 给在线网站截图。它被定位为编程智能体的相机,每次命令或工具调用产出一张可信截图。
这是命令行工具、库,还是 MCP 服务器?两者都是:同一个 Rust 二进制文件既是命令行工具(iris --full url),又内置了本地 stdio MCP 服务器,为编程智能体暴露一个截图工具。
怎么安装和运行它?从 crates.io 安装(包名 iris-screenshot,安装后的命令是 iris),或用 Rust 工具链从源码构建,然后运行 'iris --full bridger.to' 之类的命令。要在智能体中使用,把 iris mcp 添加到你的 MCP 客户端配置(例如 Codex)里。
除了 Iris 本身,我还需要什么?你需要安装一个 Chrome 系浏览器(Chrome、Chromium、Edge 或 Brave),这是唯一的运行时依赖;从源码构建需要 Rust 1.88 或更新版本。
Iris 做不到什么?它不支持跨域 iframe 的内容,也不支持截取所有 CSS 选择器匹配项(只截第一个),且 --selector 与 --full 冲突。超过 Chrome 约 16k 像素渲染上限的完整页面会自动回退到 @1x。
它是为谁打造的?它面向需要可靠网站视觉验证的编程智能体和开发者,既可以通过 CLI 脚本使用,也可以通过 MCP 直接接入 AI 编程智能体。
Iris 在截图前到底会等什么?它会等待字体、图片加载和入场动画;在 --full 模式下还会先滚动页面以触发懒加载内容再截图,力求截图可信而不是操之过急。
它支持哪些图片格式和分辨率?输出格式由 -o 扩展名或 --format 标志决定:默认 PNG,也可以是 JPG 或 WebP(以质量 90 编码)。默认输出 Retina @2x,除非页面太高超出 Chrome 的渲染上限。
我可以只截取单个元素而不是整个页面吗?可以。--selector 会按文档顺序截取第一个匹配 CSS 选择器的元素,自动把它滚动到可视区域,并在取景前让新出现的内容稳定下来。
批量截图是怎么工作的?Iris 用一个浏览器进程并发开多个标签页;某个 URL 失败会打印一个标记且不会中断批次,但只要有失败,整体退出码就是 1。文件名由 URL 生成,重名时会加 -2、-3 后缀;--json 会向 stdout 输出每个截图对应的 JSON 对象。
Creator
brijr
Size
0.6 MB
Stars
517
Age
2mo
Commits · 90 Days