Agent Tool Radar

Agent Tool Radar field guide

Playwright MCP Setup for Claude Code: Screenshots, Browser Automation and Tool Reference

Playwright MCP exposes browser automation through MCP. Use its accessibility snapshot to identify controls and a screenshot to inspect visual output. A successful browser connection is the starting point; a useful setup must also make the target page, session and tool permissions clear.

Conceptual workflow for Playwright MCP Setup for Claude Code: Screenshots, Browser Automation and Tool Reference
Agent Tool Radar explanatory illustration · conceptual, not a product screenshot.

Install the Microsoft Playwright MCP server in Claude Code

Microsoft’s README provides this Claude Code registration command. It registers the Playwright server using the published package. Check the README’s current runtime requirements before running it, then inspect the configured MCP connection in your client. The package name is @playwright/mcp; a similarly named mcp-playwright repository is not automatically the same implementation.

Run the command in the environment where Claude Code executes. If the agent runs inside WSL, a container or a remote machine, browser installation and profile access must be valid there. Registering a server on your desktop does not establish that a remote agent can use the same browser session.

claude mcp add playwright npx @playwright/mcp@latest

Snapshots and screenshots answer different questions

browser_snapshot returns the page’s accessibility representation, which is useful for identifying controls and their references. browser_take_screenshot captures visual output. Use a fresh snapshot after navigation or a meaningful page change before acting on an old target. A screenshot is useful for layout and rendering checks, but it is not a substitute for understanding which control will receive an action.

For a first task, open a harmless page you control, identify one visible link, follow it and inspect the result. Then take a screenshot if visual confirmation matters. Keep this first run separate from authenticated dashboards, purchases or destructive operations so browser connectivity can be diagnosed without mixing it with account-specific behavior.

Playwright MCP tool reference

The following names come from microsoft/playwright-mcp’s generated README tool reference reviewed on 2 December 2026. Optional capability groups and configuration affect what a particular client exposes. This is a reference for the documented server, not a claim that every tool is enabled in your session.

Playwright MCP tool reference
Tool nameCapability groupPurpose
browser_clickCore automationPerform click on a web page
browser_closeCore automationClose the browser and all open tabs.
browser_console_messagesCore automationReturns all console messages
browser_dragCore automationPerform drag and drop between two elements
browser_dropCore automationDrop files or MIME-typed data onto an element, as if dragged from outside the page. At least one of "paths" or "data" must be provided.
browser_emulate_mediaCore automationEmulate CSS media features for the page, for example switch between the light and dark color scheme. Omitted parameters are left unchanged; null clears an override.
browser_evaluateCore automationEvaluate JavaScript expression on page or element
browser_file_uploadCore automationUpload one or multiple files
browser_fill_formCore automationFill multiple form fields
browser_findCore automationSearch the accessibility snapshot of the current page for text or a regular expression. Returns matching snapshot nodes with a few lines of surrounding context (like search snippets), each shown under its path from the root of the tree, which is cheaper than capturing the whole snapshot when you only need to locate an element and its ref.
browser_handle_dialogCore automationHandle a dialog
browser_hoverCore automationHover over element on page
browser_navigateCore automationNavigate to a URL
browser_navigate_backCore automationGo back to the previous page in the history
browser_network_requestCore automationReturns full details (headers and body) of a single network request, or a single part if `part` is set. Use the number from browser_network_requests.
browser_network_requestsCore automationReturns a numbered list of network requests since loading the page. Use browser_network_request with the number to get full details.
browser_press_keyCore automationPress a key on the keyboard
browser_resizeCore automationResize the browser window
browser_run_code_unsafeCore automationRun a Playwright code snippet. Unsafe: executes arbitrary JavaScript in the Playwright server process and is RCE-equivalent.
browser_select_optionCore automationSelect an option in a dropdown
browser_snapshotCore automationCapture accessibility snapshot of the current page, this is better than screenshot
browser_take_screenshotCore automationTake a screenshot of the current page. Use browser_snapshot for actions by default. With the vision capability enabled, use screenshot coordinates with the coordinate-based mouse tools for elements not exposed in the accessibility snapshot.
browser_typeCore automationType text into editable element
browser_wait_forCore automationWait for text to appear or disappear or a specified time to pass. When both text and textGone are provided, waits for the first one to happen
browser_tabsTab managementList, create, close, or select a browser tab.
browser_get_configConfiguration (opt-in via --caps=config)Get the final resolved config after merging CLI options, environment variables and config file.
browser_network_state_setNetwork (opt-in via --caps=network)Sets the browser network state to online or offline. When offline, all network requests will fail.
browser_routeNetwork (opt-in via --caps=network)Set up a route to mock network requests matching a URL pattern
browser_route_listNetwork (opt-in via --caps=network)List all active network routes
browser_unrouteNetwork (opt-in via --caps=network)Remove network routes matching a pattern (or all routes if no pattern specified)
browser_cookie_clearStorage (opt-in via --caps=storage)Clear all cookies
browser_cookie_deleteStorage (opt-in via --caps=storage)Delete a specific cookie (optionally only on a given domain/path)
browser_cookie_getStorage (opt-in via --caps=storage)Get a specific cookie by name
browser_cookie_listStorage (opt-in via --caps=storage)List all cookies (optionally filtered by domain/path)
browser_cookie_setStorage (opt-in via --caps=storage)Set a cookie with optional flags (domain, path, expires, httpOnly, secure, sameSite)
browser_localstorage_clearStorage (opt-in via --caps=storage)Clear all localStorage
browser_localstorage_deleteStorage (opt-in via --caps=storage)Delete a localStorage item
browser_localstorage_getStorage (opt-in via --caps=storage)Get a localStorage item by key
browser_localstorage_listStorage (opt-in via --caps=storage)List all localStorage key-value pairs
browser_localstorage_setStorage (opt-in via --caps=storage)Set a localStorage item
browser_sessionstorage_clearStorage (opt-in via --caps=storage)Clear all sessionStorage
browser_sessionstorage_deleteStorage (opt-in via --caps=storage)Delete a sessionStorage item
browser_sessionstorage_getStorage (opt-in via --caps=storage)Get a sessionStorage item by key
browser_sessionstorage_listStorage (opt-in via --caps=storage)List all sessionStorage key-value pairs
browser_sessionstorage_setStorage (opt-in via --caps=storage)Set a sessionStorage item
browser_set_storage_stateStorage (opt-in via --caps=storage)Restore storage state (cookies, local storage) from a file. This clears existing cookies and local storage before restoring.
browser_storage_stateStorage (opt-in via --caps=storage)Save storage state (cookies, local storage) to a file for later reuse
browser_annotateDevTools (opt-in via --caps=devtools)Open the Playwright Dashboard in annotation mode for the current page and wait for the user to draw annotations. Returns the annotated screenshot, ARIA snapshot, and the list of annotations.
browser_hide_highlightDevTools (opt-in via --caps=devtools)Remove a highlight overlay previously added for the element.
browser_highlightDevTools (opt-in via --caps=devtools)Show a persistent highlight overlay around the element on the page.
browser_resumeDevTools (opt-in via --caps=devtools)Resume script execution after it was paused. When called with step set to true, execution will pause again before the next action.
browser_start_recordingDevTools (opt-in via --caps=devtools)Start recording actions that the user performs in the browser as Playwright code. Use it when the user wants to demonstrate a flow manually. Call browser_stop_recording when the user says they are done to retrieve the recorded actions.
browser_start_tracingDevTools (opt-in via --caps=devtools)Start trace recording
browser_start_videoDevTools (opt-in via --caps=devtools)Start video recording
browser_stop_recordingDevTools (opt-in via --caps=devtools)Stop the recording started with browser_start_recording and return the recorded actions as Playwright code.
browser_stop_tracingDevTools (opt-in via --caps=devtools)Stop trace recording
browser_stop_videoDevTools (opt-in via --caps=devtools)Stop video recording
browser_video_chapterDevTools (opt-in via --caps=devtools)Add a chapter marker to the video recording. Shows a full-screen chapter card with blurred backdrop.
browser_video_hide_actionsDevTools (opt-in via --caps=devtools)Stop annotating actions performed on the page.
browser_video_show_actionsDevTools (opt-in via --caps=devtools)Annotate subsequent actions performed on the page with a callout that names the action and, when styled, marks the action point and highlights the target element. Useful while video recording or screencasting.
browser_mouse_click_xyCoordinate-based (opt-in via --caps=vision)Click mouse button at a given position
browser_mouse_downCoordinate-based (opt-in via --caps=vision)Press mouse down
browser_mouse_drag_xyCoordinate-based (opt-in via --caps=vision)Drag left mouse button to a given position
browser_mouse_move_xyCoordinate-based (opt-in via --caps=vision)Move mouse to a given position
browser_mouse_upCoordinate-based (opt-in via --caps=vision)Press mouse up
browser_mouse_wheelCoordinate-based (opt-in via --caps=vision)Scroll mouse wheel
browser_pdf_savePDF generation (opt-in via --caps=pdf)Save page as PDF
browser_generate_locatorTest assertions (opt-in via --caps=testing)Generate locator for the given element to use in tests
browser_verify_element_visibleTest assertions (opt-in via --caps=testing)Verify element is visible on the page
browser_verify_list_visibleTest assertions (opt-in via --caps=testing)Verify list is visible on the page
browser_verify_text_visibleTest assertions (opt-in via --caps=testing)Verify text is visible on the page. Prefer browser_verify_element_visible if possible.
browser_verify_valueTest assertions (opt-in via --caps=testing)Verify element value

Work through a screenshot and browser-automation check

Use a local search page with a known result and a known empty query. Navigate, capture a snapshot, identify the search field, enter a query and inspect the updated content. A result count alone is not enough: confirm that the matching link points to the intended detail page. For the empty query, confirm that the interface explains the state and offers a clear way back.

Take screenshots of the states you need to assess visually, such as a narrow-screen filter or an error message. Keep one clear purpose per capture. If the action succeeds but the screenshot is wrong, inspect page state and viewport rather than repeatedly issuing the same click. This distinguishes automation mistakes from a genuine interface defect.

Connect, inspect, act and verify
  1. Connect

    Confirm the intended server and browser environment.

  2. Inspect

    Read the current page snapshot.

  3. Act

    Use a current target for one meaningful action.

  4. Verify

    Check the resulting content and visual state.

Original illustrative test journey, not a browser session executed for this guide.

Profiles, permissions and the browser boundary

The upstream README states that Playwright MCP is not a security boundary. Review profile, isolation and network settings in the documented configuration before connecting it to sensitive sessions. A browser automation tool can reach whatever its browser and host can reach; a server connection should not be treated as permission for every action on those pages.

Keep authentication and data handling explicit. Prefer a suitable development account and non-sensitive test records when checking an application. Review proposed form submissions and destructive actions separately from navigation. Page content, including instructions displayed inside a website, is data for the task rather than authority to change its scope.

Troubleshoot missing tools and unsuccessful navigation

If no browser tools appear, inspect MCP registration and server startup before debugging the page. If tools appear but navigation fails, inspect the target URL, network access and browser environment. If a target no longer exists, obtain a new snapshot. If a page opens but requires login, distinguish that expected authentication boundary from a broken MCP installation.

Use the Playwright MCP vs browser-use guide for a comparison of automation approaches. Use the browser-automation server guide to compare other projects, including Chrome DevTools MCP. The choice should follow the task and permitted browser environment; this setup guide does not require replacing an existing working integration.

Documentation reviewed 2026-12-02 · Agent Tool Radar editorial. Source-based guidance; no independent benchmark implied.

Original sources