Skip to main content
Glama
chenwei791129

Cloudflare Playwright MCP Worker

Cloudflare Playwright MCP Worker

Forked from cloudflare/playwright-mcp with added API Key authentication support via X-API-Key header.

Deploy to Cloudflare

Overview

This project demonstrates how to use Playwright with Cloudflare Workers as a Model Control Protocol (MCP) server using Cloudflare Playwright MCP.

It enables AI assistants to control a browser through a set of tools, allowing them to perform web automation tasks like navigation, typing, clicking, and taking screenshots.

The server can be used with various AI platforms including Claude Desktop, Claude Code, and GitHub Copilot in VS Code.

Deploy

Follow these steps to set up and deploy the project:

  1. Install dependencies:

npm ci
  1. Deploy to Cloudflare Workers:

npx wrangler deploy

Authentication (Optional)

You can protect your MCP server with an API key. Set the API_KEY secret using Wrangler:

npx wrangler secret put API_KEY

When API_KEY is set, all requests must include the X-API-Key header with the matching key. If API_KEY is not set, the server is open to all requests.

Endpoints

This server exposes two transport types:

Endpoint

Transport

Description

/sse

Server-Sent Events (SSE)

Legacy streaming transport

/mcp

HTTP Streamable

Recommended modern transport

Use with Claude Desktop

As of now, Claude Desktop only supports local MCP servers. To use playground-mcp with Claude Desktop we make use of mcp-remote, a tool that proxies remote MCP servers and exposes them locally. Use the following configuration:

  1. Open the configuration file for Claude Desktop.

  2. Add the following JSON snippet under the mcpServers section:

Using SSE transport:

{
  "mcpServers": {
    "cloudflare-playwright-mcp": {
      "command": "npx",
      "args": [
        "mcp-remote",
        "https://[my-mcp-url].workers.dev/sse"
      ]
    }
  }
}

Using HTTP Streamable transport:

{
  "mcpServers": {
    "cloudflare-playwright-mcp": {
      "command": "npx",
      "args": [
        "mcp-remote",
        "https://[my-mcp-url].workers.dev/mcp"
      ]
    }
  }
}

With API Key authentication, add the --header flag:

{
  "mcpServers": {
    "cloudflare-playwright-mcp": {
      "command": "npx",
      "args": [
        "mcp-remote",
        "https://[my-mcp-url].workers.dev/mcp",
        "--header",
        "X-API-Key:${API_KEY}"
      ],
      "env": {
        "API_KEY": "<your-api-key>"
      }
    }
  }
}
  1. Save the configuration file and restart Claude Desktop to apply the changes.

This setup ensures that Claude Desktop can communicate with the Cloudflare Playwright MCP server.

Here's an example of a session opening the TODO demo app, adding "buy lemons" and doing a screenshot, taking advantage of playwright-mcp tools and Browser Rendering:

alt text

Use with Claude Code

Add the MCP server using the claude CLI:

claude mcp add --scope user --transport http cloudflare-playwright https://[my-mcp-url].workers.dev/mcp

With API Key authentication:

claude mcp add --scope user --header "X-API-Key: ${API_KEY}" --transport http cloudflare-playwright https://[my-mcp-url].workers.dev/mcp

Configure in VSCode

You can install the Playwright MCP server using the VS Code CLI:

Using SSE transport:

# For VS Code
code --add-mcp '{"name":"cloudflare-playwright","type":"sse","url":"https://[my-mcp-url].workers.dev/sse"}'

# For VS Code Insiders
code-insiders --add-mcp '{"name":"cloudflare-playwright","type":"sse","url":"https://[my-mcp-url].workers.dev/sse"}'

Using HTTP Streamable transport:

# For VS Code
code --add-mcp '{"name":"cloudflare-playwright","type":"http","url":"https://[my-mcp-url].workers.dev/mcp"}'

# For VS Code Insiders
code-insiders --add-mcp '{"name":"cloudflare-playwright","type":"http","url":"https://[my-mcp-url].workers.dev/mcp"}'

With API Key authentication, add the header to your .vscode/mcp.json or user settings:

{
  "servers": {
    "cloudflare-playwright": {
      "type": "http",
      "url": "https://[my-mcp-url].workers.dev/mcp",
      "headers": {
        "X-API-Key": "<your-api-key>"
      }
    }
  }
}

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

F
license - not found
-
quality - not tested
D
maintenance

Maintenance

Maintainers
Response time
Release cycle
Releases (12mo)
Commit activity

Resources

Unclaimed servers have limited discoverability.

Looking for Admin?

If you are the server author, to access and configure the admin panel.

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/chenwei791129/playwright-mcp-worker'

If you have feedback or need assistance with the MCP directory API, please join our Discord server