Skip to main content
Glama

Cloudflare Playwright MCP

Cloudflare Playwright MCP 示例

概述

该项目演示了如何使用Cloudflare Playwright MCPPlaywright 与 Cloudflare Workers用作模型控制协议 (MCP) 服务器。

它使人工智能助手能够通过一组工具控制浏览器,使它们能够执行导航、打字、点击和截屏等网络自动化任务。

该服务器可与各种 AI 平台一起使用,包括 Cloudflare AI Playground、Claude Desktop 和 VS Code 中的 GitHub Copilot。

部署

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

  1. 安装依赖项:
npm ci
  1. 部署到 Cloudflare Workers:
npx wrangler deploy

与 Cloudflare AI Playground 一起使用

替代文本

Cloudflare 游乐场 AI是使用 Workers AI 中提供的 LLM 模型测试 MCP 服务器的好方法。

  • 导航至https://playground.ai.cloudflare.com/
  • 确保模型设置为llama-3.3-70b-instruct-fp8-fast
  • MCP 服务器中,将URL设置为https://[my-mcp-url].workers.dev/sse
  • 单击**“连接”**
  • 状态应更新为**“已连接”** ,并列出 14 种可用工具

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

[!TIP] 为获得最佳效果,请提供由单个操作组成的简单指令,例如“创建新的待办事项条目”、“转到 Cloudflare 网站”、“截取屏幕截图”

对话示例:

角色信息
用户前往 demo.playwright.dev/todomvc
助手*运行 browser_navigate 工具,*页面导航至https://demo.playwright.dev/todomvc/ 。页面标题为“React • TodoMVC”。页面快照显示了页面内容,包括标题、文本框和多个链接。
用户创建一些待办事项
助手*运行 browser_type 工具,*新建了一条待办事项“购买杂货”。页面快照显示了页面的更新内容,包括新增的待办事项。
用户很好。现在用鹦鹉风格创建待办事项
助手*运行 browser_type 工具,*以 parrot 风格创建了一个新的待办事项条目“Polly wants a cracker”。页面快照显示了页面的更新内容,包括新的待办事项条目。
用户并以尤达风格创建另一个待办事项
助手*运行 browser_type 工具,*以尤达风格创建了一条新的待办事项“我必须去散步”。页面快照显示了页面的更新内容,包括新的待办事项。
用户截取屏幕截图
助手运行 browser_take_screenshot 工具替代文本当前页面已截图。截图为 PNG 格式,大小为 56KB。
用户现在单击鹦鹉待办事项条目的复选框
助手运行 browser_clickt 工具, Parrot 待办事项条目“Polly wants a cracker”的复选框已被选中。页面快照显示了页面的更新内容,复选框现已选中。
用户截取屏幕截图
助手运行 browser_take_screenshot 工具替代文本当前页面已截图。截图为 PNG 格式,大小为 58KB。
用户删除已完成的待办事项
助手*运行 browser_clickt 工具,*点击了“清除已完成”按钮。页面快照显示了更新后的页面内容,已完成的待办事项“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 演示应用程序的示例,添加了“购买柠檬”并进行了截图,利用了 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 代理一起使用。

-
security - not tested
F
license - not found
-
quality - not tested

remote-capable server

The server can be hosted and run remotely because it primarily relies on remote services or has no dependency on the local environment.

模型控制协议服务器使 AI 助手能够通过工具控制浏览器,执行导航、打字、点击和截屏等网络自动化任务。

  1. 概述
    1. 部署
      1. 与 Cloudflare AI Playground 一起使用
        1. 与 Claude Desktop 一起使用
          1. 在 VSCode 中配置

            Related MCP Servers

            • A
              security
              A
              license
              A
              quality
              AI-driven browser automation server that implements the Model Context Protocol to enable natural language control of web browsers for tasks like navigation, form filling, and visual interaction.
              Last updated -
              1
              1
              Python
              MIT License
              • Apple
            • -
              security
              F
              license
              -
              quality
              A Model Control Protocol server that enables AI assistants to control a browser through tools for web automation tasks like navigation, typing, clicking, and taking screenshots.
              Last updated -
              TypeScript
            • -
              security
              F
              license
              -
              quality
              A Model Control Protocol server that enables AI assistants to control a browser, allowing them to perform web automation tasks like navigation, typing, clicking, and taking screenshots.
              Last updated -
              TypeScript
            • -
              security
              A
              license
              -
              quality
              A Model Context Protocol server that enables AI assistants to control web browsers programmatically, allowing for web automation through natural language commands.
              Last updated -
              Python
              MIT License
              • Apple
              • Linux

            View all related MCP servers

            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/bmoir23/playwright-mcp-example'

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