User Agents

Web browsers and everyday web tech, explained

Playwright MCP + Chrome DevTools MCP: Setup Guide

· 5 min read · Browsers

In this article
  1. What You'll Need
  2. Step-by-Step
  3. Common Mistakes
  4. Tips
  5. Troubleshooting
  6. Frequently Asked Questions

This guide shows you how to use Playwright MCP (Model Context Protocol) together with Chrome DevTools MCP. This combination lets an AI assistant control a real Chrome browser through Playwright for end-to-end testing, while also giving it access to Chrome DevTools features like network inspection, console logs, and performance profiling. You'll need Node.js installed, a recent version of Chrome, and an MCP-compatible client (like Claude Desktop or VS Code with Copilot).

What You'll Need

  • Node.js (version 18 or newer) installed on your machine
  • Google Chrome (or Chromium) installed
  • An MCP client that supports multiple MCP servers (e.g., Claude Desktop, VS Code with the Copilot MCP extension)
  • Basic familiarity with your terminal/command line

Step-by-Step

  1. Install Playwright MCP globally via npm. Open your terminal and run: npm install -g @playwright/mcp. This installs the Playwright MCP server package.
  2. Install Chrome DevTools MCP globally. Run: npm install -g chrome-devtools-mcp. This installs the official Chrome DevTools MCP server.
  3. Verify both installations. Run playwright-mcp --version and chrome-devtools-mcp --version to confirm they are accessible.
  4. Configure your MCP client. In your MCP client's configuration file (e.g., claude_desktop_config.json for Claude Desktop, or the MCP settings in VS Code), add both servers. For each, specify the command as the globally installed binary name (e.g., playwright-mcp and chrome-devtools-mcp). Example for Claude Desktop:
  5. Start the Chrome DevTools MCP server. In your terminal, run chrome-devtools-mcp. This will start a WebSocket server (usually on port 9222) that exposes Chrome DevTools Protocol (CDP) capabilities.
  6. Start the Playwright MCP server. In a separate terminal, run playwright-mcp. It will start its own MCP server (default port 8931).
  7. Connect your MCP client to both servers. If your client doesn't auto-connect, you may need to manually add the server URLs (e.g., http://localhost:8931/sse for Playwright MCP).
  8. Launch a browser session. In your MCP client, ask the assistant to "open a browser" or "navigate to example.com". The assistant will use Playwright MCP to launch a Chromium instance.
  9. Enable DevTools features. Ask the assistant to "enable network monitoring" or "open DevTools". The assistant will use Chrome DevTools MCP to attach to the same browser instance via CDP.
  10. Run a test scenario. For example, ask: "Navigate to example.com, wait for the heading, and tell me the network requests made." The assistant will use Playwright for navigation and DevTools for network logs.
  11. Close the session. When done, ask the assistant to close the browser or stop the servers to free resources.

Common Mistakes

  • Not installing globally. If you use npx instead of global install, the MCP client may not find the command. Use -g.
  • Port conflicts. If port 9222 or 8931 is already in use, the servers may fail to start. Check with lsof -i :9222 (macOS/Linux) or netstat -ano | findstr :9222 (Windows).
  • Not configuring both servers in the client. You must add both MCP servers to your client config, otherwise the assistant can't access both tools.
  • Using different browser instances. Playwright MCP launches its own browser; DevTools MCP must attach to that same instance. If you start them separately, they won't share the browser.
  • Forgetting to enable DevTools features. Some DevTools capabilities (like network logging) need to be explicitly enabled via the assistant's request.

Tips

  • Use the --headless flag with Playwright MCP if you don't need a visible browser, but note that some DevTools features may behave differently.
  • Keep both servers running in dedicated terminal windows so you can see logs for debugging.
  • If you're using VS Code, the MCP extension allows you to see which tools are available from each server.
  • For complex scenarios, write a small script that starts both servers and then launches your MCP client, to avoid manual steps.
  • Check the official documentation for each MCP server for advanced configuration options like custom browser paths or proxy settings.

Troubleshooting

  • Server fails to start with EADDRINUSE. Kill the process using the port or change the port via command-line flags (e.g., --port 9333).
  • Assistant says "tool not found". Re-check your MCP client config; ensure the server names match exactly and that you've restarted the client after changes.
  • Browser opens but DevTools doesn't attach. Make sure the Playwright browser is launched with remote debugging enabled. Playwright MCP does this by default, but if you've overridden launch options, you may need to add --remote-debugging-port=9222.
  • Network requests not showing. Ask the assistant to explicitly "enable network tracking" or "start network monitoring" before navigating.
  • Performance issues. Running both servers and a full browser can be heavy. Close unused tabs and consider using headless mode.
  • Version mismatches. If you see protocol errors, update both packages to the latest versions with npm update -g.

Frequently Asked Questions

Do I need to run both servers separately?

Yes, they are separate MCP servers. You run them as separate processes, and your MCP client connects to both.

Can I use Playwright MCP without Chrome DevTools MCP?

Yes, Playwright MCP works standalone for browser automation. DevTools MCP adds extra capabilities like network inspection and console access.

Will this work with Firefox or Safari?

Playwright MCP supports Chromium, Firefox, and WebKit, but Chrome DevTools MCP is specifically for Chrome/Chromium. For Firefox, you'd use a different debugging protocol.

How do I change the port for either server?

Both servers accept a --port flag. For example: playwright-mcp --port 9000.

Can I use this in a CI/CD pipeline?

Yes, but you'll need to run both servers in the background and ensure the MCP client can connect. Headless mode is recommended for CI.

Is there a way to see what tools are available from each server?

In most MCP clients, you can list available tools. For example, in Claude Desktop, ask "what tools do you have?" and it will list them.