|
| 1 | +# Playwright MCP Server |
| 2 | + |
| 3 | +Playwright MCP server. |
| 4 | + |
| 5 | +[What is an MCP Server?](https://www.anthropic.com/news/model-context-protocol) |
| 6 | + |
| 7 | +## Characteristics |
| 8 | +Attribute|Details| |
| 9 | +|-|-| |
| 10 | +**Image Source**|Official Image |
| 11 | +**Docker Image**|[mcp/playwright](https://hub.docker.com/repository/docker/mcp/playwright) |
| 12 | +**Author**|[microsoft](https://github.com/microsoft) |
| 13 | +**Repository**|https://github.com/microsoft/playwright-mcp |
| 14 | +**Dockerfile**|https://github.com/microsoft/playwright-mcp/blob/main/Dockerfile |
| 15 | +**Docker Image built by**|Docker Inc. |
| 16 | +**Docker Scout Health Score**|  |
| 17 | +**Licence**|Apache License 2.0 |
| 18 | + |
| 19 | +## Available Tools |
| 20 | +Tools provided by this Server|Short Description |
| 21 | +-|- |
| 22 | +`browser_click`|Perform click on a web page| |
| 23 | +`browser_close`|Close the page| |
| 24 | +`browser_console_messages`|Returns all console messages| |
| 25 | +`browser_drag`|Perform drag and drop between two elements| |
| 26 | +`browser_file_upload`|Upload one or multiple files| |
| 27 | +`browser_handle_dialog`|Handle a dialog| |
| 28 | +`browser_hover`|Hover over element on page| |
| 29 | +`browser_install`|Install the browser specified in the config.| |
| 30 | +`browser_navigate`|Navigate to a URL| |
| 31 | +`browser_navigate_back`|Go back to the previous page| |
| 32 | +`browser_navigate_forward`|Go forward to the next page| |
| 33 | +`browser_network_requests`|Returns all network requests since loading the page| |
| 34 | +`browser_pdf_save`|Save page as PDF| |
| 35 | +`browser_press_key`|Press a key on the keyboard| |
| 36 | +`browser_resize`|Resize the browser window| |
| 37 | +`browser_select_option`|Select an option in a dropdown| |
| 38 | +`browser_snapshot`|Capture accessibility snapshot of the current page, this is better than screenshot| |
| 39 | +`browser_tab_close`|Close a tab| |
| 40 | +`browser_tab_list`|List browser tabs| |
| 41 | +`browser_tab_new`|Open a new tab| |
| 42 | +`browser_tab_select`|Select a tab by index| |
| 43 | +`browser_take_screenshot`|Take a screenshot of the current page.| |
| 44 | +`browser_type`|Type text into editable element| |
| 45 | +`browser_wait`|Wait for a specified time in seconds| |
| 46 | + |
| 47 | +--- |
| 48 | +## Tools Details |
| 49 | + |
| 50 | +#### Tool: **`browser_click`** |
| 51 | +Perform click on a web page |
| 52 | +Parameters|Type|Description |
| 53 | +-|-|- |
| 54 | +`element`|`string`|Human-readable element description used to obtain permission to interact with the element |
| 55 | +`ref`|`string`|Exact target element reference from the page snapshot |
| 56 | + |
| 57 | +--- |
| 58 | +#### Tool: **`browser_close`** |
| 59 | +Close the page |
| 60 | +#### Tool: **`browser_console_messages`** |
| 61 | +Returns all console messages |
| 62 | +#### Tool: **`browser_drag`** |
| 63 | +Perform drag and drop between two elements |
| 64 | +Parameters|Type|Description |
| 65 | +-|-|- |
| 66 | +`endElement`|`string`|Human-readable target element description used to obtain the permission to interact with the element |
| 67 | +`endRef`|`string`|Exact target element reference from the page snapshot |
| 68 | +`startElement`|`string`|Human-readable source element description used to obtain the permission to interact with the element |
| 69 | +`startRef`|`string`|Exact source element reference from the page snapshot |
| 70 | + |
| 71 | +--- |
| 72 | +#### Tool: **`browser_file_upload`** |
| 73 | +Upload one or multiple files |
| 74 | +Parameters|Type|Description |
| 75 | +-|-|- |
| 76 | +`paths`|`array`|The absolute paths to the files to upload. Can be a single file or multiple files. |
| 77 | + |
| 78 | +--- |
| 79 | +#### Tool: **`browser_handle_dialog`** |
| 80 | +Handle a dialog |
| 81 | +Parameters|Type|Description |
| 82 | +-|-|- |
| 83 | +`accept`|`boolean`|Whether to accept the dialog. |
| 84 | +`promptText`|`string` *optional*|The text of the prompt in case of a prompt dialog. |
| 85 | + |
| 86 | +--- |
| 87 | +#### Tool: **`browser_hover`** |
| 88 | +Hover over element on page |
| 89 | +Parameters|Type|Description |
| 90 | +-|-|- |
| 91 | +`element`|`string`|Human-readable element description used to obtain permission to interact with the element |
| 92 | +`ref`|`string`|Exact target element reference from the page snapshot |
| 93 | + |
| 94 | +--- |
| 95 | +#### Tool: **`browser_install`** |
| 96 | +Install the browser specified in the config. Call this if you get an error about the browser not being installed. |
| 97 | +#### Tool: **`browser_navigate`** |
| 98 | +Navigate to a URL |
| 99 | +Parameters|Type|Description |
| 100 | +-|-|- |
| 101 | +`url`|`string`|The URL to navigate to |
| 102 | + |
| 103 | +--- |
| 104 | +#### Tool: **`browser_navigate_back`** |
| 105 | +Go back to the previous page |
| 106 | +#### Tool: **`browser_navigate_forward`** |
| 107 | +Go forward to the next page |
| 108 | +#### Tool: **`browser_network_requests`** |
| 109 | +Returns all network requests since loading the page |
| 110 | +#### Tool: **`browser_pdf_save`** |
| 111 | +Save page as PDF |
| 112 | +#### Tool: **`browser_press_key`** |
| 113 | +Press a key on the keyboard |
| 114 | +Parameters|Type|Description |
| 115 | +-|-|- |
| 116 | +`key`|`string`|Name of the key to press or a character to generate, such as `ArrowLeft` or `a` |
| 117 | + |
| 118 | +--- |
| 119 | +#### Tool: **`browser_resize`** |
| 120 | +Resize the browser window |
| 121 | +Parameters|Type|Description |
| 122 | +-|-|- |
| 123 | +`height`|`number`|Height of the browser window |
| 124 | +`width`|`number`|Width of the browser window |
| 125 | + |
| 126 | +--- |
| 127 | +#### Tool: **`browser_select_option`** |
| 128 | +Select an option in a dropdown |
| 129 | +Parameters|Type|Description |
| 130 | +-|-|- |
| 131 | +`element`|`string`|Human-readable element description used to obtain permission to interact with the element |
| 132 | +`ref`|`string`|Exact target element reference from the page snapshot |
| 133 | +`values`|`array`|Array of values to select in the dropdown. This can be a single value or multiple values. |
| 134 | + |
| 135 | +--- |
| 136 | +#### Tool: **`browser_snapshot`** |
| 137 | +Capture accessibility snapshot of the current page, this is better than screenshot |
| 138 | +#### Tool: **`browser_tab_close`** |
| 139 | +Close a tab |
| 140 | +Parameters|Type|Description |
| 141 | +-|-|- |
| 142 | +`index`|`number` *optional*|The index of the tab to close. Closes current tab if not provided. |
| 143 | + |
| 144 | +--- |
| 145 | +#### Tool: **`browser_tab_list`** |
| 146 | +List browser tabs |
| 147 | +#### Tool: **`browser_tab_new`** |
| 148 | +Open a new tab |
| 149 | +Parameters|Type|Description |
| 150 | +-|-|- |
| 151 | +`url`|`string` *optional*|The URL to navigate to in the new tab. If not provided, the new tab will be blank. |
| 152 | + |
| 153 | +--- |
| 154 | +#### Tool: **`browser_tab_select`** |
| 155 | +Select a tab by index |
| 156 | +Parameters|Type|Description |
| 157 | +-|-|- |
| 158 | +`index`|`number`|The index of the tab to select |
| 159 | + |
| 160 | +--- |
| 161 | +#### Tool: **`browser_take_screenshot`** |
| 162 | +Take a screenshot of the current page. You can't perform actions based on the screenshot, use browser_snapshot for actions. |
| 163 | +Parameters|Type|Description |
| 164 | +-|-|- |
| 165 | +`element`|`string` *optional*|Human-readable element description used to obtain permission to screenshot the element. If not provided, the screenshot will be taken of viewport. If element is provided, ref must be provided too. |
| 166 | +`raw`|`boolean` *optional*|Whether to return without compression (in PNG format). Default is false, which returns a JPEG image. |
| 167 | +`ref`|`string` *optional*|Exact target element reference from the page snapshot. If not provided, the screenshot will be taken of viewport. If ref is provided, element must be provided too. |
| 168 | + |
| 169 | +--- |
| 170 | +#### Tool: **`browser_type`** |
| 171 | +Type text into editable element |
| 172 | +Parameters|Type|Description |
| 173 | +-|-|- |
| 174 | +`element`|`string`|Human-readable element description used to obtain permission to interact with the element |
| 175 | +`ref`|`string`|Exact target element reference from the page snapshot |
| 176 | +`text`|`string`|Text to type into the element |
| 177 | +`slowly`|`boolean` *optional*|Whether to type one character at a time. Useful for triggering key handlers in the page. By default entire text is filled in at once. |
| 178 | +`submit`|`boolean` *optional*|Whether to submit entered text (press Enter after) |
| 179 | + |
| 180 | +--- |
| 181 | +#### Tool: **`browser_wait`** |
| 182 | +Wait for a specified time in seconds |
| 183 | +Parameters|Type|Description |
| 184 | +-|-|- |
| 185 | +`time`|`number`|The time to wait in seconds |
| 186 | + |
| 187 | +--- |
| 188 | +## Use this MCP Server |
| 189 | + |
| 190 | +```json |
| 191 | +{ |
| 192 | + "mcpServers": { |
| 193 | + "playwright": { |
| 194 | + "command": "docker", |
| 195 | + "args": [ |
| 196 | + "run", |
| 197 | + "-i", |
| 198 | + "--rm", |
| 199 | + "mcp/playwright" |
| 200 | + ] |
| 201 | + } |
| 202 | + } |
| 203 | +} |
| 204 | +``` |
| 205 | + |
| 206 | +[Why is it safer to run MCP Servers with Docker?](https://www.docker.com/blog/the-model-context-protocol-simplifying-building-ai-apps-with-anthropic-claude-desktop-and-docker/) |
0 commit comments