Skip to main content
Glama
Pagewright (browser-mcp)

Pagewright (browser-mcp)

by zamansheikh

Pagewright

Give your AI agent a real browser. An MCP server and Chrome extension that let Claude, Cursor and any MCP client see and control the browser you already use, with your logins, to test and fix frontends and to scrape data.

CI License: MIT MCP Node PRs welcome

Quick start · What it can do · Tool reference · How it works · Contributing

A real session: every line on the left is actual tool output from Pagewright.

Why Pagewright

Most browser tools for AI agents start a fresh, empty browser. Pagewright works in your browser instead.

  • Logged in already. Your sessions and cookies are there, so agents can work on dashboards, admin panels and sites behind a login.

  • Built for fixing frontends. browser_audit_layout finds overflow, overlapping elements, clipped text, contrast and image problems. browser_inspect shows the CSS rule behind a style, with its file and line number, so the agent knows exactly what to edit.

  • Scraping that holds up. Pagewright extracts records, follows pagination and infinite scroll, and saves to CSV or JSON. It can also read the JSON APIs a page calls.

  • Real input. Clicks and keystrokes go through Chrome's DevTools protocol, so they work with React, Vue and Svelte. If a modal covers the target, the click fails and says so, instead of hitting the wrong element.

  • Compact page snapshots. A tree of headings, text and controls, each control with a [ref=e12] handle. It is cheaper and more precise than sending screenshots.

  • Several agents, one browser. Every agent session shares the same browser through a local hub, with automatic failover.

  • Local only. Everything stays on 127.0.0.1: no cloud, no telemetry. Web pages cannot connect to the server.

Related MCP server: Orvima

Quick start

You need Node.js 18+, git, and Chrome, Brave, Edge or another Chromium browser.

1. Install the server. One command, which also registers it with Claude Code if you have it:

npx -y github:zamansheikh/browser-mcp setup

2. Add the extension. Open chrome://extensions, turn on Developer mode, click Load unpacked, and choose ~/.browser-mcp/extension. The installer prints this path and opens the folder for you. A Chrome Web Store listing is in review.

3. Check it works:

npx -y github:zamansheikh/browser-mcp check

Restart your AI app (MCP servers load at startup) and ask it to "open example.com and describe the page".

setup prints the exact command and paths for your machine. The config looks like this in most apps:

{
  "mcpServers": {
    "browser": {
      "command": "node",
      "args": ["/Users/you/.browser-mcp/server/index.js"]
    }
  }
}

App

Where the config goes

Claude Code

claude mcp add browser -s user -- node ~/.browser-mcp/server/index.js

Claude Desktop

~/Library/Application Support/Claude/claude_desktop_config.json (macOS), %APPDATA%\Claude\claude_desktop_config.json (Windows)

Cursor

~/.cursor/mcp.json

Windsurf

~/.codeium/windsurf/mcp_config.json

VS Code

.vscode/mcp.json, under a "servers" key

git clone https://github.com/zamansheikh/browser-mcp
cd browser-mcp
npm install

Load the extension/ folder with Load unpacked, then point your AI app at node /absolute/path/to/browser-mcp/server/index.js.

What it can do

Test and fix a frontend

"Open localhost:3000, check it on mobile, tablet and desktop, and fix any layout problems in the source."

The agent sets the viewport (browser_set_viewport) and runs browser_audit_layout, which reports:

  • horizontal overflow and the element that causes it

  • content spilling out of its container, and text that is cut off

  • elements covered by others, so clicks would land on the wrong thing

  • broken, stretched or oversized images

  • low color contrast, tiny text and tap targets, and unlabeled buttons

  • console errors and failed network requests

It then runs browser_inspect on a culprit to get the box model, computed styles, and the matching CSS rules with file:line. It tests a fix live with browser_inject_css, confirms it with a screenshot and a second audit, and edits your source.

Scrape structured data

"Collect every product from this category, following the Next button, into products.csv with name, price and link."

// browser_scrape
{
  "url": "https://shop.example.com/category/lamps",
  "itemSelector": ".product-card",
  "fields": {
    "name": "h2",
    "price": { "selector": ".price", "type": "number" },
    "url": "a@href",
    "tags": { "selector": ".tag", "all": true }
  },
  "nextSelector": "a[rel=next]",
  "maxPages": 20,
  "savePath": "products.csv"
}

Field specs can be "selector", "selector@attribute", "." (the item itself), or { selector, attr, all, type: "number", regex }. Use infiniteScroll: 10 for feeds. browser_get_content turns any page into markdown, links, tables or metadata (including JSON-LD). browser_network with browser_network_body reads the JSON APIs a page calls, which is often cleaner than parsing HTML.

Please scrape responsibly: follow sites' terms, and keep delayMs polite.

Automate and test flows

"Log in to the staging dashboard, create a test invoice, and tell me if anything errors in the console."

- form "Sign in":
  - textbox "Email" [type=email] [value=""] [ref=e9]
  - textbox "Password" [type=password] [value=""] [ref=e10]
  - button "Sign in" [ref=e12]

The agent reads a snapshot like the one above, then clicks and types by ref: browser_click { ref: "e12" }. Refs last until the element is removed or the page navigates.

Tools

Area

Tools

Tabs and navigation

browser_status · browser_tabs · browser_navigate

Seeing the page

browser_snapshot · browser_screenshot · browser_get_content

Interacting

browser_click · browser_type · browser_press_key · browser_select_option · browser_hover · browser_scroll · browser_wait_for · browser_upload_file · browser_handle_dialogs · browser_evaluate

Frontend debugging

browser_audit_layout · browser_inspect · browser_set_viewport · browser_inject_css · browser_console · browser_network · browser_network_body

Scraping

browser_extract · browser_scrape

Full reference with every parameter →. It is generated from the code, so it is always current.

How it works

flowchart LR
  A1["AI app #1<br/>(MCP client)"] -- stdio --> S1["browser-mcp<br/>(hub)"]
  A2["AI app #2"] -- stdio --> S2["browser-mcp"]
  S2 -- "ws://127.0.0.1:18800/agent" --> S1
  S1 -- "ws://127.0.0.1:18800/extension" --> E["Pagewright extension<br/>(service worker)"]
  E -- "chrome.debugger<br/>(DevTools protocol)" --> T["Your tabs"]
  1. Your AI app starts browser-mcp as an MCP server over stdio.

  2. The first browser-mcp process becomes the hub on 127.0.0.1:18800. Later ones relay through it, and one takes over if the hub exits.

  3. The extension connects to the hub and runs each command in the browser: DevTools-protocol calls for input, screenshots, emulation, CSS, console and network, plus a small in-page library (page-lib.js) for snapshots, audits and extraction.

  4. If Pagewright is installed in more than one browser, the first to connect is active and the others wait on standby.

Configuration

Variable

Default

Purpose

BROWSER_MCP_PORT

18800

Hub port. Must match the port in the extension popup.

BROWSER_MCP_CONNECT_TIMEOUT

20000

Milliseconds a call waits for the extension to connect.

BROWSER_MCP_EXTENSION_IDS

any

Comma-separated extension IDs allowed to connect.

Security and privacy

Pagewright gives an AI agent the same power you have in your browser, including on sites where you are logged in. Connect only agents you trust.

  • The hub listens only on 127.0.0.1. The /extension endpoint accepts only browser-extension origins, and /agent rejects any request that carries an Origin header, so websites cannot drive your browser.

  • Chrome shows a "started debugging this browser" bar on every tab under control. Release tabs from the popup at any time.

  • There is no telemetry, and there are no accounts. See the privacy policy.

  • JavaScript alert/confirm dialogs are auto-accepted so pages don't freeze the agent. Each one is logged, and browser_handle_dialogs changes this.

Found a vulnerability? Please report it privately, as described in SECURITY.md.

FAQ and troubleshooting

Check that the browser is open and Pagewright is enabled. The popup should show the same port as the server (18800 by default). Then run npx -y github:zamansheikh/browser-mcp check. After the server starts, the extension can take up to 30 seconds to reconnect; opening the popup makes it reconnect immediately.

Chrome does not allow extensions to control its own pages (chrome://, the Web Store, other extensions). Navigate to a normal web page first. If DevTools is open on that tab, close it and retry.

Pagewright uses Chrome's DevTools protocol to send trusted clicks, take screenshots and read CSS rules. Chrome always shows that bar while it is in use, which is a good thing: you can always see which tabs an agent controls.

Those libraries launch and script their own browser, and are best for repeatable test suites. Pagewright is made for AI agents working interactively in your everyday browser. It returns agent-friendly output (compact snapshots with refs, layout audits, CSS sources) and needs no test code.

Not yet. The extension relies on Chrome's chrome.debugger API, so it works in Chromium browsers: Chrome, Edge, Brave, Arc, Opera and Vivaldi. Firefox support would need a different backend. Help is welcome.

  • Cross-origin iframes are not included in snapshots. Same-origin iframes are.

  • Screenshots bring the tab to the front, because background tabs don't render.

  • Console and network capture start when an agent first touches a tab. Reload to capture a page's initial load.

  • The Chrome Web Store build leaves out browser_evaluate, because store extensions may not run code they didn't ship with.

Contributing

Contributions of every size are welcome: bug reports, docs, new tools, audit rules, and support for more browsers.

git clone https://github.com/zamansheikh/browser-mcp && cd browser-mcp && npm install
npm test          # fast checks, no browser needed
npm run test:e2e  # full browser test (see CONTRIBUTING.md)

Roadmap

  • Chrome Web Store release (in review)

  • Publish to npm for npx pagewright

  • Save pages as PDF, and drag and drop

  • Accessibility-tree snapshot mode, using Chrome's own accessibility tree

  • Network request mocking and blocking for testing

  • Firefox support

If you'd like to take one of these on, open an issue to discuss it first.

License

MIT © zamansheikh and contributors.

If Pagewright saves you time, a ⭐ helps others find it.

Available Tools

25 tools
browser_audit_layoutA
Read-only

Scan the page for visual and layout bugs: horizontal overflow and the elements causing it, content sticking out of its container, clipped text, elements covered by others, broken/stretched/oversized images, low color contrast, tiny text and tap targets, unlabeled controls, plus console errors and failed requests. Each issue has a ref for browser_inspect/browser_screenshot. Run it at several viewports (browser_set_viewport).

Inputs: tabId, maxPerType.

browser_clickA

Click an element with a real mouse event (scrolls it into view first). Target by ref (from browser_snapshot), selector, or x/y viewport coordinates. Reports navigation and any new tabs the click opened. Fails with an explanation if another element (e.g. a modal) covers the target.

Inputs: x, y, ref, force, +4 more.

browser_consoleA
Read-only

Read console messages, uncaught errors, browser warnings (CSP, mixed content, failed loads) and auto-handled dialogs for the current page.

Inputs: clear, level, limit, tabId, +2 more.

browser_evaluateA

Run JavaScript in the page and return the JSON result. Supports top-level await. Example: "document.querySelectorAll('a').length". Not available when the extension was installed from the Chrome Web Store (browser_status shows evaluateAvailable); prefer the other tools.

Inputs: expression (required), tabId.

browser_extractA
Read-only

Extract structured data from the current page. Give itemSelector (one element per record, e.g. ".product") and fields relative to each item, e.g. {"name": "h2", "price": {"selector": ".price", "type": "number"}, "url": "a@href", "image": "img@src"}. Without itemSelector, fields are read once from the whole page.

Inputs: fields (required), limit, tabId, savePath, +1 more.

browser_get_contentA
Read-only

Get page content for reading or scraping: "markdown" (clean readable text with links), "text", "html", "links" (all links), "tables" (every as JSON rows), or "meta" (title, description, OpenGraph, JSON-LD, headings).

Inputs: tabId, format, mainOnly, maxChars, +2 more.

browser_handle_dialogsB

Set how alert/confirm/prompt dialogs are answered on a tab (they are auto-accepted by default and logged to browser_console).

Inputs: tabId, accept, promptText.

browser_hoverB

Move the mouse over an element (to open hover menus or tooltips, or check :hover styles).

Inputs: x, y, ref, tabId, +1 more.

browser_inject_cssA

Live-test a CSS fix on the page without editing files: inject CSS (replaces the previous CSS with the same id), then screenshot/audit to verify. remove:true removes it. Once it looks right, apply the same change to the source code. Lost on reload.

Inputs: id, css, tabId, append, +1 more.

browser_inspectA
Read-only

Explain an element's layout: box size and position, margin/border/padding, key computed styles, overflow, parent, and the CSS rules that style it with their source file and line — use it to find which rule to change when fixing the frontend.

Inputs: ref, tabId, selector, properties, +1 more.

browser_navigateA

Open a URL in the current tab and wait for it to load, or go back/forward/reload. Returns final URL, title and HTTP status.

Inputs: url, tabId, action, timeout.

browser_networkA
Read-only

List network requests made by the current page (method, status, type, size, timing). Filter by URL substring, type ("xhr,fetch", "document", "script", "image"…), or failedOnly. Great for finding the JSON API behind a page when scraping — then read it with browser_network_body.

Inputs: type, clear, limit, tabId, +3 more.

browser_network_bodyA
Read-only

Get the response body of a request listed by browser_network (e.g. an API's JSON). Optionally save it to a file.

Inputs: requestId (required), tabId, maxChars, savePath.

browser_press_keyA

Press keys on the focused element: "Enter", "Escape", "Tab", "ArrowDown", "Control+A", "Meta+Shift+K". Space-separate to press several in order.

Inputs: key (required), tabId.

browser_scrapeA

Scrape many records across pages in one call: optionally open url, extract items with itemSelector+fields, then follow pagination by clicking nextSelector (up to maxPages) and/or scroll to load more (infiniteScroll = number of scrolls). Deduplicates, and saves to .json/.csv with savePath. Uses your real logged-in browser session, so it works on sites that need login or run heavy JavaScript.

Inputs: fields (required), itemSelector (required), url, limit, +6 more.

browser_screenshotA
Read-only

Capture what the page looks like: the viewport (default), the full scrollable page, or one element (ref/selector). Use it to check visual layout, spacing, alignment, and the result of CSS changes.

Inputs: ref, scale, tabId, format, +5 more.

browser_scrollA

Scroll the page or a scrollable element: by deltaY/deltaX pixels (real wheel events, triggers lazy loading), to "top"/"bottom", or scroll an element into view (ref/selector only).

Inputs: to, ref, tabId, deltaX, +2 more.

browser_select_optionB

Choose option(s) in a native by value or visible label.

Inputs: values (required), ref, tabId, selector.

browser_set_viewportA

Emulate a screen size to test responsive layouts: preset "mobile" (390x844), "mobile-small" (360x640), "tablet" (820x1180), "laptop" (1366x768), "desktop" (1440x900), "desktop-hd" (1920x1080), or custom width/height. reset:true restores the real window.

Inputs: reset, tabId, width, height, +3 more.

browser_snapshotA
Read-only

Read the page as a compact accessibility-style tree: headings, text, and every interactive element with a [ref=eN] you can pass to click/type/inspect. Use this first to understand a page and find elements — it is cheaper and more precise than a screenshot.

Inputs: tabId, maxChars, selector, interactiveOnly.

browser_statusA
Read-only

Check whether the browser extension is connected and which mode this server runs in (hub or relaying through another agent's hub).

Inputs: no named parameters.

browser_tabsB

List, open, select (focus) or close browser tabs. "new" opens a tab (optionally at url) and makes it the agent's current tab; "select" makes a tab current.

Inputs: url, tabId, action, background.

browser_typeA

Type text into an input, textarea or contenteditable. Replaces the current value by default (clear:false to append). Works with React/Vue controlled inputs. submit:true presses Enter afterwards.

Inputs: text (required), ref, clear, tabId, +3 more.

browser_upload_fileC

Set local files on an .

Inputs: paths (required), ref, tabId, selector.

browser_wait_forB

Wait until a selector appears (or disappears with gone:true), text appears, or textGone disappears; or just wait time ms.

Inputs: gone, text, time, tabId, +3 more.

Tool Schema Changelog

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

Loading tool schema changelog…

    TDQS

    A3.6/5.0

    Scored across 25 tools

    Disambiguation4/5

    Most tools have clearly distinct purposes, especially the interaction, developer-tooling, and scraping groups. There is some potential overlap between browser_snapshot, browser_get_content, browser_extract, and browser_scrape, but the descriptions give enough guidance to distinguish reading, structured extraction, and multi-page scraping.

    Naming Consistency5/5

    Every tool uses the same browser_ prefix and snake_case convention. The names are predictable and readable, even where they use noun-style names like browser_tabs or browser_console.

    Tool Count4/5

    Twenty-five tools is on the heavy side, but the surface is broad browser automation and the tools are cleanly grouped into navigation, interaction, layout inspection, debugging, and scraping. Each tool appears to earn its place, though the set is slightly larger than ideal for quick agent selection.

    Completeness4/5

    The server covers the core browser automation lifecycle very thoroughly: navigation, tab management, reading, interaction, waiting, uploading, dialogs, viewport emulation, CSS injection, console/network debugging, and structured scraping. Minor gaps remain around explicit iframe/frame handling, cookies/storage, downloads, and drag-and-drop, but most workflows are covered.

    Maintenance

    ActivityStale
    ResponsivenessNo recent community issues

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      Not graded
      quality
      B
      maintenance
      Enables any MCP-capable AI client to drive the user's own Chrome or Edge browser through a set of browse_* tools — navigating, clicking, typing, extracting, and managing tabs with their existing logins on their own machine. Runs locally and self-hosted with a live viewport and pause/approve controls so every verified step stays under user watch.
      4
      MIT
    • A
      license
      Not graded
      quality
      A
      maintenance
      Enables AI coding tools to control your real, already-logged-in Chrome browser through local MCP tools for navigation, reading, screenshots, form filling, cookies, tabs, network inspection, and more. It works via a Chrome extension rather than a remote-debugging port, keeping all communication on your machine.
      1 npm
      ISC
    • A
      license
      Not graded
      quality
      A
      maintenance
      Enables AI coding tools to drive your real, already-logged-in Chrome browser through an extension-based local MCP bridge, with no debugging port or headless setup required. It provides tools for navigating pages, reading content, clicking, typing, screenshots, tabs, cookies, network inspection, and more.
      1 npm
      ISC