eyedom
<p align="center">
<img src="assets/banner.svg" alt="EyeDOM — Click any broken DOM element. Stream it straight to your AI coding agent." width="100%" />
</p>
<p align="center">
<a href="https://github.com/cosmicrouter/eyedom/actions/workflows/ci.yml"><img src="https://img.shields.io/github/actions/workflow/status/cosmicrouter/eyedom/ci.yml?style=flat-square&label=CI&labelColor=141416" alt="CI status" /></a>
<a href="https://github.com/cosmicrouter/eyedom/blob/main/LICENSE"><img src="https://img.shields.io/badge/license-MIT-FAFAFA?style=flat-square&labelColor=141416" alt="MIT License" /></a>
<img src="https://img.shields.io/badge/node-%3E%3D18-10B981?style=flat-square&labelColor=141416" alt="Node.js >= 18" />
<img src="https://img.shields.io/badge/MCP-stdio-FAFAFA?style=flat-square&labelColor=141416" alt="Model Context Protocol" />
<img src="https://img.shields.io/badge/browsers-Chrome%20%7C%20Firefox%20%7C%20Safari%20%7C%20Edge-F59E0B?style=flat-square&labelColor=141416" alt="All Browsers" />
</p>
<p align="center">
<a href="#demo">Demo</a> ·
<a href="#quick-start">Quick Start</a> ·
<a href="#features">Features</a> ·
<a href="#supported-ai-agents">Supported Agents</a> ·
<a href="#what-gets-captured">Report Format</a> ·
<a href="#cli-reference">CLI & MCP</a> ·
<a href="#faq">FAQ</a>
</p>
**EyeDOM** is a local browser DOM/CSS bug inspector and universal **MCP (Model Context Protocol) + CLI** bridge for AI coding agents.
Open any local dev server or live website with `eyedom open <url>`, click the broken element, and stream a clean, token-efficient Markdown report directly into **Claude Code, Antigravity, Cursor, Windsurf, VS Code, Gemini CLI, Codex CLI, OpenCode, Zed, Aider**, or any shell workflow. Works across **Chrome, Firefox, Safari, Edge, and Brave**.
---
## Demo
<p align="center">
<img src="assets/demo.gif" alt="EyeDOM Workflow Demo — Setup, Inspect, and AI Agent Fix" width="100%" />
</p>
> Full-resolution MP4: [`assets/demo.mp4`](assets/demo.mp4)
---
## Quick Start
### Install globally from GitHub (recommended)
```bash
npm install -g github:cosmicrouter/eyedom
# 1. Auto-connect EyeDOM MCP to every installed AI CLI & IDE
eyedom setup
# 2. Open any local or live URL with the inspector auto-injected
eyedom open http://localhost:3000
```
### Or run directly without installing
```bash
npx github:cosmicrouter/eyedom setup
npx github:cosmicrouter/eyedom open http://localhost:3000
```
### 3-Step Workflow
1. Run `eyedom open <url>` (e.g. `http://localhost:3000`, `localhost:5173`, or `https://your-staging-app.com`).
2. Click the bottom-right **Inspect** button (or press **`Alt + Shift + D`**) and click the broken element.
3. Ask your AI coding agent: *"Fix the latest captured DOM bug."*
---
## Features
- **Same-Origin Local Reverse Proxy + HMR WebSocket Tunnel (`eyedom open <url>`):** Strips strict `Content-Security-Policy` headers, follows `http -> https` and `www` redirects, tunnels WebSocket `Upgrade` connections so **Vite / Next.js Hot Module Replacement (HMR)** stays live, and serves `/__eyedom/eyedom.js` + `/__eyedom/capture` on the exact same origin.
- **Shadow DOM Isolated Inspector:** The hover highlight frame, dimension/selector badge, and floating controls live inside an isolated Shadow DOM (`z-index: 2147483647`), completely immune to broken host-page CSS.
- **Token-Optimized Layout Extraction:** Filters computed styles down to layout-critical CSS (`display`, `position`, box model, `flex*`, `grid*`, `gap`, `overflow*`, `transform`, `z-index`, `opacity`) and caps `outerHTML` at 1,500 characters so your agent gets signal instead of noise.
- **Overflow & Geometry Diagnostics:** Computes exact `getBoundingClientRect()` coordinates alongside `scrollWidth/clientWidth` and viewport bounds to flag `HORIZONTAL OVERFLOW (X)`, `VERTICAL OVERFLOW (Y)`, and `EXCEEDS VIEWPORT` automatically.
- **Framework Component Trace:** Inspects React (`__reactFiber$` / `__reactInternalInstance$`) and Vue 2/3 (`__vueParentComponent` / `__vue__`) internals to report the exact component name and ancestor tree (`PricingCard -> DashboardPage`).
- **Parent Layout Context:** Captures the immediate 2 ancestor elements (`L1`, `L2`) with their layout styles (`display`, `position`, `overflow`, `width`, `height`) — critical for debugging flex/grid shrinking and clipping issues.
- **Live Console & Runtime Errors:** Hooks `console.error`, `window.onerror`, and `unhandledrejection` to attach the last 5 runtime errors to every capture.
- **Multi-Agent Port Safety (`EADDRINUSE`):** Run Claude Code, Antigravity, Cursor, and OpenCode simultaneously without port `4789` collisions. Secondary MCP processes seamlessly fall back to file-backed reads from `~/.eyedom/`.
- **Offline Clipboard Fallback:** If the local server is stopped, EyeDOM automatically formats the captured element as Markdown and copies it to your clipboard.
- **Minimal Local Workspace (`http://127.0.0.1:4789`):** Monochrome split-view workspace to launch any URL, browse the last 10 captures, preview/copy Markdown reports, and connect local agents in one click.
---
## Real-World Workflows
### 1. Local Dev Server (Vite, Next.js, Remix, SvelteKit, Astro)
```bash
eyedom open http://localhost:3000
```
Click the overflowing card or misaligned navbar item → switch to Claude Code / Cursor / Antigravity → *"Fix the latest captured DOM bug."*
### 2. Live Staging or Production HTTPS Site (Strict CSP)
```bash
eyedom open https://staging.example.com/checkout
```
EyeDOM proxies the site locally, removes CSP blocks, injects the inspector, and reports the original `https://staging.example.com/checkout` URL in the bug report.
### 3. Pipe Directly into Any CLI Agent (Aider, Claude, Custom Scripts)
```bash
eyedom latest | claude
eyedom latest | aider --message-file -
eyedom latest --json | jq '.geometry'
```
### 4. Direct Script Tag (Optional, No Proxy Needed)
If you only debug your own local HTML and prefer not to use the proxy, start `eyedom start` and drop one line into your dev HTML:
```html
<script src="http://127.0.0.1:4789/eyedom.js"></script>
```
---
## Supported AI Agents
`eyedom setup` auto-detects installed agents across **Linux, macOS, and Windows** and safely merges the `eyedom` MCP entry without touching your existing configuration:
| Agent | Config Path | Schema | Auto-Setup |
|---|---|---|---|
| **Claude Code** | `~/.claude.json` | `mcpServers` (JSON) | `eyedom setup` |
| **Claude Desktop** | `Claude/claude_desktop_config.json` | `mcpServers` (JSON) | `eyedom setup` |
| **Antigravity** | `~/.gemini/antigravity/mcp_config.json` | `mcpServers` (JSON) | `eyedom setup` |
| **Cursor** | `~/.cursor/mcp.json` | `mcpServers` (JSON) | `eyedom setup` |
| **Windsurf** | `~/.codeium/windsurf/mcp_config.json` | `mcpServers` (JSON) | `eyedom setup` |
| **VS Code (Copilot MCP)** | `Code/User/mcp.json` | `servers` (JSON) | `eyedom setup` |
| **Gemini CLI** | `~/.gemini/settings.json` | `mcpServers` (JSON) | `eyedom setup` |
| **Codex CLI** | `~/.codex/config.toml` | `[mcp_servers]` (TOML) | `eyedom setup` |
| **OpenCode** | `~/.config/opencode/opencode.json` | `mcp` (JSON) | `eyedom setup` |
| **Zed** | `~/.config/zed/settings.json` | `context_servers` (JSON) | `eyedom setup` |
| **Aider / Any Pipe CLI** | `stdout` / `~/.eyedom/latest.md` | Pipe (`\|`) | `eyedom latest \| aider --message-file -` |
<details>
<summary>Manual MCP configuration snippets</summary>
**Claude Code:**
```bash
claude mcp add eyedom -- eyedom mcp
```
**Antigravity / Cursor / Windsurf / Claude Desktop:**
```json
{
"mcpServers": {
"eyedom": {
"command": "eyedom",
"args": ["mcp"]
}
}
}
```
**VS Code (`mcp.json`):**
```json
{
"servers": {
"eyedom": {
"type": "stdio",
"command": "eyedom",
"args": ["mcp"]
}
}
}
```
**Codex CLI (`~/.codex/config.toml`):**
```toml
[mcp_servers.eyedom]
command = "eyedom"
args = ["mcp"]
```
**OpenCode (`~/.config/opencode/opencode.json`):**
```json
{
"mcp": {
"eyedom": {
"type": "local",
"command": ["eyedom", "mcp"],
"enabled": true
}
}
}
```
</details>
---
## What Gets Captured
Every click writes an atomic Markdown report to `~/.eyedom/latest.md`, full JSON to `~/.eyedom/latest.json`, and updates the rolling 10-capture log in `~/.eyedom/history.json`:
```markdown
# EyeDOM Element Bug Report
- **Capture ID:** `cap_m9x4k2_a1f0`
- **Captured At:** 2026-11-28T20:33:11.885Z
- **Page URL:** http://localhost:3000/dashboard
- **Viewport:** 1440x900px (DPR: 2)
- **Framework:** React `<PricingCard />` (tree: `PricingCard` -> `DashboardPage`)
## 1. Element Identity
- **Tag:** `<div>`
- **ID:** `#pro`
- **Classes:** `pricing-card`, `overflow-bug`
- **Unique Selector:** `#pro`
### outerHTML
```html
<div id="pro" class="pricing-card overflow-bug">...</div>
```
## 2. Geometry & Overflow
- **Bounding Rect:** x=348px, y=160px, width=260px, height=190px
- **Scroll vs Client:** scroll=320x190px, client=260x190px
- **Overflow Status:** HORIZONTAL OVERFLOW (X)
## 3. Computed Layout Styles
```css
display: flex;
position: relative;
box-sizing: border-box;
width: 260px;
height: 190px;
overflow-x: visible;
```
## 4. Parent Context
- **Direct Parent (L1):** `section#grid-wrap.cards-grid`
- Layout: `display: grid; position: relative; overflow: hidden; width: 960px; height: 400px`
## 5. Recent Console & Runtime Errors (Last 5)
1. (console.error) Warning: Each child in a list should have a unique key prop.
```
---
## Architecture
```mermaid
flowchart LR
Browser["Browser (Any Site via eyedom open)"] -->|"Same-origin POST /__eyedom/capture"| Proxy["EyeDOM Reverse Proxy + Receiver (127.0.0.1:4789)"]
Proxy -->|"Atomic write (last 10)"| Store["~/.eyedom/ (latest.md, latest.json, history.json)"]
Store -->|"MCP stdio (EADDRINUSE-safe)"| Agents["Claude Code · Antigravity · Cursor · Windsurf · VS Code · Codex · OpenCode · Zed"]
Store -->|"eyedom latest | ..."| CLI["Aider & Shell Pipelines"]
```
---
## CLI Reference
| Command | Description |
|---|---|
| `eyedom setup [--all]` | Auto-detect and connect EyeDOM MCP to all installed AI CLIs & IDEs. Pass `--all` to generate configs for all supported tools. |
| `eyedom open <url> [--no-open]` | Launch a same-origin local reverse proxy with EyeDOM auto-injected and open it in your default browser. |
| `eyedom start` | Start the minimal local workspace and HTTP receiver at `http://127.0.0.1:4789`. |
| `eyedom mcp` | Run the standard stdio MCP server (automatically falls back to file-backed mode if port `4789` is already occupied). |
| `eyedom latest [--json]` | Print the latest captured DOM bug to `stdout` (`eyedom latest \| claude`). |
| `eyedom list` | Print a Markdown summary table of the last 10 captures. |
| `eyedom status` | Check if the local EyeDOM server is running. |
| `eyedom clear` | Clear all captures from memory and `~/.eyedom/`. |
---
## MCP Tools
| Tool | Parameters | Description |
|---|---|---|
| `get_latest_dom_bug` | _none_ | Returns the full Markdown report for the most recently captured element. |
| `list_dom_captures` | _none_ | Lists a summary table (ID, timestamp, URL, selector, overflow flags) of the last 10 captures. |
| `get_dom_capture_by_id` | `{ id: string }` | Returns the full Markdown report for a specific capture ID. |
| `clear_dom_captures` | _none_ | Clears all stored capture history from memory and `~/.eyedom/`. |
---
## HTTP API (`127.0.0.1:4789`)
- `GET /` — Minimal local EyeDOM workspace (URL launcher, live captures, Markdown viewer, one-click `Connect Agents`)
- `POST /api/proxy` — Launches a same-origin reverse proxy for `{ "url": "..." }`
- `POST /api/setup` — Runs auto-setup for all detected local AI agents
- `GET /eyedom.js` — Standalone Shadow DOM inspector bundle
- `POST /capture` — Receives and persists a DOM capture payload
- `GET /api/captures` / `DELETE /api/captures` — List or clear stored captures
- `GET /health` — Server status JSON
## Environment Variables
| Variable | Default | Description |
|---|---|---|
| `EYEDOM_HOST` | `127.0.0.1` | Bind host for the local HTTP server and proxies |
| `EYEDOM_PORT` | `4789` | Port for the main EyeDOM workspace and receiver |
| `EYEDOM_DIR` | `~/.eyedom` | Storage directory for `latest.md`, `latest.json`, and `history.json` |
---
## Privacy & Security
- **100% Local:** EyeDOM binds exclusively to `127.0.0.1` by default.
- **Zero Telemetry:** No analytics, no cloud relay, no external API calls.
- **Atomic Local Storage:** Captures are written only to `~/.eyedom/` on your machine and cleared anytime with `eyedom clear`.
---
## FAQ
**My AI agent doesn't see EyeDOM tools right after `eyedom setup`.**
Restart your AI CLI or IDE session once so it reloads its MCP server configuration.
**Can I run Claude Code, Antigravity, and Cursor at the same time?**
Yes. The first process binds to `127.0.0.1:4789`; every additional `eyedom mcp` instance detects `EADDRINUSE` and silently reads the shared atomic store in `~/.eyedom/`.
**Does it work on websites with strict CSP or HTTPS?**
Yes. `eyedom open <url>` proxies the target site on `127.0.0.1`, strips CSP headers, and serves both the inspector script and capture endpoint on the same origin.
---
## Development & Contributing
```bash
git clone https://github.com/cosmicrouter/eyedom.git
cd eyedom
npm install
npm test
```
Pull requests and issues are welcome. Please run `npm test` before submitting changes.
## License
[MIT](LICENSE) © 2026 [cosmicrouter](https://github.com/cosmicrouter)
TDQS
Scored across 4 tools
Each tool has a clearly distinct role: fetch the newest capture, enumerate recent captures, fetch one capture by ID, and wipe history. The only near-overlap (get_latest_dom_bug vs get_dom_capture_by_id) is made explicit by the names and descriptions, so selection is unambiguous.
All four names follow a snake_case verb_noun pattern (get_/list_/clear_ + dom resource). The only wrinkle is vocabulary drift between 'dom_bug', 'dom_capture', and 'dom_captures' for what is effectively the same object, but the pattern itself is predictable.
Four tools is a tight, well-scoped surface for a passive capture-inspection server where the browser extension does the capturing. It is slightly lean — no per-capture deletion or filtering — but nothing feels redundant or padded.
The read lifecycle (latest, list, get-by-ID) plus a bulk clear covers the core workflow with no dead ends. Minor gaps exist: no delete of an individual capture, no search/filter by URL or selector, and no way to distinguish 'clear history' from 'reset state' beyond the single bulk operation.