Skip to content
plugmcp
DirectorySkillsCategoriesBlog
EN/δΈ­ζ–‡
Sign inSign up
Home/Servers/Cornea, Deterministic Visual Inspection

Cornea, Deterministic Visual Inspection

I
by io.github.AbduljabbarBXR

Deterministic visual inspection for AI agents. Overlap, overflow, contrast, quality.

Power your agent

Add this server

The publisher's own command. Not a PlugMCP endpoint.

Local command
cargo cornea
Provider
Claude Code
claude mcp add io.github.abduljabbarbxr-cornea -- cargo cornea

Run in a terminal.

Claude Desktop
{
  "mcpServers": {
    "io.github.abduljabbarbxr-cornea": {
      "command": "cargo",
      "args": [
        "cornea"
      ]
    }
  }
}

claude_desktop_config.json

Step-by-step: add this in Claude

Remote URL or a command on your machine? How the two installs differ

Run on PlugMCP

Host a copy with our keys and logs.

A new server you create. It is not this listing's official endpoint. Use the publisher install when you want their URL and their credentials.

Launch

Related MCP

View more
  • FirecrawlπŸ”₯ Official Firecrawl MCP Server - Adds powerful web scraping and search to Cursor, Claude and any other LLM clients.
  • N
    NotionToken-auth Notion MCP: pages, databases, blocks, comments, files. Runs headless in CI and agents.
  • Context7Context7 Platform -- Up-to-date code documentation for LLMs and AI code editors

Related skills

View all
  • reaReverse engineer anything with agents, from app behavior down to native binaries.
  • rea-changelog-updatePrepare or rewrite REA release changelogs and GitHub release notes from pinned Git history, with verified contributor thanks and Release Please synchronization.
  • rea-tool-designDesign or change REA investigation tools, CLI/MCP contracts, provider capabilities, and Evidence semantics.

Deterministic visual inspection for AI agents. Overlap, overflow, contrast, quality.

Cornea

Deterministic visual inspection for AI agents. The eyes a coding agent never had.

Cornea gives a coding agent that builds web pages a real way to see them. As a token-cheap, deterministic structural model it can reason over exactly, instead of megabytes of screenshots and raw DOM dumped into context.

An agent doesn't need a photo of a page. It needs to know is my layout broken, and how. Cornea computes an abstract visual geometry model of every element (box, position, z-order, computed styles) and derives inspection conclusions. overlap, overflow, contrast, quality. Then exposes them as native tools on three surfaces: CLI, MCP, and HTTP API.

One promise holds everything together: same input β†’ byte-identical output. No Chromium, no sub-pixel variance, no server. A single ~1.4 MB binary.


Quick start

# Build (Rust 1.98+, edition 2024)
cargo build --release

# Inspect a file, the simplest way to use Cornea
./target/release/cornea tests/fixtures/sample-bugs.html 360

Requires only cargo. No browser, no Node, no system dependencies. Builds fine on a phone-class device.

Or install the cornea command from npm (no Rust toolchain needed):

npm install -g optrex   # provides the cornea command
cornea --help

Visual guide: what Cornea does

Take this page below. It looks fine as source. But it's hiding four layout bugs. Cornea finds every one.


<section class="row">
  <div class="card">Card 1</div><div class="card">Card 2</div><div class="card">Card 3</div>
</section>
<div class="overlap-left">Left overlap</div>   
<div class="overlap-right">Right overlap</div> 
<div class="overflow-bad">...</div>            
<p class="low-contrast">Hard to read on white</p>  

Run it and Cornea reports the damage instantly:

$ ./target/release/cornea tests/fixtures/sample-bugs.html 360

{
  "html_file": "tests/fixtures/sample-bugs.html",
  "viewport_w": 360.0,
  "element_count": 17,
  "est_tokens": 1068,                      // <-- entire page read for ~1k tokens
  "report": {
    "total_elements": 17,
    "visible_elements": 14,
    "overlaps": [ ... 7 collisions ... ],
    "overflows": [ ... 1 clipped ... ],
    "contrast":  [ ... 2 AA failures ... ],
    "quality":   { "score": 0.06, "label": "broken" }
  }
}

Each finding is precise and actionable:

FindingDetail
Overlapsection.row ⇄ div.overlap-right, area 20000 pxΒ². The absolutely-positioned boxes cover the cards
Overflowdiv.overflow-bad: right edge 600 exceeds viewport 360 β†’ clipped
Contrastblack on blue: ratio 2.44:1. Fails WCAG AA (needs 4.5)
Contrast#cccccc on white: ratio 1.61:1. Fails WCAG AA

That is the value: hundreds of tokens, not hundreds of kilobytes, and a deterministic answer the agent can act on and re-verify.


Visual guide: the three surfaces

Cornea is one engine, three doors. All three returns identical inspection JSON because they funnel through a single shared dispatch.

1. CLI. Inspect a file

cornea <file.html | http(s)://url> [viewport_width] [viewport_height] [--js]
$ cornea page.html 360
{
  "html_file": "page.html",
  "viewport_w": 360.0,
  "element_count": 42,
  "json_bytes": 8124,
  "est_tokens": 2193,
  "report": { "total_elements": 42, "visible_elements": 38, "overlaps": [], "overflows": [], "contrast": [], "quality": { "score": 1.0, "label": "good" } }
}

2. MCP. Native agent tools over stdio

cornea --serve

An agent calls layout.* tools directly; it passes the page source, or a live URL (see URL capture below), per call:

β†’ {"method":"tools/call","params":{"name":"layout.overlaps",
     "arguments":{"html":"<div style=\"position:absolute;left:20;top:20;width:200;height:100\">A</div>..."
                   ,"width":360}}}
← {"id":1,"result":{"content":[{"text":"[{\"a_sel\":\"...div \u21c4 ...div\",\"area\":20000}]"}]}}
ToolReturns
layout.inspectFull visual model + report
layout.overlapsElements whose boxes collide
layout.overflowClipped / collapsed / off-screen
layout.contrastWCAG AA ratios for text elements
layout.quality0..1 health score + issue list
layout.fidelityWhich CSS features are exact vs approximated

3. HTTP API. Call from anything

cornea --serve-http [addr]        # default 127.0.0.1:8080
curl -s -X POST http://127.0.0.1:8080/inspect \
  -H 'Content-Type: application/json' \
  -d '{"html":"<p style=\"color:#cccccc\">bady</p>","width":360}'
{"total_elements":1,"contrast":[{"selector":"...>p","fg":"#cccccc","bg":"#ffffff",
                                 "ratio":1.61,"pass_aa":false}]}
RouteMethodReturns
/inspectPOSTFull report
/overlapsPOSTCollisions
/overflowPOSTClipped / collapsed / off-screen
/contrastPOSTWCAG ratios
/qualityPOSTHealth score
/fidelityGETEngine capabilities
/healthGETLiveness

Watching a live page (URL capture)

Every surface accepts a URL where the HTML would go. Cornea fetches the page, inlines its external stylesheets and external scripts (relative URLs resolved against the page), then inspects what a browser would actually show. That is the live coding session loop: run your dev server, point cornea at it, read the layout verdict.

cornea http://localhost:3000 390
{ "url": "http://localhost:3000", "width": 390, "height": 844 }  // HTTP /inspect
{ "method": "tools/call", "params": { "name": "layout.quality",
  "arguments": { "url": "http://localhost:3000", "width": 390 } } }  // MCP

Honesty around capture:

  • Failed fetches leave the original tag in place and record a note, so the report warnings still flag what did not load.
  • A positive height emulates a fixed viewport (screenshot frame, iframe, email) and enables below the fold clipping checks. Default 0 means an unbounded scrolling page.
  • Capture is a snapshot in time. Determinism holds engine side: the same fetched bytes always produce the same report.
  • Plain HTTP is supported natively. HTTPS pages need a TLS stack, which the binary does not carry; capture from a local http dev server or pre inline the page with a fetch layer of your own.

Architecture

                    β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
   HTML + CSS ──►   β”‚           cornea (one binary)       β”‚
                    β”‚                                     β”‚
                    β”‚   dom.rs      html5ever ──► tree    β”‚
                    β”‚   css.rs      <style> + inline      β”‚
                    β”‚                                    β”‚
                    β”‚   layout.rs   deterministic layout  β”‚
                    β”‚               (block/inline/flex,   β”‚
                    β”‚                box model, z-index)  β”‚
                    β”‚                    β”‚                β”‚
                    β”‚   model.rs    Visual Geometry Model β”‚
                    β”‚                    β”‚                β”‚
                    β”‚   inspect.rs  overlap / overflow /  β”‚
                    β”‚               contrast / quality    β”‚
                    β”‚                    β”‚                β”‚
                    β”‚   rest.rs     canonical dispatch    β”‚
                    β””β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
                            β”‚             β”‚
                      β”Œβ”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”   β”Œβ”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
                      β”‚  CLI     β”‚   β”‚  MCP (stdio) / HTTPβ”‚
                      β”‚  cornea  β”‚   β”‚  layout.* / REST   β”‚
                      β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜   β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

Read the full technical spec: CORNEA-ARCHITECTURE.md


Fidelity. Honest about what's approximate

Cornea never silently fakes precision. layout.fidelity tells an agent exactly what it can trust, and every report carries its own warnings for sources the engine saw but did not apply (external stylesheets, external scripts, media queries, unresolved colors):

{
  "exact":        ["box model", "block flow", "inline text estimates", "flex row/column (no wrap)",
                   "z-index", "visibility", "absolute/fixed left/top", "inline styles",
                   "class/id/tag selectors", "WCAG contrast (hex, rgb, hsl, alpha)"],
  "approximate":  ["text glyph width (not shaping)", "flex-grow/flex-basis distribution",
                   "percentage widths", "overlap semantics ignore intentional stacking"],
  "deferred":     ["grid (parsed as block flow)", "media queries", "border-radius",
                   "external stylesheet <link> when not captured",
                   "complex selectors (combinators, pseudo)"],
  "js": {
    "engine":      "boa",
    "phase":       "A",
    "enabled":     "opt-in via --js / js:true",
    "dom_shim":    "static HTML mirrored in first; getElementById; innerHTML parses markup",
    "unsupported": ["async APIs", "event dispatch", "selector engine", "React/SPA mounting (Phase B)"]
  }
}

JavaScript built-in pages (Phase A)

Cornea can execute inline <script> that builds its DOM via a minimal shim, then run the result through the same deterministic layout engine:

cornea page.html 360 --js            # inline scripts build the DOM first
{ "html": "<p>…</p>", "width": 360, "js": true }   // HTTP /inspect and MCP layout.*
  • Static HTML is mirrored into the shim before scripts run, so scripts can attach to existing nodes via document.getElementById, and innerHTML parses real markup into elements. Static content survives script runs.
  • style.* assignments are serialized back to style="…" and participate in overlap/contrast checks.
  • Async APIs are rejected (setTimeout, fetch, …) rather than hung. Any such use is surfaced in the report's js_notes, so determinism stays a guarantee.
  • External <script src> runs only when a capture layer (URL capture) inlined its body first.
  • Full React/SPA mounting is Phase B (experimental). Tracked in ROADMAP-JS.md.

Visual guide: testing (battle-tested)

54 tests run clean with cargo test; CI enforces fmt, clippy -D warnings, release build, tests, and a CLI smoke test on every push.

$ cargo test
Running unittests src/lib.rs      ... 36 passed   // determinism, overlap, overflow,
Running unittests src/main.rs     ...  9 passed    //   contrast, inline flow, flex,
Running tests/endpoints.rs        ...  9 passed    //   nesting, empty input, MCP, CLI, JS, capture
  • Determinism. Same page inspected twice gives byte-identical JSON (the core thesis).
  • Bug detection. The fixture's overlaps, overflows, and contrast failures are all asserted.
  • End-to-end. The compiled binary is spawned and layout.* is called over real stdio MCP.
  • HTTP. The TCP server boots on an ephemeral port and real requests are made.
  • Live capture. A real page is served over a local socket; linked CSS must change a contrast verdict.
  • Edge cases. Empty HTML, deep nesting (no crash), display:none, long text, flex row/col, inline wrapping.

Layout support (v1 scope)

FeatureStatus
Block flow, box model (content/border-box)exact
Inline text runs (horizontal, wrapping)exact
Flex row / column (simplified, no wrap)approximate
Absolute / fixed positioning (left/top)exact
z-index, visibility, display:noneexact
.class / #id / tag selectors + inline stylesexact
WCAG contrast (hex, rgb, hsl, alpha, inherited colors)exact
Live URL capture (CSS and script inlining)supported
Grid, media queries, border-radiusdeferred

Repository layout

cornea/
β”œβ”€β”€ Cargo.toml             # crate: html5ever + serde/serde_json, release LTO+strip
β”œβ”€β”€ README.md              # this file
β”œβ”€β”€ CORNEA-ARCHITECTURE.md # full technical spec
β”œβ”€β”€ src/
β”‚   β”œβ”€β”€ lib.rs             # build_model / analyze pipeline + unit tests
β”‚   β”œβ”€β”€ dom.rs             # html5ever -> lightweight element tree
β”‚   β”œβ”€β”€ css.rs             # <style> + inline style resolution
β”‚   β”œβ”€β”€ fetch.rs           # live URL capture: GET + css/script inlining
β”‚   β”œβ”€β”€ layout.rs          # deterministic layout engine
β”‚   β”œβ”€β”€ model.rs           # VisualModel / ElementView / Rect
β”‚   β”œβ”€β”€ inspect.rs         # overlap / overflow / contrast / quality / warnings
β”‚   β”œβ”€β”€ rest.rs            # canonical endpoint dispatch (shared by all surfaces)
β”‚   β”œβ”€β”€ main.rs            # CLI + stdio MCP server
β”‚   └── server_http.rs     # dependency-free HTTP/1.1 API
β”œβ”€β”€ tests/
β”‚   β”œβ”€β”€ endpoints.rs       # end-to-end CLI + MCP binary tests
β”‚   └── fixtures/sample-bugs.html  # known-bug fixture for CI smoke
└── .github/workflows/ci.yml

Status

Working MVP, hardened and battle-tested. Deterministic inspection engine with CLI + MCP + HTTP API, live URL capture, below the fold checks, report warnings, 54 passing tests, green CI, plus Phase A inline-script rendering (--js). The roadmap builds toward giving Cornea (and the sibling Crayon text-to-image project) an even richer perception over subsequent phases.

Publishing

Cornea is distributed four ways: npm (npm install -g optrex, gives the cornea command), crates.io (cargo install cornea), GitHub Release + Homebrew (brew install), and the MCP Registry (layout.* tools discoverable by agents). All are staged in this repo. See PUBLISHING.md for the tokens, server.json manifest, and the release/tag recipe.

mcp-name: io.github.AbduljabbarBXR/cornea

License

MIT. See LICENSE.

How do I install Cornea, Deterministic Visual Inspection?
Copy the stdio config for Cursor, Claude Desktop, Claude Code, or VS Code on this page. It uses the publisher's install, not a PlugMCP proxy.
Does Cornea, Deterministic Visual Inspection need an API key?
No required environment variable is listed on this record.
What transport does Cornea, Deterministic Visual Inspection use?
Cornea, Deterministic Visual Inspection runs locally over stdio.
When was Cornea, Deterministic Visual Inspection last checked?
Last checked 2026-10-16. Deterministic visual inspection for AI agents. Overlap, overflow, contrast, quality.

No tool list yet. Remote servers get one after the first health check.

plugmcp

Plug any tool into any agent. MCP servers for people who do not write servers. Gateway for volume, n8n for apps.

  • github.com/TODO
  • x.com/TODO
  • linkedin.com/company/TODO

PlugMCP, 2026

Product
  • Browse
  • Install
  • Host your own
  • Voice mode
  • Browser
Directory
  • All MCP servers
  • Agent skills
  • Categories
  • New
  • Voice
  • Submit a server
Developers
  • Docs
  • Blog
  • What is MCP
  • What is WebMCP
  • Status
Company
  • About
  • Contact
  • Terms
  • Privacy
  • DPA