Chromex

Chromex is an agent-first browser automation and DevTools toolkit that connects directly to Chrome, Brave, Edge, Chromium, and Vivaldi through CDP. It exposes the complete capability set through a token-efficient CLI and 85 typed MCP tools, with zero runtime dependencies.
Use Chromex when an agent needs to automate a real logged-in browser, inspect page and Application state, debug console/network failures, profile performance or memory, test extensions and WebMCP, or collect reproducible evidence without pulling in a heavy browser automation runtime.
Quick Start
npm install -g chromex-mcp
chromex --version
chromex launch --pipe --url https://example.com
chromex list
chromex snap <target> --refs
launch --pipe is the recommended path for repeatable AI sessions: it starts an isolated Chromex profile and avoids Chrome's recurring debugging approval prompt. Use the normal WebSocket mode only when access to an already-running personal browser is intentional.
Why Chromex
- CLI-first for lower token usage: terminal commands return compact plain text and avoid MCP tool-schema overhead.
- Optional MCP server: 85 typed tools in the full set, plus focused
core and devtools toolsets for sessions where schema cost matters.
- No runtime dependencies: Node.js 22+ built-ins only, including native WebSocket support.
- Agent-friendly page model: accessibility snapshots,
@eN refs, incremental diffs, query filters, auto-snapshots, and contextual hints.
- Persistent per-tab daemons: one CDP session per tab, held open through an authenticated Unix socket.
- Security controls: domain allow/block lists, CDP method blocklist, socket auth, command timeouts, and audit logs.
- Local by default: no hosted service, no telemetry client, no bundled browser download, and session stats stay on your machine.
What You Can Do Today
- Inspect and automate real logged-in browser sessions, not only fresh headless test contexts.
- Use
--raw and --json for stable pipes, CI, MCP wrappers, and agent-to-agent integrations.
- Create named sessions with isolated browser contexts, reusable targets, and local session dashboards.
- Read page state through compact accessibility snapshots, filtered snapshots, DOM snapshots, HTML, screenshots, and highlighted elements.
- Act on UI through refs, CSS selectors, coordinates, keyboard input, forms, uploads, drag and drop, touch gestures, dialogs, and load-more loops.
- Record every JavaScript dialog with its text and outcome. A command that opens a dialog returns at once with that text instead of hanging until the timeout.
- Debug production behavior with console history, network request details, response bodies, HAR export, request blocking, API mocking, throttling, and offline mode.
- Test browser conditions with device presets, viewport resizing, DPR, geolocation, timezone, locale, CPU throttling, incognito contexts, proxies, and custom Chrome flags.
- Diagnose performance and quality with Core Web Vitals, transfer size, DOM/memory counters, Lighthouse audits, JS/CSS coverage, Chrome traces, and heap snapshots.
- Inspect Browser Issues, computed and matched CSS, event listeners, box models, prioritized runtime diagnoses, CPU profiles, heap retaining paths, duplicate strings, and trace insights.
- Capture bounded screencasts with a local replay, manage extensions in trusted pipe mode, and discover or execute WebMCP and page-exposed developer tools.
- Build evidence packs with screenshots, snapshots, HTML, console, network, dialogs, action timeline, and replay HTML.
- Validate modern browser flows such as passkey/WebAuthn registration and login, downloads, cookies, portable storage state, PDF export, and isolated profiles.
- Inspect Application panel state from the terminal: origin quota, storage usage breakdown, Cache Storage entries/bodies, IndexedDB schemas/rows, and Service Worker registrations.
- Turn
@eN refs into locators and optional chromex-test action code.
The CLI and the default MCP full toolset expose the same capability families. CLI commands group related operations into subcommands, while MCP presents 85 individually typed tools.
| Capability | CLI | MCP full |
|---|
| Input, navigation, forms, uploads, dialogs, and emulation | Yes | Yes |
| Console, network, Application state, interception, HAR, and audits | Yes | Yes |
| Browser Issues, CSS/listener/box inspection, and runtime diagnosis | Yes | Yes |
| Web Vitals, CPU profiles, heap sampling, traces, and heap analysis | Yes | Yes |
| Screencasts, extensions, page developer tools, and WebMCP | Yes | Yes |
Positioning
Chromex is a direct CDP layer for coding agents. It sits between raw Chrome DevTools Protocol and heavier browser automation frameworks.
| Alternative | Trade-off | Chromex angle |
|---|
| Raw CDP WebSocket | Maximum browser power, but too verbose for agents. | Compact commands, refs, snapshots, and safety defaults. |
| Heavy browser automation libraries | Excellent automation frameworks, but they add dependencies and framework-level abstractions. | Zero-runtime-dependency CLI/MCP that talks to your existing Chromium browser. |
| Browser MCP only | Easy tool discovery, but tool schemas and structured responses add token cost. | CLI-first for cheap agent loops, MCP when typed tools are worth the overhead. |
| Manual DevTools | Great for humans, not scriptable enough for agents. | DevTools-grade inspection exposed as terminal and MCP commands. |
Requirements
- Node.js 22 or newer.
- macOS or Linux.
- A Chromium-based browser: Chrome, Brave, Edge, Chromium, Chrome Canary, or Vivaldi.
Zero-Dependency Boundary
The core runtime uses only Node.js built-in modules. Chromex does not install heavy browser automation runtimes, Selenium, browser drivers, telemetry SDKs, update checkers, or bundled browsers.
The only exception is the optional audit command: it uses npx to resolve Lighthouse on demand, then runs the Lighthouse JavaScript CLI directly with Node when you explicitly run an audit. All other CLI and MCP commands run through Chromex's own CDP client.
Development dependencies are used only for tests and token benchmarks.
Browser Setup
Chromex needs Chrome DevTools Protocol access to your browser. Choose one of the two connection modes below before using the CLI or MCP server.
Option A: Launch a Browser with Chromex
This is the recommended first-time setup. Chromex starts a new browser process with remote debugging already enabled, so there is no manual browser configuration and no "Allow debugging" prompt.
chromex launch --url https://example.com
Useful launch variants:
chromex launch --browser brave --url https://example.com
chromex launch --profile testing --url https://example.com
chromex launch --incognito --browser chrome
chromex launch --headless --url https://example.com
chromex launch --pipe --url https://example.com
chromex launch --extension-tools --url about:blank
chromex launch --webmcp --url https://example.com
chromex launch --browser-path "/Applications/Google Chrome Canary.app/Contents/MacOS/Google Chrome Canary"
Named profiles are stored under ~/.chromex/profiles/ and keep test sessions isolated from your daily browser profile.
chromex launch --pipe is the preferred mode for repeated AI sessions. It uses one permission-protected local Unix-socket broker over Chrome's remote-debugging pipe, avoids approval modals, and lets CLI and MCP clients share the same browser connection. --extension-tools implies pipe mode because Chrome restricts extension lifecycle APIs to trusted debugging sessions. WebMCP requires a visible supported Chrome build, so do not combine --webmcp with --headless when the page tools must execute.
Chrome for Testing also works well with Chromex. Download it manually from Google's official Chrome for Testing channel, then point Chromex at the executable with --browser-path or CHROMEX_BROWSER_PATH. Chromex does not download or bundle a browser.
Option B: Connect to an Already-Running Browser
Use this when you want Chromex to inspect tabs that are already open in your normal browser.
- Open Chrome, Brave, Edge, Chromium, or Vivaldi.
- Go to
chrome://inspect/#remote-debugging.
- Enable the remote debugging switch.
- Run
chromex list to verify that tabs are visible.
Important notes:
- Without remote debugging enabled, Chromex cannot discover or control your open tabs.
- The browser setting is usually persistent across restarts.
- Chrome may show an "Allow debugging" prompt for each new DevTools WebSocket connection to a normal browser profile. This is browser security behavior, so reconnecting from a new CLI or agent process can show it again.
- Per-tab daemons and the persistent MCP connection reduce reconnections, but they do not bypass Chrome's protection for a personal browser profile.
- Use
chromex launch --pipe with a Chromex-managed isolated profile when a modal-free persistent AI connection is required.
If your browser uses a custom profile or a non-standard DevToolsActivePort location, set:
export CDP_PORT_FILE=/path/to/DevToolsActivePort
If your Chromium executable is installed in a non-standard location, either pass --browser-path to chromex launch or set:
export CHROMEX_BROWSER_PATH=/path/to/chrome
Run the local diagnostic command whenever browser discovery or CDP connection fails:
Install the CLI
Install the package globally to get the chromex command.