Skip to main content
Glama
juilanharkless

cloudflare-playwright-mcp

Cloudflare Playwright MCP 示例

部署到 Cloudflare

概述

本项目演示了如何使用 Playwright with Cloudflare Workers 作为模型控制协议(MCP)服务器,基于 Cloudflare Playwright MCP

它使 AI 助手能够通过一组工具控制浏览器,从而执行导航、输入、点击和截图等 Web 自动化任务。

该服务器可用于多种 AI 平台,包括 Cloudflare AI Playground、Claude Desktop 以及 VS Code 中的 GitHub Copilot。

部署

按照以下步骤设置并部署项目:

  1. 安装依赖:

npm ci
  1. 部署到 Cloudflare Workers:

npx wrangler deploy

与 Cloudflare AI Playground 一起使用

替代文本

Cloudflare playground AI 是使用 Workers AI 中可用的 LLM 模型测试 MCP 服务器的绝佳方式。

  • 导航到 https://playground.ai.cloudflare.com/

  • 确保模型设置为 llama-3.3-70b-instruct-fp8-fast

  • MCP Servers 中,将 URL 设置为 https://[my-mcp-url].workers.dev/sse

  • 点击 Connect

  • 状态应更新为 Connected,并应列出 14 个可用工具

现在您可以开始与模型交互,它将运行必要的工具来完成所请求的任务。

[!TIP] 为获得最佳效果,请提供包含单个操作的简单指令,例如“创建新的待办事项”、“前往 cloudflare 网站”、“截图”

对话示例:

角色

消息

用户

前往 demo.playwright.dev/todomvc

助手

运行 browser_navigate 工具 页面已导航到 https://demo.playwright.dev/todomvc/。页面标题为“React • TodoMVC”。页面快照显示了页面内容,包括标题、文本框和几个链接。

用户

创建一些待办事项

助手

运行 browser_type 工具 已创建新的待办事项“Buy groceries”。页面快照显示了更新后的页面内容,包括新的待办事项。

用户

很好。现在以鹦鹉风格创建一个待办事项

助手

运行 browser_type 工具 已以鹦鹉风格创建新的待办事项“Polly wants a cracker”。页面快照显示了更新后的页面内容,包括新的待办事项。

用户

再以尤达风格创建另一个待办事项

助手

运行 browser_type 工具 已以尤达风格创建新的待办事项“A walk, I must take”。页面快照显示了更新后的页面内容,包括新的待办事项。

用户

截图

助手

运行 browser_take_screenshot 工具 替代文本 已截取当前页面的截图。截图格式为 PNG,大小为 56KB。

用户

现在点击鹦鹉待办事项的复选框

助手

运行 browser_clickt 工具 已点击鹦鹉待办事项“Polly wants a cracker”的复选框。页面快照显示了更新后的页面内容,复选框现在已选中。

用户

截图

助手

运行 browser_take_screenshot 工具 替代文本 已截取当前页面的截图。截图格式为 PNG,大小为 58KB。

用户

移除已完成的待办事项

助手

运行 browser_clickt 工具 已点击“Clear completed”按钮。页面快照显示了更新后的页面内容,已完成的待办事项“Polly wants a cracker”已被移除。

用户

截取最终截图

助手

运行 browser_take_screenshot 工具 替代文本 已截取当前页面的最终截图。截图格式为 PNG,大小为 50KB。

与 Claude Desktop 一起使用

目前,Claude Desktop 仅支持本地 MCP 服务器。要将 playground-mcp 与 Claude Desktop 一起使用,我们利用 mcp-remote,这是一个将远程 MCP 服务器代理并在本地暴露的工具。请使用以下配置:

  1. 打开 Claude Desktop 的配置文件。

  2. mcpServers 部分下添加以下 JSON 片段:

{
  "mcpServers": {
    "cloudflare-playwright-mcp": {
      "command": "npx",
      "args": [
        "mcp-remote",
        "https://[my-mcp-url].workers.dev/sse"
      ]
    }
  }
}
  1. 保存配置文件并重启 Claude Desktop 以应用更改。

此设置确保 Claude Desktop 能够与 Cloudflare Playwright MCP 服务器通信。

以下是一个会话示例,打开 TODO 演示应用,添加“buy lemons”并截图,利用 playwright-mcp 工具和浏览器渲染:

替代文本

在 VSCode 中配置

您可以使用 VS Code CLI 安装 Playwright MCP 服务器:

# 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"}'

安装后,Playwright MCP 服务器将可用于 VS Code 中的 GitHub Copilot 代理。

F
license - not found
Not graded
quality - not tested
C
maintenance

Resources

Unclaimed servers have limited discoverability.

Looking for Admin?

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

Related MCP Servers

  • F
    license
    Not graded
    quality
    C
    maintenance
    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.
  • F
    license
    Not graded
    quality
    C
    maintenance
    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.

View all related MCP servers

Related MCP Connectors

  • AI-powered browser automation — navigate, click, fill forms, and extract data from any website.

  • Provides cloud browser automation capabilities using Stagehand and Browserbase, enabling LLMs to i…

  • Reliable web access for AI agents: smart HTTP, rotating proxies, and full-browser rendering.

View all MCP Connectors

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/juilanharkless/playwright-mcp-agent37'

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