Claude Code · As of 2026-12-04

Claude Code + Chrome DevTools MCP: Cutting Browser Debugging Token Costs in 2026

Pairing ChromeDevTools/chrome-devtools-mcp (v1.15.0) with Claude Code gives your agent live DOM snapshots, console logs, and network HAR traces, while stacking prompt caching, built-in compaction, and open-source compression keeps input token bills predictable. Without guardrails, verbose browser outputs are re-sent on every later turn. Verified on 2026-12-04, combining Anthropic's 90%–97.5% cache read discounts, Claude Code's /compact and ~54-minute idleCompaction, and Headroom 0.45.0 or Context Mode v2.2.7 cuts recurring token burn.

QCode is an independent third-party model API service, not affiliated with or endorsed by Anthropic, Google, OpenAI, Headroom, or Context Mode. Facts in this guide were verified on 2026-12-04 against the official documentation linked below.

Updated 2026-12-04

Key facts

  • ChromeDevTools/chrome-devtools-mcp v1.15.0 (Apache-2.0, released December 2, 2026) installs via claude mcp add chrome-devtools --scope user npx chrome-devtools-mcp@latest and requires Node.js ^20.19 plus Chrome or Chrome for Testing (local stdio, no API key).
  • Anthropic prompt caching cuts cached reads by 95% on claude-opus-5-5 ($0.20 vs. $4.00/1M) and claude-sonnet-5-5 ($0.10 vs. $2.00/1M), 97.5% on claude-fable-5-2 ($0.20 vs. $8.00/1M), and 90% on claude-haiku-5-5 ($0.01 vs. $0.10/1M up to 100K tokens).
  • Strict prefix order (tools -> system -> messages): adding or removing MCP servers mid-session mutates tools and invalidates the downstream cache.
  • Built-in compaction runs auto-compact near ~400K tokens on 1M-window models, supports /compact 500k and CLAUDE_AUTOCOMPACT_PCT_OVERRIDE, and runs idleCompaction at ~54 minutes idle on large sessions (commonly 200,000+ tokens) while the 1-hour cache is warm.
  • Open-source compression: Headroom 0.45.0 (Apache-2.0, Python 3.10+, 3.13 recommended) and Context Mode v2.2.7 (Elastic License 2.0, Node.js 24.15.0+ with node:sqlite) reduce verbose tool output before context fills.
  • One QCode cr_ key routes Claude (/api), GPT (/openai), and gemini-4-neon (/gemini, live since 2026-12-03) at official upstream list prices ×1.0 (gemini-4-carbon, gemini-4-argon, and gemini-4-hydrogen are not listed on QCode /models yet).

Why Chrome DevTools MCP inflates Claude Code token costs

Live browser debugging inflates token bills because every DOM snapshot, console log, and network HAR trace stays in conversation history and is re-sent on every later turn until cleared or compacted.

When Claude Code inspects a single-page app via ChromeDevTools/chrome-devtools-mcp, a few calls append tens of thousands of tokens of accessibility trees, headers, JSON payloads, and stack traces. Claude 5.5 and Fable 5.2 enable a 1M native context window by default at flat per-token pricing, which avoids sudden overflow crashes—but lets noisy debugging sessions grow past 200K–400K tokens silently.

Three pricing mechanics amplify that growth:

  • Uncached replays add up fast: Re-sending 200K uncached tokens on claude-opus-5-5 ($4.00/1M) costs $0.80 per turn, or $12.00 across 15 turns.
  • Haiku 5.5 has a 100K cliff: Unlike flat-rate claude-opus-5-5 ($4.00/$20.00) and claude-sonnet-5-5 ($2.00/$10.00), claude-haiku-5-5 jumps 5× above 100,000 total input tokens (including cache reads and writes)—from $0.10/$0.50 to $0.50/$2.50 per 1M ($0.01 to $0.05 cache read).
  • GPT-6.2 has a 272K tier in Codex CLI: On gpt-6.2-sol ($2.00/$10.00, $0.10 cache read), exceeding 272K input tokens triggers OpenAI's whole-request long-context tier (2× input/cached, 1.5× output: $4.00/$15.00, $0.20 cached).

Installing Chrome DevTools MCP v1.15.0 in Claude Code and Codex CLI

Register chrome-devtools-mcp once at user scope on Node.js ^20.19 with a stable Chrome binary so tool schemas remain constant across sessions.

As of 2026-12-04, ChromeDevTools/chrome-devtools-mcp v1.15.0 (Apache-2.0) runs over local stdio with no API keys required:

# Claude Code: register Chrome DevTools MCP at user scope
claude mcp add chrome-devtools --scope user npx chrome-devtools-mcp@latest

# Optional: Claude Code plugin (MCP server + bundled agent skills)
# Run these two slash commands inside Claude Code:
# /plugin marketplace add ChromeDevTools/chrome-devtools-mcp
# /plugin install chrome-devtools-mcp@chrome-devtools-plugins

# Codex CLI: register the same MCP server
codex mcp add chrome-devtools -- npx chrome-devtools-mcp@latest

# WSL2 Option A: install Linux Chrome for Testing inside WSL
npx -y @puppeteer/browsers install chrome@stable --path ~/chrome
# Pass flags: --executablePath <linux-chrome-path> --no-sandbox --disable-setuid-sandbox

# WSL2 Option B: attach to Windows Chrome started with --remote-debugging-port=9222
claude mcp add chrome-devtools --scope user npx chrome-devtools-mcp@latest -- --browserUrl http://localhost:9222

For standard JSON MCP clients, use the official mcpServers block:

{
  "mcpServers": {
    "chrome-devtools": {
      "command": "npx",
      "args": ["-y", "chrome-devtools-mcp@latest"]
    }
  }
}

On WSL2, verify which node resolves to Linux Node.js ^20.19+ (not /mnt/c/), and disable unused MCP servers so extra schemas do not bloat the tools prefix. See Claude Code MCP guide and Codex CLI MCP profiles.

Layer 1: Prompt Caching for 90% to 97.5% input read discounts

Prompt caching provides the largest immediate savings by dropping repeated DOM, console, and code context reads to 0.025×–0.1× of base input cost—provided the prefix stays unchanged.

Per Anthropic's prompt caching docs, matching follows strict tools -> system -> messages order. Three common mistakes break hits:

  1. Adding or removing an MCP server mid-session, mutating the top-level tools block.
  2. Switching models mid-thread (e.g., claude-sonnet-5-5 to claude-opus-5-5).
  3. Exceeding cache TTL: default 5-minute (5m) TTL refreshes on each hit (1.25× write), while 1-hour (1h) TTL (2× write) covers manual browser testing pauses.

Minimum cacheable length is 512 tokens on Claude 5.5 and Fable 5.2 (1,024 on Opus 4.8 / Sonnet 5 / Sonnet 4.6; 2,048 on Opus 4.7), using automatic "cache_control": {"type": "ephemeral"} or up to 4 explicit breakpoints (5+ returns HTTP 400).

Model (API ID) Base Input / 1M Output / 1M 5m Write 1h Write Cache Read (Discount) Min Prefix
Claude Fable 5.2 (claude-fable-5-2) $8.00 $40.00 $10.00 $16.00 $0.20 (0.025×, 97.5% off) 512
Claude Opus 5.5 (claude-opus-5-5) $4.00 $20.00 $5.00 $8.00 $0.20 (0.05×, 95% off) 512
Claude Sonnet 5.5 (claude-sonnet-5-5) $2.00 $10.00 $2.50 $4.00 $0.10 (0.05×, 95% off) 512
Claude Haiku 5.5 (claude-haiku-5-5, ≤100K) $0.10 $0.50 $0.125 $0.20 $0.01 (0.1×, 90% off) 512
Claude Haiku 5.5 (claude-haiku-5-5, >100K) $0.50 $2.50 $0.625 $1.00 $0.05 (0.1×, 90% off) 512

Keep DISABLE_PROMPT_CACHING unset (DISABLE_PROMPT_CACHING_OPUS, SONNET, HAIKU as well). See Prompt caching compared across Claude, GPT, and DeepSeek.

Layer 2: Built-in /compact, autoCompactWindow, and idleCompaction

Compact while the prompt cache is warm so Claude Code summarizes DOM and HAR traces at discounted cache-read rates instead of paying full uncached input after expiry.

Anthropic's Claude Code settings reference provides four built-in controls:

  • /usage, /compact, and /clear: Track growth with /usage. After solving a browser issue, run /compact (or /compact 500k / /compact auto) while the cache is warm; use /clear between unrelated tasks.
  • Auto-compact tuning (autoCompactEnabled, autoCompactWindow, CLAUDE_AUTOCOMPACT_PCT_OVERRIDE): Auto-compact defaults near ~400K tokens on 1M models. Set CLAUDE_AUTOCOMPACT_PCT_OVERRIDE (1–100) to compact earlier, or DISABLE_AUTO_COMPACT=1 to keep manual /compact only.
  • idleCompaction (~54 minutes): On large sessions (commonly 200,000+ tokens) idle for ~54 minutes—just before the 1-hour cache expires—Claude Code compacts in the background so resuming uses a summary instead of full uncached reprocessing ("idleCompaction": false disables it).
  • Hooks (PreCompact and SessionStart): PreCompact (manual/auto) can archive traces or block compaction (exit code 2 or {"decision": "block"}); SessionStart with "matcher": "compact" re-injects project rules via stdout.

Configure ~/.claude/settings.json in strict JSON (no comments or trailing commas):

{
  "$schema": "https://json.schemastore.org/claude-code-settings.json",
  "autoCompactEnabled": true,
  "idleCompaction": true,
  "env": {
    "ANTHROPIC_BASE_URL": "https://api.qcode.cc/api",
    "ANTHROPIC_AUTH_TOKEN": "cr_your_key",
    "CLAUDE_AUTOCOMPACT_PCT_OVERRIDE": "70"
  }
}

Keys under "env" override shell environment variables. For overflow fixes, see context length exceeded guide.

Layer 3: Headroom 0.45.0 vs Context Mode v2.2.7 for tool-output compression

Prompt caching and /compact manage history already inside the window, while Headroom and Context Mode shrink verbose tool output before it fills context.

Every raw DOM dump still pays a 1.25× or 2× cache-write fee on first ingestion. Two tools verified on 2026-12-04 tackle that bloat differently:

Layer / Tool Version & License Runtime How It Cuts Token Cost Ideal Fit
Layer 1: Prompt Caching Native Anthropic API None 90%–97.5% discount on unchanged tools -> system -> messages prefix Always-on baseline
Layer 2: /compact + idleCompaction Native Claude Code None Summarizes at ~400K (or custom %) and ~54 min idle while cache is warm Long sessions
Headroom (headroomlabs-ai/headroom) 0.45.0, Apache-2.0 Python 3.10+ (3.13 rec.) Proxy wrapper (headroom wrap claude) or MCP (headroom_compress, headroom_retrieve, headroom_stats) Apache-2.0 multi-CLI teams
Context Mode (mksglu/context-mode) v2.2.7, ELv2 Node.js 24.15.0+ (node:sqlite, Git on Win) Plugin output-routing hooks + local SQLite FTS5 indexing & sandbox (ctx_execute, ctx_batch) Heavy DOM and HAR querying

Installing Headroom 0.45.0

Headroom provides prebuilt wheels for Linux, macOS, and Windows:

# Install Headroom CLI, proxy, and MCP extras (Python 3.13 recommended)
uv tool install --python 3.13 "headroom-ai[all]"

# Option A: register Headroom MCP tools (headroom_compress, headroom_retrieve, headroom_stats)
headroom mcp install
headroom mcp status

# Option B: zero-code proxy wrapper for Claude Code (revert with: headroom unwrap claude)
headroom wrap claude

Alternatively, run headroom proxy --port 8787 or register manual MCP JSON using command -v headroom with "args": ["mcp", "serve"].

Installing Context Mode v2.2.7

Context Mode indexes bulky outputs locally in SQLite FTS5 via Node.js 24.15.0+ node:sqlite. Its Elastic License 2.0 (ELv2) is free for personal/internal use but prohibits hosted third-party services:

# Recommended: Claude Code plugin (MCP + automatic output-routing hooks + skills)
claude plugin marketplace add mksglu/context-mode
claude plugin install context-mode@context-mode

# Verify runtime and hook health
context-mode doctor

# Alternative: MCP-only install (sandbox and search tools without auto-routing hooks)
claude mcp add context-mode -- npx -y context-mode

Keep Layers 1 and 2 always on and add either Headroom or Context Mode—not both—to avoid redundant tools schemas. See MCP servers for coding agents.

FAQ

Does Chrome DevTools MCP require an API key?

No. ChromeDevTools/chrome-devtools-mcp (v1.15.0, Apache-2.0) runs locally over stdio with Node.js ^20.19 and Chrome or Chrome for Testing. You only pay for LLM tokens consumed by Claude Code or Codex CLI.

Why did my prompt cache hit rate drop after adding Chrome DevTools MCP?

Anthropic evaluates caches strictly in tools -> system -> messages order. Adding or toggling an MCP server mid-session mutates tools and invalidates all downstream cache entries; register MCP servers before starting a session.

What does idleCompaction do at 54 minutes in Claude Code?

On large sessions (commonly 200,000+ tokens) idle for ~54 minutes, Claude Code compacts in the background just before the 1-hour cache expires, paying 0.025×–0.1× cache-read rates instead of full uncached input on return ("idleCompaction": false disables it).

Should I use claude-haiku-5-5 for Chrome DevTools DOM snapshots?

Watch the 100,000-token cutoff: claude-haiku-5-5 costs $0.10/$0.50 up to 100K total input tokens (including cache reads and writes), then jumps 5× to $0.50/$2.50 ($0.05 cached). claude-sonnet-5-5 ($2.00/$10.00) and claude-opus-5-5 ($4.00/$20.00) stay flat across 1M tokens.

How do Headroom 0.45.0 and Context Mode v2.2.7 differ?

Headroom 0.45.0 (Apache-2.0, Python 3.10+) runs as a proxy wrapper (headroom wrap claude) or MCP server (headroom mcp install). Context Mode v2.2.7 (ELv2, Node.js 24.15.0+) combines Claude Code output-routing hooks with local SQLite FTS5 indexing (node:sqlite).

Can I run Chrome DevTools MCP with Claude Code on WSL2?

Yes. Use Linux Node.js ^20.19+, then either install Linux Chrome for Testing (npx -y @puppeteer/browsers install chrome@stable --path ~/chrome) with --executablePath <path> --no-sandbox --disable-setuid-sandbox, or attach to Windows Chrome (--remote-debugging-port=9222) via --browserUrl http://localhost:9222.

Running Claude Code, Codex CLI, and Gemini 4 Neon with One Key

With caching, compaction, and compression tuned, one QCode cr_ key routes Claude (claude-opus-5-5 $4.00/$20.00, claude-sonnet-5-5 $2.00/$10.00) on https://api.qcode.cc/api, GPT (gpt-6.2-sol $2.00/$10.00) on https://api.qcode.cc/openai, and Gemini 4 Neon (gemini-4-neon $3.00/$15.00, $0.15 implicit cache read, live on https://api.qcode.cc/gemini since 2026-12-03; gemini-4-carbon, gemini-4-argon, and gemini-4-hydrogen are not listed on QCode yet) at official upstream list prices ×1.0.

# Quick Claude Code launch on QCode Anthropic endpoint
export ANTHROPIC_BASE_URL="https://api.qcode.cc/api"
export ANTHROPIC_AUTH_TOKEN="cr_your_key"
claude --model claude-opus-5-5

For bursty debugging sprints, 7-day stackable packs start at $4 ($30 quota) on pay-as-you-go. For steady daily work, 30-day personal plans resetting at 00:00 UTC+8 start at $9 ($5/day) through Daily 20 ($32.86), Daily 35 ($53.57), and Ultimate ($252.57) on pricing, with live IDs on models.

Running Claude Code, Codex CLI, and Gemini 4 Neon with One Key

One key for both the Anthropic Messages API and OpenAI-compatible APIs. Claude and GPT are billed at the official price ×1.0; live rates are on /models.

Not sure where to start?

Try it for a week

Small Pack: $4 for $30 of quota, valid 7 days

Use it every day

Starter: $9.00/month with $5 of quota every day — just $0.060 per $1 of quota, vs about $0.113 for the Medium Pack