Skip to content
Back to search

mcp-playwright

Playwright Model Context Protocol Server - Tool to automate Browsers and APIs in Claude Desktop, Cline, Cursor IDE and More πŸ”Œ

Safety scan

A static text scan, not a guarantee. Select the badge to see what was scanned and every finding.

Checked today
Badge for your README
findsafeskills safety rating

Markdown

[![findsafeskills safety rating](/api/listings/executeautomation--mcp-playwright/badge.svg)](/listings/executeautomation--mcp-playwright)

HTML

<a href="/listings/executeautomation--mcp-playwright"><img src="/api/listings/executeautomation--mcp-playwright/badge.svg" alt="findsafeskills safety rating" /></a>

Install

i

Install instructions from the README

As written by the repo's author. findsafeskills has not verified these steps.

You can install the package using either npm, mcp-get, or Smithery:

Using npm:

npm install -g @executeautomation/playwright-mcp-server

Using mcp-get:

npx @michaellatman/mcp-get@latest install @executeautomation/playwright-mcp-server

Using Smithery

To install Playwright MCP for Claude Desktop automatically via [Smithery](https://smithery.ai/server/@executeautomation/playwright-mcp-server):

npx @smithery/cli install @executeautomation/playwright-mcp-server --client claude

Using Claude Code:

claude mcp add --transport stdio playwright npx @executeautomation/playwright-mcp-server

Installation in VS Code

Install the Playwright MCP server in VS Code using one of these buttons:

[<img src="https://img.shields.io/badge/VS_Code-VS_Code?style=flat-square&label=Install%20Server&color=0098FF" alt="Install in VS Code">](https://insiders.vscode.dev/redirect?url=vscode%3Amcp%2Finstall%3F%257B%2522name%2522%253A%2522playwright%2522%252C%2522command%2522%253A%2522npx%2522%252C%2522args%2522%253A%255B%2522-y%2522%252C%2522%2540executeautomation%252Fplaywright-mcp-server%2522%255D%257D) [<img alt="Install in VS Code Insiders" src="https://img.shields.io/badge/VS_Code_Insiders-VS_Code_Insiders?style=flat-square&label=Install%20Server&color=24bfa5">](https://insiders.vscode.dev/redirect?url=vscode-insiders%3Amcp%2Finstall%3F%257B%2522name%2522%253A%2522playwright%2522%252C%2522command%2522%253A%2522npx%2522%252C%2522args%2522%253A%255B%2522-y%2522%252C%2522%2540executeautomation%252Fplaywright-mcp-server%2522%255D%257D)

Alternatively, you can install the Playwright MCP server using the VS Code CLI:

# For VS Code
code --add-mcp '{"name":"playwright","command":"npx","args":["@executeautomation/playwright-mcp-server"]}'
# For VS Code Insiders
code-insiders --add-mcp '{"name":"playwright","command":"npx","args":["@executeautomation/playwright-mcp-server"]}'

After installation, the ExecuteAutomation Playwright MCP server will be available for use with your GitHub Copilot agent in VS Code.

What was scanned

The files the safety scan read, as written by the repository's author and shown as plain text. Lines with a finding are marked.

README.md Β· README Β· 313 lines

View this file on GitHub (read at the repository's current version: the scan did not record which commit it read)

  1. <div align="center" markdown="1">
  2. <table>
  3. <tr>
  4. <td align="center" valign="middle">
  5. <a href="https://mseep.ai/app/executeautomation-mcp-playwright">
  6. <img src="https://mseep.net/pr/executeautomation-mcp-playwright-badge.png" alt="MseeP.ai Security Assessment Badge" height="80"/>
  7. </a>
  8. </td>
  9. </tr>
  10. <tr>
  11. <td align="center"><sub>MseeP.ai Security Assessment</sub></td>
  12. </tr>
  13. </table>
  14. </div>
  15. <hr>
  16. # Playwright MCP Server 🎭
  17. [![Trust Score](https://archestra.ai/mcp-catalog/api/badge/quality/executeautomation/mcp-playwright)](https://archestra.ai/mcp-catalog/executeautomation__mcp-playwright)
  18. [![smithery badge](https://smithery.ai/badge/@executeautomation/playwright-mcp-server)](https://smithery.ai/server/@executeautomation/playwright-mcp-server)
  19. A Model Context Protocol server that provides browser automation capabilities using Playwright. This server enables LLMs to interact with web pages, take screenshots, generate test code, web scrapes the page and execute JavaScript in a real browser environment.
  20. <a href="https://glama.ai/mcp/servers/yh4lgtwgbe"><img width="380" height="200" src="https://glama.ai/mcp/servers/yh4lgtwgbe/badge" alt="mcp-playwright MCP server" /></a>
  21. ## ✨ What's New in v1.0.10
  22. ### 🎯 Device Emulation with 143 Real Device Presets!
  23. Test your web applications on **real device profiles** with a simple command:
  24. ```javascript
  25. // Test on iPhone 13 with automatic user-agent, touch support, and device pixel ratio
  26. await playwright_resize({ device: "iPhone 13" });
  27. // Switch to iPad with landscape orientation
  28. await playwright_resize({ device: "iPad Pro 11", orientation: "landscape" });
  29. // Test desktop view
  30. await playwright_resize({ device: "Desktop Chrome" });
  31. ```
  32. **Natural Language Support for AI Assistants:**
  33. - "Test on iPhone 13"
  34. - "Switch to iPad view"
  35. - "Rotate to landscape"
  36. **Supports 143 devices:** iPhone, iPad, Pixel, Galaxy, and Desktop browsers with proper emulation of viewport, user-agent, touch events, and device pixel ratios.
  37. πŸ“š [View Device Quick Reference](https://executeautomation.github.io/mcp-playwright/docs/playwright-web/Device-Quick-Reference) | [Prompt Guide](https://executeautomation.github.io/mcp-playwright/docs/playwright-web/Resize-Prompts-Guide)
  38. ## Screenshot
  39. ![Playwright + Claude](image/playwright_claude.png)
  40. ## [Documentation](https://executeautomation.github.io/mcp-playwright/) | [API reference](https://executeautomation.github.io/mcp-playwright/docs/playwright-web/Supported-Tools)
  41. ## Installation
  42. You can install the package using either npm, mcp-get, or Smithery:
  43. Using npm:
  44. ```bash
  45. npm install -g @executeautomation/playwright-mcp-server
  46. ```
  47. Using mcp-get:
  48. ```bash
  49. npx @michaellatman/mcp-get@latest install @executeautomation/playwright-mcp-server
  50. ```
  51. Using Smithery
  52. To install Playwright MCP for Claude Desktop automatically via [Smithery](https://smithery.ai/server/@executeautomation/playwright-mcp-server):
  53. ```bash
  54. npx @smithery/cli install @executeautomation/playwright-mcp-server --client claude
  55. ```
  56. Using Claude Code:
  57. ```bash
  58. claude mcp add --transport stdio playwright npx @executeautomation/playwright-mcp-server
  59. ```
  60. #### Installation in VS Code
  61. Install the Playwright MCP server in VS Code using one of these buttons:
  62. <!--
  63. // Generate using?:
  64. const config = JSON.stringify({ name: 'playwright', command: 'npx', args: ["-y", "@executeautomation/playwright-mcp-server"] });
  65. const urlForWebsites = `vscode:mcp/install?${encodeURIComponent(config)}`;
  66. // Github markdown does not allow linking to `vscode:` directly, so you can use our redirect:
  67. const urlForGithub = `https://insiders.vscode.dev/redirect?url=${encodeURIComponent(urlForWebsites)}`;
  68. -->
  69. [<img src="https://img.shields.io/badge/VS_Code-VS_Code?style=flat-square&label=Install%20Server&color=0098FF" alt="Install in VS Code">](https://insiders.vscode.dev/redirect?url=vscode%3Amcp%2Finstall%3F%257B%2522name%2522%253A%2522playwright%2522%252C%2522command%2522%253A%2522npx%2522%252C%2522args%2522%253A%255B%2522-y%2522%252C%2522%2540executeautomation%252Fplaywright-mcp-server%2522%255D%257D)
  70. [<img alt="Install in VS Code Insiders" src="https://img.shields.io/badge/VS_Code_Insiders-VS_Code_Insiders?style=flat-square&label=Install%20Server&color=24bfa5">](https://insiders.vscode.dev/redirect?url=vscode-insiders%3Amcp%2Finstall%3F%257B%2522name%2522%253A%2522playwright%2522%252C%2522command%2522%253A%2522npx%2522%252C%2522args%2522%253A%255B%2522-y%2522%252C%2522%2540executeautomation%252Fplaywright-mcp-server%2522%255D%257D)
  71. Alternatively, you can install the Playwright MCP server using the VS Code CLI:
  72. ```bash
  73. # For VS Code
  74. code --add-mcp '{"name":"playwright","command":"npx","args":["@executeautomation/playwright-mcp-server"]}'
  75. ```
  76. ```bash
  77. # For VS Code Insiders
  78. code-insiders --add-mcp '{"name":"playwright","command":"npx","args":["@executeautomation/playwright-mcp-server"]}'
  79. ```
  80. After installation, the ExecuteAutomation Playwright MCP server will be available for use with your GitHub Copilot agent in VS Code.
  81. ## Browser Installation
  82. ### Automatic Installation (Recommended)
  83. The Playwright MCP Server **automatically installs browser binaries** when you first use it. When the server detects that a browser is missing, it will:
  84. 1. Automatically download and install the required browser (Chromium, Firefox, or WebKit)
  85. 2. Display installation progress in the console
  86. 3. Retry your request once installation completes
  87. **No manual setup required!** Just start using the server, and it handles browser installation for you.
  88. ### Manual Installation (Optional)
  89. If you prefer to install browsers manually or encounter any issues with automatic installation:
  90. ```bash
  91. # Install all browsers
  92. npx playwright install
  93. # Or install specific browsers
  94. npx playwright install chromium
  95. npx playwright install firefox
  96. npx playwright install webkit
  97. ```
  98. ### Browser Storage Location
  99. Browsers are installed to:
  100. - **Windows:** `%USERPROFILE%\AppData\Local\ms-playwright`
  101. - **macOS:** `~/Library/Caches/ms-playwright`
  102. - **Linux:** `~/.cache/ms-playwright`
  103. ## Configuration to use Playwright Server
  104. ### Standard Mode (stdio)
  105. This is the **recommended mode for Claude Desktop**.
  106. ```json
  107. {
  108. "mcpServers": {
  109. "playwright": {
  110. "command": "npx",
  111. "args": ["-y", "@executeautomation/playwright-mcp-server"]
  112. }
  113. }
  114. }
  115. ```
  116. **Note:** In stdio mode, logging is automatically directed to files only (not console) to maintain clean JSON-RPC communication. Logs are written to `~/playwright-mcp-server.log`.
  117. ### HTTP Mode (Standalone Server)
  118. When running headed browser on systems without display or from worker processes of IDEs, you can run the MCP server as a standalone HTTP server:
  119. > **Note for Claude Desktop Users:** Claude Desktop currently requires stdio mode (command/args configuration). HTTP mode is recommended for VS Code, custom clients, and remote deployments. See [CLAUDE_DESKTOP_CONFIG.md](CLAUDE_DESKTOP_CONFIG.md) for details.
  120. #### Starting the HTTP Server
  121. ```bash
  122. # Using npx
  123. npx @executeautomation/playwright-mcp-server --port 8931
  124. # Or after global installation
  125. playwright-mcp-server --port 8931
  126. ```
  127. The server will start and display available endpoints:
  128. ```
  129. ==============================================
  130. Playwright MCP Server (HTTP Mode)
  131. ==============================================
  132. Port: 8931
  133. ENDPOINTS:
  134. - SSE Stream: GET http://localhost:8931/sse
  135. - Messages: POST http://localhost:8931/messages?sessionId=<id>
  136. - MCP (unified): GET http://localhost:8931/mcp
  137. - MCP (unified): POST http://localhost:8931/mcp?sessionId=<id>
  138. - Health Check: GET http://localhost:8931/health
  139. ==============================================
  140. ```
  141. #### Client Configuration for HTTP Mode
  142. > **⚠️ CRITICAL:** The `"type": "http"` field is **REQUIRED** for HTTP/SSE transport!
  143. **For VS Code GitHub Copilot:**
  144. ```json
  145. {
  146. "github.copilot.chat.mcp.servers": {
  147. "playwright": {
  148. "url": "http://localhost:8931/mcp",
  149. "type": "http"
  150. }
  151. }
  152. }
  153. ```
  154. **For Custom MCP Clients:**
  155. ```json
  156. {
  157. "mcpServers": {
  158. "playwright": {
  159. "url": "http://localhost:8931/mcp",
  160. "type": "http"
  161. }
  162. }
  163. }
  164. ```
  165. **Important:** Without `"type": "http"`, the connection will fail.
  166. **For Claude Desktop:** Use stdio mode instead (see Standard Mode above)
  167. #### Use Cases for HTTP Mode
  168. - Running headed browsers on systems without display (e.g., remote servers)
  169. - Integrating with VS Code GitHub Copilot
  170. - Running the server as a background service
  171. - Accessing the server from multiple clients
  172. - Debugging with the `/health` endpoint
  173. - Custom MCP client integrations
  174. **Monitoring:** The server includes a monitoring system that starts on a dynamically allocated port (avoiding conflicts). Check the console output for the actual port.
  175. **Note:** For Claude Desktop, continue using stdio mode (Standard Mode above) for now.
  176. ## Troubleshooting
  177. ### "No transport found for sessionId" Error
  178. **Symptom:** 400 error with message "Bad Request: No transport found for sessionId"
  179. **Solution:**
  180. 1. **Check configuration includes `"type": "http"`**
  181. ```json
  182. {
  183. "url": "http://localhost:8931/mcp",
  184. "type": "http" // ← This is REQUIRED!
  185. }
  186. ```
  187. 2. **Verify server logs show connection:**
  188. ```bash
  189. # Should see these in order:
  190. # 1. "Incoming request" - GET /mcp
  191. # 2. "Transport registered" - with sessionId
  192. # 3. "POST message received" - with same sessionId
  193. ```
  194. 3. **Restart both server and client**
  195. ### Connection Issues
  196. - **Server not starting:** Check if port 8931 is available
  197. - **External access blocked:** This is by design (security). Server binds to localhost only
  198. - **For remote access:** Use SSH tunneling:
  199. ```bash
  200. ssh -L 8931:localhost:8931 user@remote-server
  201. ```
  202. ## Testing
  203. This project uses Jest for testing. The tests are located in the `src/__tests__` directory.
  204. ### Running Tests
  205. You can run the tests using one of the following commands:
  206. ```bash
  207. # Run tests using the custom script (with coverage)
  208. node run-tests.cjs
  209. # Run tests using npm scripts
  210. npm test # Run tests without coverage
  211. npm run test:coverage # Run tests with coverage
  212. npm run test:custom # Run tests with custom script (same as node run-tests.cjs)
  213. ```
  214. The test coverage report will be generated in the `coverage` directory.
  215. ### Running evals
  216. The evals package loads an mcp client that then runs the index.ts file, so there is no need to rebuild between tests. You can load environment variables by prefixing the npx command. Full documentation can be found [here](https://www.mcpevals.io/docs).
  217. ```bash
  218. OPENAI_API_KEY=your-key npx mcp-eval src/evals/evals.ts src/tools/codegen/index.ts
  219. ```
  220. ## Contributing
  221. When adding new tools, please be mindful of the tool name length. Some clients, like Cursor, have a 60-character limit for the combined server and tool name (`server_name:tool_name`).
  222. Our server name is `playwright-mcp`. Please ensure your tool names are short enough to not exceed this limit.
  223. ## Star History
  224. [![Star History Chart](https://api.star-history.com/svg?repos=executeautomation/mcp-playwright&type=Date)](https://star-history.com/#executeautomation/mcp-playwright&Date)

Ratings and comments

Sign in to rate this skill.

Sign in

Free to use. If it’s helped, pass it on.