home / mcp / cloudflare playwright mcp server

Cloudflare Playwright MCP Server

Provides browser automation via Playwright using an MCP SSE endpoint for navigation, typing, clicking, and screenshots.

Installation
Add the following to your MCP client configuration file.

Configuration

View docs
{
  "mcpServers": {
    "beparykamrul-dev-playwright-mcp-example": {
      "url": "https://[my-mcp-url].workers.dev/sse"
    }
  }
}

You can run a Model Control Protocol (MCP) server that lets AI assistants control a browser for web automation tasks. This Cloudflare-based Playwright MCP server enables actions like navigating pages, typing, clicking elements, and taking screenshots, making it practical for integrating with AI platforms and copilots to perform automated browser tasks.

How to use

To use this MCP server, connect your MCP client or coding assistant to the provided MCP URL and start issuing browser-related actions through the available tools. The server exposes a set of tools that your AI agent can call to navigate pages, enter text, click elements, and capture screenshots. Start by configuring the MCP connection in your chosen client, then give simple, single-action prompts to perform precise browser tasks.

Recommended usage pattern is to issue single, straightforward requests to the model, such as: go to a specific page, type a query into a search field, or take a screenshot of the current view. The client will execute the corresponding tool and return the page state or a visual snapshot. You can chain steps by prompting the assistant to perform the next action after the previous one completes.

How to install

Prerequisites: Node.js and npm must be installed on your machine.

1. Install dependencies for the MCP project.

npm ci

2. Deploy the MCP server to Cloudflare Workers.

npx wrangler deploy

3. (Optional) If you plan to use VS Code integration, configure the MCP URL in your editor's MCP settings to point at the deployed SSE endpoint. A typical URL format is https://[my-mcp-url].workers.dev/sse.

Configuration and notes

The server is designed to be used with MCP clients that support SSE endpoints. You can connect from tools such as Cloudflare AI Playground or VS Code Copilot in conjunction with a compatible MCP client. For testing in Cloudflare’s environment, you can use the example URL format provided in configuration examples.

Example client configuration options are shown in these snippets. Use the exact URL and command structure shown when wiring up your IDE or playground client.

Security note: keep your MCP endpoint URL protected and limit access to trusted clients. Do not publish the SSE URL in publicly accessible places.

Tools available

The server exposes browser automation tools that your AI can invoke directly. These include navigating to pages, typing text, clicking elements, and taking screenshots.

Troubleshooting

If the MCP client cannot connect, verify the SSE URL is correct and that the deployment is active. Check that network access to Cloudflare Workers is allowed from your environment. If tools fail to execute, ensure the correct page context is loaded and that selectors used in clicks or typings are visible on the page.

Available tools

browser_navigate

Navigate the browser to a specified URL and wait for the page to load.

browser_type

Type text into a selected input field or element on the page.

browser_clickt

Click a target element such as a button or checkbox identified by a selector.

browser_take_screenshot

Capture a screenshot of the current browser view and return it as an image file.