Languages: EN RU

Web Development and Frontend Debugging

Frontend debugging is an endless context-switching loop: the dev server running in a terminal, the browser open with DevTools, the editor in a third window. You spot an error in the console → Alt-Tab to the editor → fix it → save → Alt-Tab back → F5. Repeat.

Claude Code breaks this cycle by acting as a bridge between your code and a live browser. There are two ways to set up this connection, each with its own niche.


flowchart TD A["✏️ Write / edit code"] --> B["🚀 Start dev server"] B --> C["🌐 Claude opens browser"] C --> D["👁️ Reads DOM, console, network"] D --> E{"Is there a problem?"} E -->|Yes| F["🔧 Edits files in the same context"] F --> C E -->|No| G["📸 Screenshot / GIF / report"] G --> H["✅ Commit"] style A fill:#e8f4f8 style H fill:#d4edda
flowchart TD
    A["✏️ Write / edit code"] --> B["🚀 Start dev server"]
    B --> C["🌐 Claude opens browser"]
    C --> D["👁️ Reads DOM, console, network"]
    D --> E{"Is there a problem?"}
    E -->|Yes| F["🔧 Edits files in the same context"]
    F --> C
    E -->|No| G["📸 Screenshot / GIF / report"]
    G --> H["✅ Commit"]
    style A fill:#e8f4f8
    style H fill:#d4edda
Цикл build → test → debug с Claude Code: весь цикл происходит в одном контексте без переключения окон

Two Ways to Connect a Browser

Claude in Chrome — Official Integration

A Chrome or Microsoft Edge extension that connects the browser to Claude Code via native messaging. The agent opens tabs, clicks, types, reads the DOM and console — in real time, in a visible window.

Requirements:

  • Google Chrome or Microsoft Edge (not Brave, not Arc; WSL is not supported)
  • Claude in Chrome extension version 1.0.36 or later
  • Claude Code 2.0.73 or later
  • A direct Anthropic subscription: Pro, Max, Team, or Enterprise — the feature is unavailable through Bedrock, Vertex, or Foundry

Launch:

claude --chrome

Or directly from an active session:

/chrome

The first time, Claude Code installs a native messaging host configuration file. If the extension isn't detected immediately — restart Chrome: it reads the config only on startup. If you want Chrome to connect by default without the flag, open /chrome and select "Enabled by default" — but keep in mind that keeping browser tools loaded permanently slightly increases context window consumption.

Key feature: the agent inherits your browser session. It accesses sites you're already logged into — Google Docs, Notion, internal tools — without any OAuth setup. This is what sets it apart from headless browsers.

Chrome DevTools MCP — Access to the Debugging Protocol

A standalone MCP server that operates via the Chrome DevTools Protocol (CDP). Under the hood it uses Puppeteer, and exposes a set of tools for querying the DOM, reading the console, intercepting network traffic, and running performance audits.

This approach requires no extension, but Chrome must be launched with the debugging port open:

# macOS/Linux
google-chrome --remote-debugging-port=9222 --user-data-dir=/tmp/chrome-debug

Then add the MCP server to Claude Code:

claude mcp add chrome-devtools -- npx chrome-devtools-mcp@latest

To lock the configuration for the entire team, add it to .mcp.json in the project root:

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

For more on the .mcp.json mechanism and server scopes, see Connecting MCP Servers in Claude Code.

Check yourself
Ваша команда работает через Amazon Bedrock, прямой подписки Anthropic нет. Нужно настроить автоматическую проверку сетевых запросов в браузере. Какой подход выберете и почему?

Quick recall
С какими флагами нужно запустить Chrome, чтобы подключить Chrome DevTools MCP?
Quick recall
На какой версии Claude Code работает Claude in Chrome и какой способ подписки требуется?
Quick recall
Почему для работы с сайтами, на которых вы уже залогинены (Google Docs, Notion, корпоративные системы), лучше выбрать Claude in Chrome вместо Chrome DevTools MCP?

Common Frontend Workflow Patterns

Pattern 1: Build → Verify in One Context

You've added a component and want to confirm it renders correctly without breaking neighboring parts:

I just added <DateRangePicker> in src/components/DateRangePicker.tsx.
Open localhost:3000/reports, check that the component renders without any
console errors, and describe how it looks visually.

The agent opens the page, reads the console, takes a screenshot, and returns a description — without leaving your terminal. If there's an error, it immediately opens the relevant file and fixes it.

Pattern 2: Targeted Console Debugging

Don't ask the agent to "dump all console logs" — an SPA in dev mode generates hundreds of console.log entries from HMR, the router, Redux DevTools, and more. That entire stream will consume a significant portion of the context window. Be more specific:

Open localhost:3000/dashboard, wait for it to fully load,
and return only the errors and warnings (not info, not log)
that appear within the first 3 seconds after the page opens.

The agent returns a filtered list. Then, in the same conversation: "fix the first error." The loop is closed without a single context switch.

Check yourself
Почему плохая идея просить агента «выведи все логи консоли» без фильтрации?

Pattern 3: Inspecting Network Requests

Through the Chrome DevTools MCP you can intercept network traffic at the CDP level:

Open the /api-test page, click the "Load Data" button, and show me:
1. All fetch requests that were sent after the click
2. Response status codes
3. If there are any 4xx or 5xx responses — the response body

This replaces the DevTools Network tab for most diagnostic tasks.

Pattern 4: Running User Flows

Test the registration form at localhost:3000/signup:
1. Try submitting an empty form — does a validation error appear for each field?
2. Enter an invalid email — does the field react in real time?
3. Fill everything in correctly and complete the flow through to /welcome — are there any dead-end redirects?

The agent walks through the entire flow, documents the behavior, and compares it against a specification if you provide one. This is faster than writing a Playwright test from scratch when you only need a one-off check.

Pattern 5: Recording a GIF for a Demo

Claude in Chrome can record browser interactions as a GIF:

Record a GIF showing the checkout flow:
from adding an item to the cart through to the order confirmation page.
Save it as checkout-demo.gif

This is handy for pull request descriptions and internal documentation — instead of "see screenshot," you attach a live recording.



Limitations and Caveats

JavaScript dialogs block control. alert(), confirm(), prompt() — these freeze the Chrome API. If a page shows one of these dialogs, the agent waits for you to close it manually. This is rare in modern SPAs but does appear in legacy code.

CAPTCHAs and 2FA require manual intervention. When the agent lands on a login page or encounters a CAPTCHA, it stops and asks you to complete it manually. It then continues from where it left off.

The extension's service worker goes to sleep. During long pauses (while the agent is "thinking" or you've stepped away), the connection may drop with a Receiving end does not exist error. This is resolved in a second via /chrome → "Reconnect extension." To prevent it, don't leave the agent idle for extended periods with no tasks.

Chrome extension unavailable through Bedrock/Vertex. If your team uses corporate Bedrock without a direct Anthropic subscription, use the Chrome DevTools MCP as an alternative.

Context grows quickly. Browser tools consume the context window aggressively. After finishing a browser-heavy task, it's worth running /compact before switching to a new topic — see Managing the Context Window for more detail.

Check yourself
Вы запустили Claude in Chrome и дали агенту задачу на 20 минут. После 15 минут агент возвращает ошибку 'Receiving end does not exist'. Что случилось и как быстро починить?

Choosing an Approach: Quick Reference Table

CriterionClaude in ChromeChrome DevTools MCP
ProviderDirect Anthropic onlyAny (Bedrock, Vertex…)
SetupExtension + --chrome--remote-debugging-port=9222 + MCP server
Logged-in sites✓ (your session)✗ (separate Chrome profile)
Team configurationPer-individual.mcp.json in the repo
Network analysis depthBasicMore detailed (CDP-level)
GIF recording
Headless / CI

For most day-to-day debugging tasks — verifying features, checking designs, testing forms — the official extension is more convenient: less setup, and it works with your existing browser profile. The Chrome DevTools MCP is the right fit for CI pipelines, teams on Bedrock, and scenarios that require detailed CDP access or repository-level configuration.


See also

  • Model Context Protocol: Architecture and Fundamentals — how the protocol underlying Chrome DevTools MCP works
  • Connecting MCP Servers in Claude Code — local/project/user scopes and the .mcp.json file
  • In Practice: GitHub, Databases, and Web APIs via MCP — other tools available through the same mechanism
  • Subagents and Context Isolation — offloading browser tasks to an isolated subagent
  • Managing the Context Window — browser tools consume context heavily; strategies for keeping it under control
  • Headless Mode and CLI Scripting — Claude Code in CI/CD without a GUI

Sources

  1. Use Claude Code with Chrome (beta) — официальная документация
  2. Connect Claude Code with Chrome DevTools MCP Server — Apidog Blog
  3. Chrome DevTools MCP: AI-Powered Browser Automation and Debugging — DataCamp