Skip to main content
Glama
bishoku

DOMRay MCP Server

Official
by bishoku

DOMRay ⚑

DOMRay β€” Browser-to-MCP Runtime Telemetry Bridge

The Missing Runtime Telemetry Bridge for AI Coding Agents.
Give your AI assistants (Cursor, Claude Code, Antigravity, Windsurf) real-time vision into active browser sessions β€” including web pages behind SSO, 2FA, VPNs, and dynamic client-side state β€” via standard Model Context Protocol (MCP).

License: MIT TypeScript Chrome Extension MV3 MCP Standard PRs Welcome


πŸ›‘ The Problem: The Runtime Blindspot of AI Coding

AI coding agents have revolutionized software development. Tools like Cursor, Claude Code, Windsurf, and Copilot understand your static codebase, git history, syntax trees, and type definitions with astonishing precision.

However, the moment your application runs in a browser, your AI coding agent becomes completely blind.

β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
β”‚                   THE RUNTIME GAP                      β”‚
β”‚                                                        β”‚
β”‚  Static World (AI has 100% Context):                   β”‚
β”‚  βœ“ Source Code & Git History                          β”‚
β”‚  βœ“ Abstract Syntax Trees & Types                       β”‚
β”‚  βœ“ Project Files & Dependencies                        β”‚
β”‚                                                        β”‚
β”‚  =================== BLIND SPOT =====================  β”‚
β”‚                                                        β”‚
β”‚  Runtime World (AI has 0% Context):                    β”‚
β”‚  βœ— Pages behind SSO, 2FA, VPNs, or Staging Auth        β”‚
β”‚  βœ— Real-time React / Vue internal component state      β”‚
β”‚  βœ— Causal user interaction sequences (Breadcrumbs)     β”‚
β”‚  βœ— Failed API responses and HTTP 4xx/5xx payloads      β”‚
β”‚  βœ— Console warnings and client storage (session/local) β”‚
β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

Where Current Practices Fail:

  1. The Authentication & Security Wall (SSO / 2FA / Staging):
    Autonomous headless agents (e.g. Puppeteer/Playwright scripts) cannot log into internal staging environments, corporate VPNs, or apps protected by Okta/Google 2FA without complex credential passing or unsafe cookie sharing.

  2. The "Manual Copy-Paste" Tax:
    When a bug occurs, developers waste time opening DevTools, copying messy stack traces, exporting HAR network logs, taking screenshots, and hand-crafting prompts for their AI. By the time the context is assembled, critical temporal details are lost.

  3. Silent State Bugs (No Errors Thrown):
    Many of the hardest frontend bugs don't throw an uncaught exception (e.g. "The submit button is permanently stuck on 'Applying...', no error is in the console, and the cart total didn't change"). Static code analysis cannot tell the AI whether isSubmitting in React Fiber or a Vue ref is currently stuck at true.

  4. The Automated Testing Disconnect:
    After discovering and manually reproducing a bug in the browser, translating that discovery into resilient, production-ready Playwright/Cypress E2E specs or MSW API mock handlers requires another round of manual, error-prone boilerplate coding.


Related MCP server: @nimbus21.ai/chrome-devtools-mcp

πŸ’‘ The Solution: DOMRay

DOMRay bridges the gap between your active browser runtime and your AI coding agent.

Instead of trying to automate a separate, detached browser instance, DOMRay connects directly to the living, authenticated browser tab you are already using as a developer.

Using the Chrome DevTools Protocol (CDP) and the open Model Context Protocol (MCP), DOMRay securely streams structured runtime telemetry into your AI agent's tool context while providing you with 100% visibility through a native Chrome Side Panel.

+-----------------------------------------------------------------------------------------+
|                                    DOMRay WORKFLOW                                      |
|                                                                                         |
| 1. DEVELOPER INTERACTS             2. DOMRAY CAPTURES             3. AI AGENT REPAIRS   |
|                                                                                         |
|   β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”         β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”         β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”  |
|   β”‚ Authenticated Browser  β”‚         β”‚ DOMRay Extension  β”‚         β”‚ AI Agent (MCP)  β”‚  |
|   β”‚ (SSO / 2FA Active)     β”‚ ──────> β”‚ - User Actions    β”‚ ──────> β”‚ Cursor / Claude β”‚  |
|   β”‚ User clicks "Apply",   β”‚         β”‚ - Failed Network  β”‚         β”‚ Queries state,  β”‚  |
|   β”‚ button freezes!        β”‚         β”‚ - Fiber State     β”‚         β”‚ generates fix & β”‚  |
|   β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜         β”‚ - Edge Redaction  β”‚         β”‚ E2E test specs! β”‚  |
|                                      β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜         β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜  |
+-----------------------------------------------------------------------------------------+

What DOMRay Gives You & Your AI:

  • πŸ” Zero-Friction Context: Your AI can inspect runtime exceptions, network request histories, and client storage on demand.

  • πŸ–±οΈ Causal Flow Reconstruction: Replays the exact sequence of clicks, form entries, and SPA navigations that triggered an issue.

  • βš›οΈ Framework State X-Ray: Traverses React 18/19 Fiber trees (hooks unrolled into useState, useReducer, props) and Vue 3 reactive ref() / computed() components.

  • 🎬 Instant E2E Test Blueprints (domray_get_test_blueprint): Converts recorded user actions and network events directly into runnable, resilient Playwright or Cypress test specs.

  • 🌐 Auto MSW Mock Handlers (domray_get_mock_handlers): Automatically synthesizes Mock Service Worker v2 handlers from real failed HTTP 4xx/5xx network transactions.

  • πŸ“‹ 1-Click AI Context Capsule: Copies an edge-redacted, Markdown-formatted diagnostic report to your clipboard for instant pasting into web ChatGPT, Claude, or GitHub Issues.


πŸ›οΈ Architecture & Technology Stack

DOMRay is built as a lightweight, local-first monorepo designed for performance and zero cognitive overhead.

[Target Web Page (SSO / 2FA / Strict CSP)]
       β”‚
       β”œβ”€β”€ User Interaction Tracker (Content Script)
       β”‚     β”œβ”€β”€ Captures: clicks, inputs, submits, SPA route changes
       β”‚     └── W3C Accessible Name resolution (label[for], aria-labelledby)
       β”‚
       β”‚ (Chrome DevTools Protocol - CDP via chrome.debugger)
       β–Ό
[Chrome Extension (Manifest V3)]
  β”œβ”€β”€ Service Worker
  β”‚     β”œβ”€β”€ CDP Client (Runtime.enable, Network.enable, consoleAPICalled)
  β”‚     β”œβ”€β”€ In-Memory Ring Buffers (Errors, Network, Breadcrumbs, Console)
  β”‚     β”œβ”€β”€ Edge Redaction Engine (Masks Authorization, Cookie, Passwords BEFORE dispatch)
  β”‚     └── WebSocket Client (Loopback with keepalive heartbeat)
  β”œβ”€β”€ Popup UI (1-Click Auto-Pairing, Re-attach, Quick Actions)
  └── πŸ–₯️ Live Telemetry & AI Audit Side Panel (chrome.sidePanel)
         β”œβ”€β”€ πŸ€– Live AI Audit Feed (Watches agent tool queries in real time)
         β”œβ”€β”€ πŸ”΄ Exceptions, Stack Traces & Live User Breadcrumbs
         β”œβ”€β”€ 🎯 Visual Element Inspector (Hover highlighter & component name)
         └── 🧹 1-Click State & Buffer Reset Control
       β”‚
       β”‚ Localhost Loopback (ws://127.0.0.1:9123)
       β”‚ Auth: Origin Validation + Ephemeral Cryptographic Token
       β–Ό
[Local DOMRay MCP Server (Node.js/TypeScript)]
  β”œβ”€β”€ Hybrid HTTP + WebSocket Bridge
  β”‚     β”œβ”€β”€ POST /pair (Zero-config 1-click handshake & origin registration)
  β”‚     └── WS Inbound/Outbound (Telemetry streams + Bidirectional DOM/State queries)
  β”œβ”€β”€ Session Store (Ring buffers, active tab tracking, callback registry)
  β”œβ”€β”€ Semantic DOM Sanitizer & Token Pruner (-85% LLM token consumption)
  └── MCP stdio Transport (JSON-RPC 2.0 over stdin/stdout)
       β”‚
       β–Ό
[AI Coding Agent (Cursor / Claude Code / Antigravity / Windsurf)]
  └── Standard MCP Tools (10 specialized tools)

Technologies Used:

  • Protocol Standard: Model Context Protocol (MCP) via @modelcontextprotocol/sdk.

  • Browser Automation & Telemetry: Chrome DevTools Protocol (chrome.debugger API) under Manifest V3.

  • UI & Developer Experience: Chrome native chrome.sidePanel for docked, persistent telemetry monitoring.

  • Testing & Mocks: Playwright for resilient E2E automation and MSW v2 for API mocking.

  • Core Languages: 100% TypeScript with strict typing, bundled with tsup and esbuild.


πŸ›‘οΈ Enterprise Security, Privacy & Zero-Data-Leak Guarantees

DOMRay was architected from day one for strict corporate environments, regulated data, and internal staging applications:

  1. πŸ”’ 100% Local-First (No Cloud, No Third Parties):
    DOMRay has zero external servers. Telemetry never leaves your local machine (127.0.0.1). There are no analytics, no tracking, and no external API dependencies.

  2. πŸ›‘οΈ Edge-Side Redaction Engine:
    Data masking occurs inside the browser extension before dispatching over the local WebSocket:

    • Sensitive HTTP headers (Authorization, Cookie, Set-Cookie, X-API-Key) are replaced with ***MASKED***.

    • Sensitive URL query parameters (token, password, secret, key) are automatically scrubbed.

    • Form inputs (type="password", data-private, card numbers, CVVs) never leak their values into breadcrumbs.

  3. πŸ” Origin Validation & CSWSH Protection:
    The local WebSocket bridge rejects any connection whose Origin header is not an authorized chrome-extension://<EXTENSION_ID>. Regular web pages and external domains are immediately rejected with HTTP 403.

  4. πŸ”‘ Ephemeral Cryptographic Tokens:
    Every time the MCP server starts, it generates a cryptographically random 32-byte session token validated via crypto.timingSafeEqual.

  5. πŸ‘οΈ 100% Transparent AI Audit Feed:
    Through the native Chrome Side Panel, developers see a live feed of every tool call the AI executes, including tool parameters, timestamp, and returned payloads. You are never left wondering what data the AI requested.


⚑ Quick Start

1. Clone and Build

# Clone the repository
git clone https://github.com/bishoku/domray.git
cd domray

# Install dependencies across monorepo workspaces
npm install

# Build both the MCP server and the Chrome Extension
npm run build

2. Load the Extension into Google Chrome

  1. Navigate to chrome://extensions in Chrome.

  2. Enable Developer mode (toggle in the top-right corner).

  3. Click Load unpacked and select the directory:

    domray/extension/dist/
  4. The DOMRay icon will appear in your Chrome toolbar. Pin it for quick access.

3. Configure Your AI Coding Agent

Add DOMRay to your AI agent's MCP configuration:

For Cursor (~/.cursor/mcp.json or Cursor Settings > Features > MCP):

{
  "mcpServers": {
    "domray": {
      "command": "node",
      "args": ["/ABSOLUTE/PATH/TO/domray/mcp-server/dist/index.js"]
    }
  }
}

For Claude Code (claude_desktop_config.json or project config):

{
  "mcpServers": {
    "domray": {
      "command": "node",
      "args": ["/ABSOLUTE/PATH/TO/domray/mcp-server/dist/index.js"]
    }
  }
}

4. Connect & Trace

  1. Open your web application (or run our example playground: npm run dev:example).

  2. Click the DOMRay extension icon in Chrome and click ⚑ Auto-Connect (connects in 1 click).

  3. Click Attach Debugger to begin capturing runtime telemetry.

  4. Click πŸ–₯️ Open Side Panel to watch live telemetry and the AI audit stream side-by-side with your app!


🧰 MCP Tools Reference (10 Tools)

DOMRay exposes 10 tools to connected AI coding agents:

Tool

Description

Key Parameters

domray_get_active_session

Returns active tab URL, page title, uptime, and telemetry buffer counters.

None

domray_get_latest_error

Returns the latest unhandled runtime exception, call stack, and preceding causal breadcrumbs.

include_breadcrumbs: boolean

domray_get_flow_timeline

Interleaves user clicks, form submissions, network calls, and console logs into a unified chronological replay.

limit: number, failed_network_only: boolean

domray_get_test_blueprint

🎬 Synthesizes runnable Playwright or Cypress E2E test specs from recorded interactions and API calls.

framework: "playwright" | "cypress", include_network_assertions: boolean

domray_get_mock_handlers

🌐 Synthesizes MSW v2 mock request handlers directly from recorded 4xx/5xx API transactions.

format: "msw" | "fetch-mock", filter: "failed_only" | "all"

domray_get_component_state

Traverses React 18/19 Fiber or Vue 3 reactive trees to extract props and hooks (useState, etc.).

selector: string (e.g. '#root', 'form#checkout')

domray_get_scoped_dom

Returns an intelligent, token-pruned (-85% tokens) HTML subtree for a given CSS selector.

selector: string, max_depth: number

domray_get_network_timeline

Returns recent HTTP transactions (status, duration, method, response bodies for errors).

failed_only: boolean, limit: number

domray_get_console_logs

Returns live browser console logs (log, info, warn, error) captured via CDP.

level: "all" | "error" | "warn", search?: string

domray_get_storage_state

Reads localStorage, sessionStorage, or cookies with automatic secret masking.

storage_type: "local" | "session" | "cookies"


πŸ›’ Real-World Playground Example

We include a standalone React 18 application in examples/checkout-app simulating an enterprise checkout page behind SSO:

# Start the example checkout app (runs on http://localhost:5173)
npm run dev:example

# Run the DOMRay-generated Playwright E2E test suite
npm run test:example:e2e
  • The Scenario: A checkout screen with simulated SSO 2FA session tokens.

  • The Bug: Applying coupon EXPIRED20 triggers an HTTP 422 error. Due to a state bug in CouponForm.tsx, isSubmitting never resets, permanently freezing the button without throwing an error in the console.

  • Try it with your AI:

    "The checkout apply button is permanently frozen. Can you inspect the active tab with DOMRay, diagnose the issue, and provide a fix and automated test?"


🀝 Contributing to DOMRay

We believe that the future of software development lies in empowering AI assistants with real, high-fidelity runtime awarenessβ€”without sacrificing developer privacy or enterprise security.

DOMRay is an open-source, community-driven project, and we warmly welcome contributions from frontend developers, AI enthusiasts, and tool builders alike!

How You Can Help:

  • ⭐ Star the Repository: If DOMRay helps your daily workflow, star the repo to help other developers discover it!

  • 🧩 Expand Framework State Inspectors: Help us build deeper extractors for Svelte 5 runes, Angular signals, SolidJS stores, or Zustand / Redux slices.

  • πŸ§ͺ Improve Testing Blueprints: Add support for Vitest Component Testing, Jest, or custom locator strategies.

  • 🐞 Report Issues & Ideas: Found an edge case or have a vision for a new MCP tool? Open an Issue or start a discussion.

  • πŸ”€ Submit Pull Requests: Check out open issues, fork the repo, and submit your PRs. We strive to review and merge community contributions promptly.

Please feel free to explore the codebase, test it with your favorite coding agents, and share your thoughts. Let's make AI-assisted frontend development faster, smarter, and context-aware together!


πŸ“„ License

DOMRay is open-source software licensed under the MIT License.

Related MCP Connectors

Related MCP Servers