Name
playwright
Description
A Model Context Protocol server that provides browser automation capabilities using Playwright. Enables LLMs to interact with web pages through structured accessibility snapshots — no vision models required.
Server
{
"command": "npx",
"args": [
"@playwright/mcp@latest"
]
}Tools
browser_navigate
Navigate to a URL in the current tab.
Input Schema
{
"type": "object",
"required": [
"url"
],
"properties": {
"url": {
"type": "string",
"description": "The URL to navigate to."
}
}
}browser_navigate_back
Navigate back in the browser history.
Input Schema
{
"type": "object",
"properties": {}
}browser_snapshot
Capture the current accessibility tree snapshot of the page. Returns structured element references (ref=eN) used by other tools.
Input Schema
{
"type": "object",
"properties": {}
}browser_take_screenshot
Take a screenshot of the current page or a specific element.
Input Schema
{
"type": "object",
"properties": {
"element": {
"type": "string",
"description": "Ref or CSS selector for the element to screenshot (optional)."
},
"raw": {
"type": "boolean",
"description": "Return raw base64 image data instead of saving to a file."
}
}
}browser_click
Click an element on the page.
Input Schema
{
"type": "object",
"required": [
"element"
],
"properties": {
"element": {
"type": "string",
"description": "Element ref (e.g. \"e5\") or CSS selector."
},
"button": {
"type": "string",
"enum": [
"left",
"right",
"middle"
],
"description": "Mouse button to use. Defaults to \"left\"."
},
"modifiers": {
"type": "array",
"items": {
"type": "string",
"enum": [
"Alt",
"Control",
"Meta",
"Shift"
]
},
"description": "Keyboard modifiers to hold during the click."
}
}
}browser_hover
Hover over an element on the page.
Input Schema
{
"type": "object",
"required": [
"element"
],
"properties": {
"element": {
"type": "string",
"description": "Element ref or CSS selector."
}
}
}browser_type
Type text into the currently focused element.
Input Schema
{
"type": "object",
"required": [
"text"
],
"properties": {
"text": {
"type": "string",
"description": "Text to type."
},
"delay": {
"type": "number",
"description": "Milliseconds between keystrokes (optional)."
}
}
}browser_fill_form
Fill a form field with a value.
Input Schema
{
"type": "object",
"required": [
"element",
"value"
],
"properties": {
"element": {
"type": "string",
"description": "Element ref or CSS selector."
},
"value": {
"type": "string",
"description": "Value to fill."
}
}
}browser_select_option
Select an option in a element.
Input Schema
{
"type": "object",
"required": [
"element",
"value"
],
"properties": {
"element": {
"type": "string",
"description": "Element ref or CSS selector of the <select>."
},
"value": {
"type": "string",
"description": "Option value or label to select."
}
}
}browser_press_key
Press a keyboard key (e.g. "Enter", "Tab", "Escape").
Input Schema
{
"type": "object",
"required": [
"key"
],
"properties": {
"key": {
"type": "string",
"description": "Key to press. Accepts Playwright key names such as \"Enter\", \"Tab\", \"ArrowDown\", \"F5\", etc.\n"
},
"modifiers": {
"type": "array",
"items": {
"type": "string",
"enum": [
"Alt",
"Control",
"Meta",
"Shift"
]
}
}
}
}browser_drag
Drag an element from one position to another.
Input Schema
{
"type": "object",
"required": [
"sourceElement",
"targetElement"
],
"properties": {
"sourceElement": {
"type": "string",
"description": "Ref or CSS selector of the element to drag."
},
"targetElement": {
"type": "string",
"description": "Ref or CSS selector of the drop target."
}
}
}browser_handle_dialog
Accept or dismiss a browser dialog (alert / confirm / prompt).
Input Schema
{
"type": "object",
"required": [
"action"
],
"properties": {
"action": {
"type": "string",
"enum": [
"accept",
"dismiss"
]
},
"promptText": {
"type": "string",
"description": "Text to enter if the dialog is a prompt (optional)."
}
}
}browser_file_upload
Upload a file via a file input element.
Input Schema
{
"type": "object",
"required": [
"element",
"files"
],
"properties": {
"element": {
"type": "string",
"description": "Ref or CSS selector of the <input type=\"file\"> element."
},
"files": {
"type": "array",
"items": {
"type": "string"
},
"description": "Absolute paths to the files to upload."
}
}
}browser_wait_for
Wait for an element or a network response to appear.
Input Schema
{
"type": "object",
"properties": {
"element": {
"type": "string",
"description": "Ref or CSS selector to wait for (optional)."
},
"url": {
"type": "string",
"description": "URL pattern to wait for a network response on (optional)."
},
"timeout": {
"type": "number",
"description": "Maximum wait time in milliseconds (default 30000)."
}
}
}browser_tabs
List open tabs, create a new tab, switch to a tab, or close a tab.
Input Schema
{
"type": "object",
"properties": {
"action": {
"type": "string",
"enum": [
"list",
"new",
"switch",
"close"
],
"description": "Tab action to perform."
},
"tabId": {
"type": "string",
"description": "Tab ID for switch / close actions (optional)."
},
"url": {
"type": "string",
"description": "URL to open in a new tab (optional)."
}
}
}browser_resize
Resize the browser viewport or emulate a device.
Input Schema
{
"type": "object",
"properties": {
"width": {
"type": "number",
"description": "Viewport width in pixels."
},
"height": {
"type": "number",
"description": "Viewport height in pixels."
},
"device": {
"type": "string",
"description": "Named device to emulate (e.g. \"iPhone 15\", \"iPad Pro 11\", \"Desktop Chrome\"). Overrides width/height when provided.\n"
},
"orientation": {
"type": "string",
"enum": [
"landscape",
"portrait"
]
}
}
}browser_network_requests
List all network requests made since page load, with status, method, URL, response headers, and optional response body.
Input Schema
{
"type": "object",
"properties": {
"responseBody": {
"type": "boolean",
"description": "Include response bodies (default false)."
},
"responseHeaders": {
"type": "boolean",
"description": "Include response headers (default false)."
}
}
}browser_console_messages
Return browser console messages (errors, warnings, logs).
Input Schema
{
"type": "object",
"properties": {
"level": {
"type": "string",
"enum": [
"error",
"warning",
"info",
"debug"
],
"description": "Minimum severity level to return (default \"error\")."
}
}
}browser_evaluate
Evaluate a JavaScript expression or function in the page context. Accepts a plain expression or an async arrow function body.
Input Schema
{
"type": "object",
"required": [
"expression"
],
"properties": {
"expression": {
"type": "string",
"description": "JavaScript to evaluate."
}
}
}browser_run_code
Execute an arbitrary Playwright script (TypeScript/JavaScript) in the MCP server process. RCE-equivalent — enable only for trusted clients. The function receives a page argument.
Input Schema
{
"type": "object",
"required": [
"code"
],
"properties": {
"code": {
"type": "string",
"description": "Playwright script to run, e.g.: \"async (page) => { return await page.title(); }\"\n"
}
}
}browser_close
Close the current browser tab or the entire browser session.
Input Schema
{
"type": "object",
"properties": {
"all": {
"type": "boolean",
"description": "Close all tabs and kill the browser process (default false)."
}
}
}