Skip to main content
Glama
mcp-browser-dev-tools

mcp-browser-dev-tools

by Hinaser

mcp-browser-dev-tools

npm version npm downloads

Let an AI agent work in a real browser with fewer back-and-forths. It sends a whole sequence of clicks, typing, waits, and checks in one tool call and gets every result back together, in your Chrome, Edge, or Firefox.

Quick Start

You need Node.js 24 or later. Register the server with your MCP client:

# Claude Code
claude mcp add browser-devtools --scope user -- npx -y mcp-browser-dev-tools@latest serve

# Codex
codex mcp add browser-devtools -- npx -y mcp-browser-dev-tools@latest serve

Cursor and other clients that use an mcpServers config:

{
  "mcpServers": {
    "browser-devtools": {
      "command": "npx",
      "args": ["-y", "mcp-browser-dev-tools@latest", "serve"]
    }
  }
}

@latest makes npx check for the current release when the client starts the server, reusing its cached copy when nothing changed; the check takes a moment and needs the npm registry or a cached answer. Without a version, npx uses an already installed copy, such as one from npm install -g, however old.

Then ask the agent for browser work, for example "open example.com and check the console for errors" or "attach to my open tab and find out why the form won't submit". The agent starts with ensure_browser, which reuses a browser that is already running with a debugging port, or launches one. To make launches use a particular profile, set MCP_BROWSER_USER_DATA_DIR; see Configuration for this, native Windows, WSL, and Firefox.

Related MCP server: Fast Browser MCP

What It Does

An AI agent sends one run_steps call with five steps to the browser and gets one reply with every result

Your agent gets 46 browser tools over MCP: open or attach to tabs, click, type, drag, upload files, and navigate, read the console and network, block or mock requests, take screenshots, and save and restore sessions. At the center is run_steps: the agent sends a whole task, with branches and waits in it, and the server carries it out in the browser and replies once. run_tabs does the same in several tabs at the same time.

Why This One

  • Fewer round trips. Every model turn costs thinking time and tokens, so the agent does more with each call. In our benchmark, batching halved the turns Sonnet 5.5 needed to sign up through a form.

  • Actions say what they did. A click, a typed value, or a whole batch comes back with what changed on the page once it settles: controls that appeared, disappeared, or changed, new text such as an error or a toast, console errors, and after a navigation the new page's controls. The agent can confirm the result without another look at the page.

  • Many pages at once. Research over several pages happens side by side: run_tabs opens them together and read_text brings back what they say. In our benchmark, reading five slow pages took Sonnet 5.5 8.5 s and 4 turns instead of 28 s and 6.

  • Calm on real pages. Waits end on whichever outcome shows up, actions wait out a covering banner or a button that isn't enabled yet, and if a step fails the reply lists the page's controls, so the next try is an informed one.

  • Right where you work. It attaches to the browser you already use, with its logins, tabs, and extensions, and speaks to Chrome, Edge, and Firefox with the same tools.

  • A debugger at hand. Console messages with stack traces, network requests and HAR export, cookies and storage, and a one-call debug report.

Against Playwright MCP and Chrome DevTools MCP, on the same tasks with six models, it took the fewest turns and the least time with every model and cost the least on average and with four of the six: see the comparison.

One Call, Start To Finish

A run_steps call that dismisses a cookie banner if one is showing, fills in and submits a form, waits for either the success or the error message, and reads it:

{
  "sessionId": "chromium:1f0c…",
  "steps": [
    {
      "tool": "if",
      "arguments": {
        "condition": { "selector": "text=Accept cookies" },
        "then": [
          {
            "tool": "click",
            "arguments": { "selector": "text=Accept cookies" }
          }
        ]
      }
    },
    {
      "tool": "type",
      "arguments": {
        "selector": "role=textbox[name=\"Email\"]",
        "text": "ada@example.com"
      }
    },
    {
      "tool": "click",
      "arguments": { "selector": "role=button[name=\"Sign up\"]" }
    },
    {
      "tool": "wait_for",
      "arguments": {
        "anyOf": [
          { "selector": "#message", "textIncludes": "Welcome" },
          { "selector": "#message", "textIncludes": "error" }
        ]
      }
    },
    { "tool": "inspect_element", "arguments": { "selector": "#message" } }
  ]
}

The result has each step's outcome: which branch the if took, which anyOf alternative matched, and the message element with its text. Because the batch has actions, the result also has changes: what the batch changed on the page, as described in Tools. Locators can be CSS, text=, role= with an accessible name, or name=. The full semantics of run_steps, if, repeat, and conditions are in Tools.

Many Pages At Once

An AI agent sends one run_tabs call with four URLs, the browser loads and reads them side by side, and one reply comes back with every page's text

A research step usually means opening several pages and reading each one. read_text with links: true collects the result links from a search page; then one run_tabs call opens them all and reads them side by side:

{
  "browserFamily": "chromium",
  "tabs": [
    {
      "url": "https://docs.example.com/a",
      "steps": [{ "tool": "read_text", "arguments": { "maxChars": 4000 } }]
    },
    {
      "url": "https://blog.example.com/b",
      "steps": [{ "tool": "read_text", "arguments": { "maxChars": 4000 } }]
    },
    {
      "url": "https://news.example.com/d",
      "steps": [
        { "tool": "wait_for", "arguments": { "selector": "article" } },
        {
          "tool": "read_text",
          "arguments": { "selector": "article", "maxChars": 4000 }
        }
      ]
    }
  ]
}

The result lists every tab in the order given, each with its steps' results: here, each page's main text, cut to maxChars. Each tab opens a new tab, loads its URL, and runs its steps at the same time as the others, so the call takes about as long as the slowest page; the tabs close afterwards. Steps are the same as in run_steps, including if and repeat, and a tab that fails or runs past its timeoutMs does not stop the others. browserFamily picks the browser for the new tabs when the server runs in its default auto mode. The details are in Tools.

Record A Demo

record_video records what a Chromium tab shows while the agent drives it, as an MP4. For a 1920x1080 recording, set the viewport first, then start, act, and stop:

{ "name": "set_viewport", "arguments": { "sessionId": "s1", "width": 1920, "height": 1080 } }
{ "name": "record_video", "arguments": { "sessionId": "s1", "action": "start" } }
{ "name": "click", "arguments": { "sessionId": "s1", "selector": "text=Open dashboard" } }
{ "name": "record_video", "arguments": { "sessionId": "s1", "action": "stop", "path": "/home/me/demo.mp4" } }

stop returns the file's path, durationMs, frames, width, and height. Chrome streams a frame on each repaint, and stop encodes them with ffmpeg (found on PATH, or named by MCP_BROWSER_FFMPEG) at a constant frame rate, each frame lasting as long as it was on screen. Without ffmpeg, stop keeps the frames and returns the command that encodes them. record_video is in the performance group, reached through more_tools or as a run_steps step. The details, including fps, quality, maxWidth and maxHeight, and maxDurationMs, are in Tools.

Measured

Median of 3 runs on the current build, from the benchmark in PERFORMANCE.md. "One action per call" disallows run_steps and run_tabs.

Task

Sonnet 5.5, one action per call

Sonnet 5.5 with batching

Opus 5.5 with batching

Sign up through a form

15.0 s · 9 turns

10.2 s · 4 turns

11.5 s · 4 turns

Pay, retrying declined attempts

20.6 s · 8 turns

19.1 s · 8 turns

18.9 s · 9 turns

Sign in, then change settings

16.2 s · 11 turns

17.5 s · 7 turns

18.2 s · 8 turns

Read five pages from a results list

27.7 s · 6 turns

8.5 s · 4 turns

11.8 s · 5 turns

Every form run started with get_snapshot and acted by ref, without being told to. Each payment click waits for the page to settle and reports the decline or the receipt, so the agents could retry from each reply. The last row uses run_tabs. Eight models (Claude Fable 5.1, Opus 5.5, Sonnet 5.5, Haiku 5.5, and Haiku 4.5; GPT-6-Astra, GPT-6.1 Sol, and GPT-6-Luna) ran the same four tasks with the default tool set: 95 of those 96 runs passed, and PERFORMANCE.md has the time, cost, and turns for each, the charts, and how the runs were set up.

Tools

47 tools, described in docs/tools.md. The server lists the core set by default, since every model turn pays for each tool listed, and more_tools lists, describes, and calls the rest; MCP_BROWSER_TOOLS=all, or a list of groups such as network,state, lists them too (Tool Sets).

  • Browser and tabs: browser_status, ensure_browser, launch_browser, list_tabs, new_tab, close_tab, attach_tab, detach_tab, list_sessions

  • Act: navigate, reload, click, hover, drag, type, select, press_key, upload_file, scroll, set_viewport, set_dialog_answers

  • Wait and batch: wait_for, run_steps, run_tabs

  • Inspect: get_page_state, get_snapshot, get_document, inspect_element, query_elements, read_text, take_screenshot, evaluate_js

  • Console and network: get_console_messages, get_network_requests, get_events, get_har, set_network

  • Performance: get_performance, record_trace, record_video

  • Session state: get_cookies, get_storage, capture_session_snapshot, restore_session_snapshot, compare_page_state, compare_selector, capture_debug_report

Configuration

The defaults work for most setups: the server finds a Chromium or Firefox debugging endpoint on loopback ports 9222–9226, or launches a browser when asked. The settings people change most:

  • MCP_BROWSER_FAMILY: auto (default), chromium, edge, or firefox

  • CDP_BASE_URL and FIREFOX_BIDI_WS_URL: fixed browser endpoints

  • MCP_BROWSER_USER_DATA_DIR: the profile to launch browsers with

  • MCP_BROWSER_ENABLE_EVAL=0: turn off page JavaScript from the agent (evaluate_js and expression conditions)

Every setting, per-client examples, and how the server reuses or launches browsers are in docs/configuration.md. WSL with a Windows browser, and other platform walkthroughs, are in docs/setup.md.

Safety

  • The server only connects to loopback browser endpoints unless you set MCP_BROWSER_ALLOW_REMOTE_ENDPOINTS=1.

  • Tools both read and act on the page: they click, type, navigate, and run page JavaScript through evaluate_js, as whoever the browser profile is signed in as. Point the server at a profile you are willing to let an agent use.

  • MCP_BROWSER_ENABLE_EVAL=0 removes evaluate_js and the expression field of wait_for and run_steps conditions. This narrows the tool surface rather than drawing a security boundary: the other tools already read cookies and storage and can navigate anywhere. To approve page scripts one at a time, use your MCP client's tool permissions, and note that wait_for and run_steps calls can carry scripts too.

Compared With Playwright

Playwright is the better choice for deterministic automation and end-to-end tests, with its assertions, tracing, and CI tooling. This server is for a different job: letting an AI agent inspect and operate a live browser through MCP. The agent calls a fixed set of tools instead of writing and running scripts, can work in the tab and session you already have open, and uses the same tools on Chromium and Firefox.

Documentation

Development

corepack enable
pnpm install
pnpm run check
pnpm run pack:check

The repository uses pnpm for development and CI; the package is published to npm. See Publishing and Repository Settings for the release process.

Available Tools

24 tools
attach_tabA

Start here: attach to a tab by its url, or a targetId from list_tabs or new_tab. Returns the page's snapshot, one line per visible heading and control with a ref such as e12 (f1e3 inside an iframe), and buffers the tab's console and network events from now on. Later calls without sessionId act on the tab attached last.

Inputs: url, targetId.

clickA

Click with real mouse input at an element's center (fails if something covers it) or at x, y. Accepts alert and confirm dialogs, dismisses prompts. Returns changes: what changed on the page. Locators in every tool are case-sensitive: ref=e12 until the page navigates; CSS; text=Foo and name=Foo, the first visible element whose text or accessible name equals, else contains, Foo (a label finds its control); role=button[name="Save"]; a >> b for b inside a, and has-text=Foo to filter: tr >> has-text=Ada >> text=Delete. Only refs reach into iframes.

Inputs: x, y, button, selector, +3 more.

close_tabB

Close a tab and its session.

Inputs: targetId (required).

ensure_browserA

Reuse a reachable browser or launch one (with the MCP_BROWSER_USER_DATA_DIR profile when set), optionally opening url in a new tab. It never launches twice on one profile (except from WSL).

Inputs: browserFamily (required), url, port, waitMs, +5 more.

evaluate_jsC

Run JavaScript in the page; top-level await works, and the last expression's value is returned.

Inputs: expression (required), sessionId, awaitPromise, returnByValue.

get_console_messagesC

Buffered console messages and exceptions.

Inputs: limit, sessionId.

get_network_requestsD

Buffered network requests.

Inputs: limit, sessionId.

get_snapshotA

List visible headings and controls, one line each with a ref, role, name, and state, e.g. e3 textbox "Email" value="ada@example.com". ref=e3 works as any tool's selector until the page navigates; controls inside iframes get refs like f1e3. Far cheaper than get_document or a screenshot.

Inputs: limit, headings, selector, sessionId.

hoverB

Move the real mouse pointer to an element's center or x, y. Returns changes.

Inputs: x, y, selector, sessionId, +1 more.

list_tabsB

List the browser's tabs.

Inputs: no named parameters.

more_toolsA

Tools not listed here to keep each turn small: drag, cookies and storage, request mocking, HAR, performance, and more. No arguments lists them; name describes one; name with arguments calls it. They also work as run_steps steps.

Inputs: name, arguments.

new_tabB

Open a tab; returns its target id.

Inputs: browserFamily (required), url.

press_keyC

Press a key or combination with real keyboard input on selector (focused first) or the focused element. Returns changes.

Inputs: key (required), selector, sessionId, timeoutMs.

read_textB

Visible text of the main content, or of selector, as lines up to maxChars; with links, also its links.

Inputs: links, maxChars, maxLinks, selector, +1 more.

reloadC

Reload the tab.

Inputs: sessionId, waitUntil, ignoreCache.

run_stepsA

Run session tools in order in one call; prefer it to separate calls for the actions you already know, such as every field of a form: [{"tool":"type","arguments":{"selector":"ref=e3","text":"Ada"}},{"tool":"click","arguments":{"selector":"text=Save"}}]. Arguments omit sessionId. Also: sleep {ms}; if {condition, then, elseIf: [{condition, then}], else, timeoutMs}, which branches on wait_for fields, checked once or until one holds within timeoutMs; repeat {steps, until, max (default 5)}, which reruns steps until until holds. All steps are validated first. A step fails when it throws or reports found: false (not inspect_element); the batch stops there unless continueOnError and reports the page's controls. A batch with actions returns one changes for the whole batch. A step that reads the page after an action or navigation first waits for the page to settle, so it needs no sleep.

Inputs: steps (required), sessionId, continueOnError.

run_tabsA

Run steps in several tabs at once and get every tab's results in one reply: {"tabs":[{"url":"https://a.example","steps":[{"tool":"read_text"}]},{"url":"https://b.example","steps":[{"tool":"read_text"}]}]}. A url tab opens, runs its steps, and closes unless keepTabs; a sessionId tab uses that session. Steps are as in run_steps. A tab that fails or passes timeoutMs does not stop the others.

Inputs: tabs (required), keepTabs, timeoutMs, concurrency, +2 more.

scrollC

Scroll the page by deltas, an element into view, or with a real wheel at x, y or over selector with deltas (scrolls what is under the pointer).

Inputs: x, y, block, deltaX, +3 more.

selectA

Pick a native option by value or label and fire change events; use click for custom dropdowns. Returns changes.

Inputs: selector (required), label, value, sessionId, +1 more.

take_screenshotB

Screenshot the page or selector: base64 in the JSON (output data, default), image content (image), or a file (file, or path). cssRect and scale convert image pixels to x, y.

Inputs: path, format, output, selector, +2 more.

typeB

Type with real text input into an input, textarea, or contenteditable, replacing its content unless clear is false. Returns changes.

Inputs: text (required), selector (required), clear, sessionId, +1 more.

upload_fileA

Set files on a file input (or its label, or an element holding one; on Chromium also a button that opens a file chooser) and fire change events. Files must be in the working or temp directory or MCP_BROWSER_UPLOAD_DIRS. Returns changes.

Inputs: paths (required), selector (required), sessionId, timeoutMs.

wait_forA

Wait until every given condition holds, or the first of anyOf; at timeoutMs it fails with the last observed state. Selector checks scroll the element into view. Actions already return what changed once the page settles, so wait only for something that comes later.

Inputs: url, anyOf, state, selector, +9 more.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    B3/5.0

    Scored across 24 tools

    Disambiguation4/5

    Most tools map to a single distinct action or resource (click, type, hover, select, scroll, press_key vs. get_snapshot, read_text, get_console_messages, get_network_requests), and the descriptions explicitly steer between near-neighbors (get_snapshot is 'far cheaper than get_document or a screenshot'; use click for custom dropdowns instead of select). The main soft spots are the reading tools (get_snapshot / read_text / take_screenshot) which all return page state in different shapes, and the tab trio new_tab / list_tabs / attach_tab plus the meta-tools run_steps / run_tabs / more_tools, which require reading descriptions to pick correctly.

    Naming Consistency4/5

    All names are snake_case with a predictable verb_noun or bare-verb style (get_snapshot, list_tabs, run_steps, take_screenshot vs. click, type, hover, navigate). Minor deviations exist: new_tab breaks the get_/list_/close_ pattern it pairs with (would be open_tab/create_tab), and read_text sits awkwardly beside get_snapshot/get_console_messages.

    Tool Count4/5

    24 tools is on the heavy side, but browser automation genuinely spans tabs, navigation, input, reading, waiting, JS evaluation, and batching, so most tools earn their place. The presence of more_tools to defer drag/cookies/HAR/performance shows deliberate scoping rather than surface bloat.

    Completeness4/5

    The core lifecycle is well covered: browser bootstrap (ensure_browser), tab management (new/list/attach/close), navigation, full input surface incl. file upload, state reading (snapshot, text, console, network, screenshot), waiting, JS eval, and batch execution across steps and tabs. Gaps like cookies/storage, request mocking, HAR, and drag are real but reachable through more_tools, so agents are not blocked.

    Maintenance

    ActivityMaintained
    ResponsivenessNo recent community issues

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      B
      quality
      B
      maintenance
      Enables AI agents and developers to automate real Chrome/Chromium browsers through the Chrome DevTools Protocol, with token-efficient snapshots, multi-action batching, shadow DOM traversal, system-page control, extension management, and network/WebSocket inspection.
      95
      1
      MIT
    • A
      license
      Not graded
      quality
      B
      maintenance
      Enables AI agents to drive real Chromium, WebKit, or Firefox browsers — opening named sessions, running ordered steps like clicks, typing, and assertions, and reading back text, console/network logs, and screenshots — so web apps can be tested and explored end to end. It starts and shares dev servers, attaches to already-running browsers, and can fake API responses or device settings.
      MIT