
Playwright MCP: let your AI assistant use a real browser
Lets Claude, Cursor and other AI assistants open a real browser, click through websites and test web apps for you.
Playwright MCP lets your AI assistant control a real web browser. It can open pages, click, type, fill forms and read what is on screen, so it can test your app or work through a website for you.
It reads pages as structured text, not screenshots, so it does not need an image-capable model. The catch is that this text is long. Each step sends a page snapshot back to the assistant, so long sessions use up the context window fast.
Good for
- Developers who want the assistant to check the app they just built in a real browser
- QA engineers writing or debugging browser tests with AI help
- Anyone who wants an assistant to fill forms or read pages that need clicking
- Teams testing sites in Chrome, Firefox, WebKit and Edge
Works in
11 supported · 1 should work
Tap an app to see how to set it up and any known problems.
Microsoft's README covers it, and Anthropic's plugin marketplace also lists it.
Documented in the README. On Windows it can fail to save files unless you set an output folder.
Known problems
- Closed
On Windows, browsing fails with a permission error writing to System32
Workaround: Add --output-dir pointing to a writable folder.
Reported Apr 2026 · GitHub
Microsoft's README has a one-click install button for Cursor. GitHub
Documented with an install button. Remote SSH setups can fail to find npx.
Known problems
Microsoft's README points to Windsurf's MCP docs and the standard config. GitHub
Documented in the README. Two copies sharing one browser profile cause 'browser already in use' errors.
Known problems
- Closed
'Browser is already in use' errors when two server copies share a profile
Workaround: Start each extra client with --isolated or its own --user-data-dir.
Reported Nov 2025 · GitHub
Microsoft's README gives the config for Gemini CLI's settings file. GitHub
Microsoft's README covers it, and the Copilot coding agent has it on by default. GitHub
Microsoft's README gives a ready settings entry for Cline. GitHub
Microsoft's README covers JetBrains Junie. GitHub
Microsoft's README gives a local entry for opencode's config file. GitHub
Supports local MCP servers.
Client does not support this transport.
Client does not support this transport.
Install Playwright MCP
Claude Code
- 1
Copy this prompt.
Add the Playwright MCP server to Claude Code. Run this command: claude mcp add playwright -- npx -y @playwright/mcp Then check that it loaded and tell me if I need to sign in or restart.
- 2
Paste it into Claude Code. It shows the change and asks before running it.
Requires Node.js 18+.
Needs Node.js 18 or newer. No account or sign-in. It opens a real browser window you can watch. Want the window hidden? Add --headless to the command.
Built from the package data we hold. Not yet tested by us.
Tools
Opens a web page in the browser at the address you give
Loads the URL you give into the browser so the assistant can work on that page.
Try: “Open https://example.com/signup in the browser”
Network ·
browser_navigateReads the text, links and buttons on the current page so the assistant can see it
Captures the structure of the current page, which the assistant uses to decide what to click or fill next.
Try: “What is on the page right now?”
Files ·
browser_snapshotTakes a picture of the current page or one element on it
Saves an image of the visible page, the full scrollable page, or a single element, as PNG, JPEG or WebP.
Try: “Take a full-page screenshot of the pricing page”
Files ·
browser_take_screenshotClicks a button, link or other element on the page
Clicks one element, with an option for double-click and for the left, right or middle button.
Try: “Click the Sign up button and tell me what happens”
Write ·
browser_clickTypes text into a field, optionally pressing Enter afterward
Enters text into an editable field, either all at once or one character at a time for pages that react to each key.
Try: “Type my search term into the search box and press Enter”
Write ·
browser_typeFills in several form fields in one step
Fills a list of form fields together, so a multi-field form does not need one action per field.
Try: “Fill in the contact form with the name and email from my notes”
Write ·
browser_fill_formPicks one or more options in a dropdown menu
Chooses one or several values in a dropdown on the page.
Try: “Set the country dropdown on the checkout form to Canada”
Write ·
browser_select_optionPresses a keyboard key such as Enter, Tab or an arrow key
Sends one key press to the page, or a single character.
Try: “Press Tab to move to the next field”
Write ·
browser_press_keyMoves the mouse over an element to open a menu or tooltip
Puts the mouse pointer over an element without clicking, which reveals hover menus and tooltips.
Try: “Hover over the Products menu and list the sub-items”
Write ·
browser_hoverDrags one element and drops it onto another
Performs a drag from a start element to an end element on the page.
Try: “Drag the Done card into the Shipped column”
Write ·
browser_dragDrops files or data onto an element, as if dragged in from outside the page
Simulates dropping files from your computer, or MIME-typed text and links, onto a page element.
Try: “Drop report.pdf from my project folder onto the upload area”
Write ·
browser_dropUploads one or more files from your computer into a page
Attaches the files at the paths you give to the page's file picker. If no paths are given, the picker is cancelled.
Try: “Upload invoice-march.pdf to the expense form”
Write ·
browser_file_uploadAccepts or dismisses a pop-up alert or confirm box
Answers a browser alert, confirm or prompt box, with optional text for a prompt.
Try: “Accept the confirmation box that asks to delete the draft”
Write ·
browser_handle_dialogGoes back to the previous page in the browser history
Moves the current tab one step back through its history.
Try: “Go back to the search results”
Network ·
browser_navigate_backWaits for text to appear or disappear, or for a set number of seconds
Pauses the session until the text you name shows up or goes away, or for up to 30 seconds.
Try: “Wait until the message Order confirmed appears”
Read ·
browser_wait_forChanges the browser window to a width and height you choose
Sets the browser window size in pixels, useful for checking a mobile layout.
Try: “Resize the window to 390 by 844 to check the mobile layout”
Write ·
browser_resizeSwitches the page between light and dark mode, reduced motion or print styles
Overrides color scheme, motion, contrast, forced colors and the CSS media type. Leave a setting out to keep it as it is.
Try: “Show the homepage in dark mode with reduced motion on”
Write ·
browser_emulate_mediaLists, opens, closes or switches between browser tabs
Manages the open tabs: list them, open a new one at a URL, close one, or select one by its position.
Try: “Open a new tab with my staging site and switch to it”
Write ·
browser_tabsCloses the current browser page
Closes the page the assistant is working on.
Try: “Close the browser when you are done”
Write ·
browser_closeReturns the messages the page wrote to its developer console
Lists console output such as logs, warnings and errors, filtered by level, and can save them to a file.
Try: “Show any errors the checkout page logged to the console”
Files ·
browser_console_messagesLists the network requests the page made, with an optional URL filter
Returns a numbered list of requests since the page loaded, so you can see which calls a page made and where they went.
Try: “List the API calls the dashboard made that match /api/orders”
Files ·
browser_network_requestsShows the headers and body of one request from the network list
Returns the full details of a single request by its number from the list, or only one part of it.
Try: “Show the response body of request 12”
Files ·
browser_network_requestRuns a JavaScript expression on the page or on one element and returns the result
Executes a short JavaScript function inside the page and returns its value, optionally saving it to a file.
Try: “Run a script that counts the images on this page”
Runs code ·
browser_evaluateRuns a custom automation script with full control of the page. Can run any code
Executes a Playwright-style script inside the automation server, from text or a file. It can run arbitrary JavaScript there, so use it only with code you trust.
Try: “Run this script that clicks the first result and returns its title”
Runs code ·
browser_run_code_unsafeTakes the browser offline or back online. Offline makes every request fail
Sets the network state to offline to test how a page behaves without connectivity, or back to online.
Try: “Take the browser offline and reload the app”
Write ·
browser_network_state_setFakes responses for network requests that match a URL pattern
Intercepts requests matching a pattern and returns a status, body, content type or headers you set instead of the real response.
Try: “Make every call to /api/users return an empty list”
Write ·
browser_routeLists the fake network responses that are active right now
Shows each active interception rule set with the route tool.
Try: “Which fake responses are still active?”
Read ·
browser_route_listRemoves fake network responses for one pattern, or all of them
Deletes an interception rule by its URL pattern, or every rule when no pattern is given.
Try: “Remove the fake response for /api/users”
Write ·
browser_unrouteLists the cookies stored in the browser, optionally by domain or path
Returns the cookies the browser holds, filtered by domain or path if you give one.
Try: “List the cookies the site set for example.com”
Read ·
browser_cookie_listGets one cookie by its name
Returns the value and details of the named cookie.
Try: “What is the value of the session cookie?”
Read ·
browser_cookie_getSets a cookie with an optional domain, path, expiry and security flags
Creates or replaces a cookie with the name and value you give, plus any flags you set.
Try: “Set a cookie named beta to true on example.com”
Write ·
browser_cookie_setDeletes one cookie by name, optionally only on one domain or path
Removes the named cookie, limited to a domain or path if you give one.
Try: “Delete the tracking cookie from example.com”
Delete ·
browser_cookie_deleteDeletes every cookie in the browser
Removes all cookies, so the next page load starts with no saved sessions.
Try: “Clear all cookies so I start logged out”
Delete ·
browser_cookie_clearLists every item in the page's local storage
Returns all key and value pairs in local storage for the current page.
Try: “Show everything the app keeps in local storage”
Read ·
browser_localstorage_listReads one local storage item by its key
Returns the value stored under the key you name.
Try: “What is saved under the theme key in local storage?”
Read ·
browser_localstorage_getSaves a value under a key in local storage
Writes the value you give under the key you give in local storage.
Try: “Set the theme key in local storage to dark”
Write ·
browser_localstorage_setDeletes one local storage item by its key
Removes the value stored under the named key.
Try: “Remove the draft key from local storage”
Delete ·
browser_localstorage_deleteDeletes every local storage item for the page
Removes all local storage entries for the current page.
Try: “Clear local storage for this site”
Delete ·
browser_localstorage_clearLists every item in the page's session storage
Returns all key and value pairs in session storage for the current tab.
Try: “Show what this tab has in session storage”
Read ·
browser_sessionstorage_listReads one session storage item by its key
Returns the value stored under the key you name in session storage.
Try: “What is the cart id in session storage?”
Read ·
browser_sessionstorage_getSaves a value under a key in session storage
Writes the value you give under the key you give in session storage.
Try: “Set step to 2 in session storage”
Write ·
browser_sessionstorage_setDeletes one session storage item by its key
Removes the value stored under the named key in session storage.
Try: “Remove the step key from session storage”
Delete ·
browser_sessionstorage_deleteDeletes every session storage item for the page
Removes all session storage entries for the current tab.
Try: “Clear session storage in this tab”
Delete ·
browser_sessionstorage_clearSaves cookies and local storage to a file you can reuse later
Writes the current cookies and local storage to a file, so a later session can start logged in.
Try: “Save my logged-in browser state to login-state.json”
Files ·
browser_storage_stateRestores cookies and local storage from a saved file, clearing what is there
Reads a saved state file and loads its cookies and local storage. Existing cookies and local storage are cleared first.
Try: “Restore the login state from login-state.json”
Delete ·
browser_set_storage_stateRecords the actions you take in the browser and turns them into code
Starts capturing the clicks and typing you do in the browser so they can be replayed as code.
Try: “Start recording while I walk through the checkout flow”
Read ·
browser_start_recordingStops the recording and returns the captured actions as code
Ends the recording started earlier and returns the recorded steps as code.
Try: “Stop recording and give me the code”
Read ·
browser_stop_recordingStarts recording a trace of the browser session
Begins a trace that captures what the browser does, for debugging later.
Try: “Start a trace before I reproduce the bug”
Read ·
browser_start_tracingStops the trace recording
Ends the trace started earlier.
Try: “Stop the trace now”
Read ·
browser_stop_tracingStarts recording a video of the browser session
Begins a screen recording of the page, saved to a file with an optional frame rate, size and animated cursor.
Try: “Start recording a video of the signup flow”
Files ·
browser_start_videoStops the video recording
Ends the video started earlier.
Try: “Stop the video recording”
Read ·
browser_stop_videoAdds a titled chapter card to the video recording
Shows a full-screen card with a title and optional description in the video, for splitting a recording into parts.
Try: “Add a chapter called Step 2: Payment to the video”
Write ·
browser_video_chapterLabels each action on screen with a callout while the video records
Turns on callouts that name each action and can animate a cursor between action points.
Try: “Show a label for every click in the video”
Write ·
browser_video_show_actionsTurns off the action callouts on screen
Stops annotating actions on the page.
Try: “Hide the action labels”
Write ·
browser_video_hide_actionsOpens annotation mode so you can draw on the page, then returns the marked-up image
Opens the page in annotation mode and waits for you to draw. Returns the annotated screenshot and a list of your marks.
Try: “Let me mark up the broken layout, then send it back to you”
Read ·
browser_annotateDraws a lasting outline around an element on the page
Adds a highlight box to one element, with optional custom CSS, until it is removed.
Try: “Outline the price field in red so I can find it”
Write ·
browser_highlightRemoves the highlight drawn around an element
Takes off a highlight added earlier for the same element.
Try: “Remove the red outline from the price field”
Write ·
browser_hide_highlightResumes a paused script, optionally pausing again before each step
Continues script execution after a pause. Set step to pause before every next action, for slow debugging.
Try: “Resume the script and pause before the next click”
Runs code ·
browser_resumeSaves the current page as a PDF file
Writes the current page to a PDF, at the file name you give or an automatic name.
Try: “Save this invoice page as a PDF”
Files ·
browser_pdf_saveClicks at exact screen coordinates on the page
Clicks at an X and Y position, for elements that have no usable reference. Supports double-click and button choice.
Try: “Click at position 420, 310 on the canvas”
Write ·
browser_mouse_click_xyMoves the mouse pointer to exact screen coordinates
Moves the pointer to an X and Y position without clicking.
Try: “Move the mouse to 100, 200”
Write ·
browser_mouse_move_xyPresses a mouse button down at the current pointer position
Holds the chosen mouse button down. Pair with the release tool to make a manual press.
Try: “Press the mouse button down here”
Write ·
browser_mouse_downReleases a mouse button at the current pointer position
Lets go of the chosen mouse button.
Try: “Release the mouse button”
Write ·
browser_mouse_upDrags from one set of screen coordinates to another
Holds the left button at a start X and Y and drags to an end X and Y.
Try: “Drag the slider from 50, 300 to 250, 300”
Write ·
browser_mouse_drag_xyScrolls the page with the mouse wheel by a set amount
Scrolls horizontally or vertically by the number of pixels you give.
Try: “Scroll the page down by 800 pixels”
Write ·
browser_mouse_wheelCreates a test locator for an element so it can be used in test code
Produces the code expression that finds a given element, for writing automated tests.
Try: “Give me a test locator for the Submit button”
Read ·
browser_generate_locatorChecks that an element with a given role and name is visible on the page
Asserts that an element with the role and accessible name you give is visible.
Try: “Check that the Save button is visible”
Read ·
browser_verify_element_visibleChecks that a list on the page shows the items you expect
Asserts that the named list contains the listed items.
Try: “Check that the cart list shows Shirt and Socks”
Read ·
browser_verify_list_visibleChecks that a piece of text is visible on the page
Asserts that the text you give is visible. Prefer the element check when you can.
Try: “Check that the text Payment received is on the page”
Read ·
browser_verify_text_visibleChecks the current value of a form field or checkbox
Asserts that a field holds the value you give. For a checkbox, use true or false.
Try: “Check that the newsletter box is ticked”
Read ·
browser_verify_valueUsed by the assistant behind the scenes
Shows the final settings the browser tool is running with
Returns the merged result of command options, environment variables and the config file.
Try: “Which browser capabilities are turned on right now?”
Read ·
browser_get_configSearches the page for text or a pattern to find the element to act on
Searches the page structure for text or a regular expression and returns matches with a few lines of context. The assistant uses it to locate an element before acting on it.
Try: “Find the element that says Add to cart”
Files ·
browser_find
Read from the source code
Pros and cons
Good
- Free and open source, with no account or API key.
- Made by Microsoft, the team behind Playwright.
- Works with Chrome, Firefox, WebKit and Edge.
- Reads pages as structured text, so no vision model is needed.
- Documented setup for most major AI assistants.
- Can keep your logins between sessions or start clean each time.
Watch out
- Page snapshots use a lot of context, so long sessions get cut short.
- Can run code and change data on real sites, with no read-only mode.
- Two assistants cannot share the default browser profile.
- Microsoft suggests its Playwright CLI for coding agents, which uses less context.
- No built-in HAR recording, and some tools are opt-in.
Permissions
high risk · 6 things to watch · 1 advisory
High risk
A web page you visit, or a mistaken click, could make the assistant act on real accounts or run code on your machine. Use an isolated session, approve each action by hand, and never leave it running unattended on logged-in sites.
What it can do
- Read your data
- Create and change things
- Delete things
- Read-only mode
Watch out for
It can run any code on your computer
One tool runs JavaScript in the server process, and the README calls it equivalent to remote code execution. Keep approval switched on for it. github.com
Logins are saved on disk by default
The default profile keeps cookies and sessions between runs. Use the isolated option for throwaway sessions, or delete the profile folder. github.com
Extension mode drives your real browser
With the extension option the assistant works in your open Chrome or Edge tabs, signed in as you. Only use it when you are watching. github.com
Microsoft says it is not a security boundary
Origin filters and the file-access limit are guardrails that can be worked around. Do not rely on them to contain a risky site. github.com
It can click, submit and change site data
The core tools click, type and submit forms on real sites, and opt-in tools can set or clear cookies. Confirm actions on accounts you care about. github.com
Keep HTTP mode on localhost
The port option starts a local web server, and binding to 0.0.0.0 exposes it to your network. Update past 0.0.40 for DNS rebinding protection. github.com
Security advisories
Technical details
| Turning on read-only | No read-only mode. The README marks each tool read-only or not, so you can auto-approve only read-only tools (snapshot, screenshot, console) and confirm the rest. |
|---|---|
| Talks to | Any website the assistant visits |
| Sign-in and keys | Default persistent browser profile on disk keeps cookies and sessions between runs. |
Alternatives
Use Playwright MCP to test and drive sites across Chrome, Firefox and WebKit. Pick Chrome DevTools MCP for performance traces and debugging in Chrome, or the Playwright CLI if your assistant has shell access and you want to save context.
| Server | Official | Runs | Sign-in | Can change things | GitHub stars |
|---|---|---|---|---|---|
| For Playwright | |||||
| Playwright MCPThis page | Official | Local | No sign-in | Yes | 38.9K |
| Playwright CLI | Official | Local | No sign-in | Yes | 14.8K |
| Other tools for the same job | |||||
| Chrome DevTools MCPFor Chrome DevTools | Official | Local | No sign-in | Yes | 54.5K |
What people say
People like how precise it is and dislike how much context it uses.
What people like
- Targets elements by page structure, so clicks are precise and no vision model is needed.
- Works in Chromium, Firefox and WebKit, which Chrome-only browser tools cannot.
- Lets the assistant read browser console output while it tests.
Common complaints
- Tool definitions and page snapshots eat a lot of context, so long sessions hit compaction.
- Some developers get better results by having the assistant write a Playwright script instead.
- No built-in HAR recording, and some useful tools sit behind opt-in flags.
- Weaker than Chrome DevTools MCP for performance traces and audits.
In their words
“I find when Claude Code is running playwright, each action it performs generates a large responses from playwright, and my context window is quickly used up.”thomhurstHacker NewsOct 2025
“Related anecdote: some months ago I tried to coax the Playwright MCP to do a full page screenshot and it couldn't do it. Then I just told Claude Code to write a Playwright JS script to do that and it worked at the first try.”yomismoaquiBlogApr 2026
“The interaction model is the part that matters: Playwright MCP operates on the page’s accessibility tree, not on screenshots.”Steve KinneyBlogApr 2026
“One thing I want to flag because I had to dig to confirm it: there is no first-class HAR recording or replay tool in @playwright/mcp.”Steve Kinney
Questions
Is Playwright MCP free?
Yes. It is free and open source under Apache-2.0, and it needs no account or API key.
Is Playwright MCP safe to run?
Microsoft says it is not a security boundary. Update to 0.0.40 or later, which fixes a flaw where a website could reach a locally running server, and keep approval on for the tool that runs code.
Can it use my logged-in accounts?
Yes. The default profile keeps logins between sessions, and extension mode connects to your open Chrome or Edge. For a clean, scripted login, use the isolated option with a saved storage state.
Do I need to install a browser first?
Usually not. The server downloads what it needs, or uses your installed Chrome. On minimal Linux images Chromium can fail to start because of missing system libraries.
Why does it use so many tokens?
Every action returns a snapshot of the page, and the tool list is loaded into context too. Microsoft rates its CLI as lighter and suggests it for coding agents.
How do I run it without a visible browser window?
Add the headless option to the server arguments. The browser is visible by default. The Docker image only runs headless Chromium.
Can two assistants use it at the same time?
Not with the same saved profile. Start each extra client in isolated mode or give it its own profile folder, or you will see 'browser already in use' errors.
Which browsers does it support?
Chrome, Firefox, WebKit and Edge. Extension mode works with Chrome and Edge only.
Can it take screenshots or save PDFs?
Screenshots work out of the box. Saving PDFs is opt-in, and so are the mouse tools that click by screen position.
Playwright MCP vs Chrome DevTools MCP?
Playwright MCP drives pages in several browsers. Chrome DevTools MCP fits debugging, performance traces and audits in Chrome only.
Examples
Check a feature you just built in the local dev server
Start the dev server, open http://localhost:3000 with Playwright, click through the signup form and tell me about any console errors.
SourceWalk through a demo app and test a flow
Use Playwright to open https://demo.playwright.dev/todomvc, add two todos, mark one done and take a screenshot.
SourceTest a page at a phone-sized viewport
Open our pricing page, resize the browser to 390x844 and check whether the plan table fits without horizontal scrolling.
Source
Information
updated Nov 2, 2026
- Publisher
- Microsoft (official)
- Package
@playwright/mcp- Registry
- npm
- Transport
- stdio, Streamable HTTP
- Version
- 0.0.82
- License
- Apache-2.0
- Last commit
- Oct 31, 2026
- Open issues
- 1
- Listed in
- Official MCP registry, Docker MCP Catalog
Other Playwright MCP servers
Sources
Docs, issue trackers and discussions this page is built from. Issues, quotes and findings above link to their own source.
Show all 11Hide
- microsoft/playwright-mcp README · github.com
- Playwright MCP introduction · playwright.dev
- Playwright vs. Chrome DevTools MCP: Driving vs. Debugging · stevekinney.com
- GHSA-6fg3-hvw7-2fwq · github.com
- Do I need to install a browser first? · github.com
- Extend Copilot coding agent with MCP · docs.github.com
- Claude plugins official · github.com
- Large responses consuming context windows · github.com
- Show HN: Playwright Skill for Claude Code · news.ycombinator.com
- Show HN: Playwright Skill for Claude Code · news.ycombinator.com
- microsoft/playwright-cli · github.com