mcp-agent-playwright
You can automate a real browser from an MCP-aware agent via Playwright, either using a server-owned browser or attaching to an existing Chromium browser over CDP.
Navigate pages:
browser_navigate,browser_go_back,browser_go_forward.Inspect state:
browser_status,browser_snapshot(numbered accessibility tree with[ref]targets),browser_console_messages.Interact:
browser_click,browser_type,browser_press_key,browser_hover,browser_select_option.Manage tabs:
browser_tabs,browser_tab_new,browser_tab_switch,browser_tab_close.Wait:
browser_wait_for_text,browser_wait_for_timeout.Capture screenshots:
browser_screenshotsaves PNGs and returns path/size.Run JS:
browser_evaluatefor scraping/querying beyond accessibility snapshots.Shut down/detach:
browser_close.Configure own-browser mode: headless, browser type, viewport, screenshot dir; or CDP attach via
MCP_PLAYWRIGHT_CDP_ENDPOINT.
Attach to an already-running Brave browser over Chrome DevTools Protocol (CDP), adopting existing tabs and providing Playwright-based navigation, accessibility snapshots, interaction, and capture tools without shutting the browser down.
Launch and automate Firefox as the Playwright browser in own-browser mode, enabling navigation, page snapshots, clicking, typing, waiting, and screenshots.
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@mcp-agent-playwright Open https://example.com and summarize the page content."
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
mcp-agent-playwright
Playwright browser automation for AI agents, as a local MCP server. Navigate, read accessibility snapshots, click, type, screenshot, and evaluate JavaScript in a real browser.
Build to be called by any MCP-aware agent harness (opencode, Claude, LM Studio agents, etc.) over stdio. Works in two modes:
Own browser (default) — lazily launches a fresh Playwright browser on first use and keeps it alive between tool calls.
CDP attach — set
MCP_PLAYWRIGHT_CDP_ENDPOINTto connect over Chrome DevTools Protocol to an already-running browser (Brave, Chrome, …). The server adopts the existing tabs and detaches on close — it never shuts the user's browser down.
Tool surface
Domain | Tools |
Navigation |
|
Page state |
|
Interaction |
|
Tabs |
|
Waiting |
|
Capture |
|
Escape hatch |
|
Lifecycle |
|
Related MCP server: agentic-browser-mcp
Requirements
Python 3.11+
Install
git clone <repo-url> mcp_agent_playwright
cd mcp_agent_playwright
uv syncInstall a Playwright browser binary:
uv run playwright install chromiumUsage
Run as an MCP server (stdio — what harnesses expect)
uv run mcp-agent-playwrightRegister in an MCP client
{
"mcpServers": {
"playwright": {
"command": "uv",
"args": ["--project", "/path/to/mcp_agent_playwright", "run", "mcp-agent-playwright"]
}
}
}Attach to a running browser (CDP mode)
Launch your browser with the debugging flag (example: Brave):
Start-Process -FilePath "C:\Program Files\BraveSoftware\Brave-Browser\Application\brave.exe" `
-ArgumentList '--remote-debugging-port=9222','--remote-allow-origins=*'Replace the -FilePath with your browser's actual path (Brave, Chrome, Edge,
or any Chromium-based browser).
Then set MCP_PLAYWRIGHT_CDP_ENDPOINT when starting the server (or in the
MCP client config):
{
"mcpServers": {
"playwright": {
"command": "uv",
"args": ["--project", "/path/to/mcp_agent_playwright", "run", "mcp-agent-playwright"],
"env": { "MCP_PLAYWRIGHT_CDP_ENDPOINT": "http://127.0.0.1:9222" }
}
}
}browser_status reports which mode is active (mode: cdp vs
mode: own-browser). If the CDP endpoint is configured but unreachable, the
server falls back to launching its own browser and says so in the status note.
Workflow
Start with browser_navigate(url), then browser_snapshot to see the page as
a numbered accessibility tree. Interact using a [ref] number or a locator
string (role=button,name=Submit, css=#id, text=Hello). Always snapshot
again after actions.
Configuration reference
Var | Default | Purpose |
|
|
|
|
|
|
|
| Browser viewport |
| (blank) | CDP URL to attach to instead of launching a browser |
|
| Where |
Development
uv run ruff check . # lint
uv run pyright # type check (src + tests, against .venv)
uv run pytest -q # testsuv sync installs the dev tooling (pytest, pytest-asyncio, pyright, ruff).
The suite has two tiers: plain unit tests that need no browser, and tests
marked browser that drive a real headless Chromium. The browser tier needs
uv run playwright install chromium once; until then those tests skip
rather than fail. CI installs Chromium, so nothing skips there.
License
MIT © 2026 Christof Milius
Available Tools
20 toolsbrowser_clickB
Click an element: snapshot ref number or locator string.
Inputs: target (required). Returns: result
browser_closeA
Shut down the browser and forget all state (tabs, refs, console log).
In CDP mode this detaches from the attached browser without closing it.
Inputs: no named parameters. Returns: result
browser_console_messagesA
Return recent browser console messages (errors, warnings, logs).
Inputs: level. Returns: result
browser_evaluateA
Run arbitrary JavaScript in the page and return the result.
Example: document.title or ({hrefs: [...document.querySelectorAll('a')].map(a => a.href)}).
Use for scraping data the accessibility snapshot cannot express.
Inputs: js (required). Returns: result
browser_go_backA
Navigate the active tab back in history.
Inputs: no named parameters. Returns: result
browser_go_forwardB
Navigate the active tab forward in history.
Inputs: no named parameters. Returns: result
browser_hoverA
Move the mouse cursor over an element (for hover menus/tooltips).
Inputs: target (required). Returns: result
browser_press_keyA
Press a keyboard key on the page. For Enter after typing use browser_type(..., enter=True).
Inputs: key (required). Returns: result
browser_screenshotA
Take a screenshot of the current viewport and save it as a PNG file.
Returns the absolute file path and image size. Does NOT show the image to the model — use browser_snapshot for content.
Inputs: filename, full_page. Returns: result
browser_select_optionA
Select an option in a dropdown () by value or label.
Inputs: target (required), values (required). Returns: result
browser_snapshotA
Read the current page as a numbered accessibility tree.
Interactive elements are prefixed with [ref] numbers. Pass a ref to any browser_* tool that accepts a target. Re-run after every action.
Inputs: max_nodes. Returns: result
browser_statusA
Report browser state: current page URL, title, and open tab list.
Use this first if you are unsure whether a browser is running.
Inputs: no named parameters. Returns: result
browser_tab_closeA
Close a browser tab. Defaults to the active tab.
Inputs: index. Returns: result
browser_tab_newB
Open a new browser tab and switch to it.
Inputs: url. Returns: result
browser_tabsA
List open browser tabs with index, title and URL.
Inputs: no named parameters. Returns: result
browser_tab_switchA
Switch to an existing tab by its index from browser_tabs().
Inputs: index (required). Returns: result
browser_typeA
Type text into an input field, replacing its current content.
Inputs: text (required), target (required), enter. Returns: result
browser_wait_for_textA
Wait until a piece of text becomes visible on the page, or the timeout runs out.
Inputs: text (required), timeout. Returns: result
browser_wait_for_timeoutB
Wait a fixed amount of time (page sleeps/progress bars).
Inputs: ms. Returns: result
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 20 tools
Most tools map to distinct, well-separated browser actions like navigate, click, type, and tab management. The main overlap is between browser_status and browser_tabs, both reporting tab information, and between the two wait tools, but their descriptions are clear enough to guide correct selection.
All tools share a consistent browser_ prefix and mostly use a clear verb-action pattern such as browser_navigate, browser_click, and browser_tab_switch. A few query-style names like browser_status, browser_snapshot, and browser_tabs deviate slightly from strict verb_noun naming, but the pattern remains highly predictable.
Twenty tools is on the higher end but appropriate for browser automation, where atomic actions like clicking, typing, waiting, tab management, and screenshotting each need dedicated operations. The set could be slightly consolidated, but no tool feels redundant or out of place.
The toolset covers the core browser lifecycle well: navigation, interaction, waiting, tab management, JavaScript evaluation, console inspection, screenshots, and shutdown. Missing conveniences like explicit refresh or scroll are minor because browser_evaluate can cover them, so agents should not hit dead ends.
Maintenance
Related MCP Connectors
Control a real browser from AI agents: navigate, click, type, screenshot, read the page.
Official Browserless MCP server: browser automation, scraping, screenshots and PDFs for AI agents.
Web scraping, browser automation, screenshots and AI data extraction for AI agents via MCP.
Stealth web browser for agents: search, fetch, click, download and type in persistent MCP sessions.
Related MCP Servers
- FlicenseBqualityDmaintenancePlaywright wrapper for MCP that enables LLM-powered clients to control a browser for automation tasks.101-
- AlicenseAqualityDmaintenanceEnables MCP clients to automate a real Chrome browser via Playwright, supporting session sharing and tools for navigation, clicking, typing, and more.11105 npm2MIT
- AlicenseCqualityDmaintenanceExposes a remote browser as MCP tools via Playwright, enabling AI agents to navigate and interact with web pages through DOM snapshots, clicks, typing, and form operations.4010 npm14Apache 2.0

orchords-web-pilotofficial
FlicenseAqualityCmaintenanceEnables coding agents to drive a real Playwright-backed browser session, navigating, observing, interacting, and capturing proof on web pages via MCP tools across stdio and Streamable HTTP transports.152-