剧作家-mcp
Playwright 的 MCP(模型上下文协议)包装器。该服务器使 LLM 驱动的客户端能够控制浏览器执行自动化任务。
成分
资源
服务器公开访问浏览器截图的资源:
- 截图资源URI:
screenshot://{page_id}
- 所有打开的页面都会自动提供屏幕截图资源
提示
服务器提供提示来帮助客户端解释网页:
interpret-page
:分析当前网页内容和结构- 可选的
page_id
参数用于选择要解释的页面 - 可选
focus
参数,用于关注特定方面(完整、表格、导航、文本) - 返回文本分析和页面截图
- 可选的
工具
该服务器实现了一套全面的浏览器自动化工具:
- 浏览器导航
navigate
:转到特定的 URLnew_page
:创建一个具有特定 ID 的新浏览器页面switch_page
:切换到不同的浏览器页面get_pages
:列出所有可用的浏览器页面
- 页面交互
click
:使用 CSS 选择器单击元素type
:在输入元素中输入文本wait_for_selector
:等待元素出现在页面上
- 内容提取
get_text
:从元素获取文本内容get_page_content
:获取整个页面 HTMLtake_screenshot
:捕获页面或元素的视觉状态
配置
安装依赖项
快速入门
安装
克劳德桌面
在 MacOS 上: ~/Library/Application\ Support/Claude/claude_desktop_config.json
在 Windows 上: %APPDATA%/Claude/claude_desktop_config.json
发展
构建和发布
准备分发包:
- 同步依赖项并更新锁文件:
- 构建软件包分发版:
这将在dist/
目录中创建源和轮子分布。
- 发布到 PyPI:
注意:您需要通过环境变量或命令标志设置 PyPI 凭据:
- 令牌:
--token
或UV_PUBLISH_TOKEN
- 或用户名/密码:
--username
/UV_PUBLISH_USERNAME
和--password
/UV_PUBLISH_PASSWORD
调试
由于 MCP 服务器通过 stdio 运行,调试起来可能比较困难。为了获得最佳调试体验,我们强烈建议使用MCP Inspector 。
您可以使用以下命令通过npm
启动 MCP Inspector:
启动后,检查器将显示一个 URL,您可以在浏览器中访问该 URL 以开始调试。
local-only server
The server can only run on the client's local machine because it depends on local resources.
MCP 的 Playwright 包装器使 LLM 驱动的客户端能够控制浏览器以执行自动化任务。
Related MCP Servers
- AsecurityAlicenseAqualityA MCP server that provides browser automation tools, allowing users to navigate websites, take screenshots, click elements, fill forms, and execute JavaScript through Playwright.Last updated -8PythonApache 2.0
- AsecurityAlicenseAqualityA browser automation server providing Playwright capabilities for controlling web browsers, capturing screenshots, extracting content, and performing complex interactions through an MCP interface.Last updated -6PythonApache 2.0
- -securityFlicense-qualityA service that provides Playwright browser automation functionality through Model Context Protocol (MCP), allowing clients to use Playwright features via SSE connections.Last updated -6
- AsecurityAlicenseAqualityA Model Context Protocol server that provides browser automation capabilities using Playwright, enabling LLMs to interact with web pages, take screenshots, generate test code, scrape web content, and execute JavaScript in real browser environments.Last updated -3111,273TypeScriptMIT License