Cloudflare Playwright MCP Worker

Cloudflare Playwright MCP Worker

Enables AI assistants to control a browser for web automation tasks like navigation, typing, clicking, and taking screenshots, with optional API key authentication.

Category
Visit Server

README

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.

Recommended Servers

playwright-mcp

playwright-mcp

A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.

Official
Featured
TypeScript
Magic Component Platform (MCP)

Magic Component Platform (MCP)

An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.

Official
Featured
Local
TypeScript
Audiense Insights MCP Server

Audiense Insights MCP Server

Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.

Official
Featured
Local
TypeScript
VeyraX MCP

VeyraX MCP

Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.

Official
Featured
Local
graphlit-mcp-server

graphlit-mcp-server

The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.

Official
Featured
TypeScript
Kagi MCP Server

Kagi MCP Server

An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.

Official
Featured
Python
E2B

E2B

Using MCP to run code via e2b.

Official
Featured
Neon Database

Neon Database

MCP server for interacting with Neon Management API and databases

Official
Featured
Exa Search

Exa Search

A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.

Official
Featured
Qdrant Server

Qdrant Server

This repository is an example of how to create a MCP server for Qdrant, a vector search engine.

Official
Featured