Playwright MCP
剧作家-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:捕获页面或元素的视觉状态
Related MCP server: Playwright Server MCP
配置
安装依赖项
uv add playwright
playwright install chromium快速入门
安装
克劳德桌面
在 MacOS 上: ~/Library/Application\ Support/Claude/claude_desktop_config.json
在 Windows 上: %APPDATA%/Claude/claude_desktop_config.json
"mcpServers": {
"playwright-mcp": {
"command": "uv",
"args": [
"--directory",
"/Users/shannon/Workspace/artivus/playwright-mcp",
"run",
"playwright-mcp"
]
}
}"mcpServers": {
"playwright-mcp": {
"command": "uvx",
"args": [
"playwright-mcp"
]
}
}发展
构建和发布
准备分发包:
同步依赖项并更新锁文件:
uv sync构建软件包分发版:
uv build这将在dist/目录中创建源和轮子分布。
发布到 PyPI:
uv publish注意:您需要通过环境变量或命令标志设置 PyPI 凭据:
令牌:
--token或UV_PUBLISH_TOKEN或用户名/密码:
--username/UV_PUBLISH_USERNAME和--password/UV_PUBLISH_PASSWORD
调试
由于 MCP 服务器通过 stdio 运行,调试起来可能比较困难。为了获得最佳调试体验,我们强烈建议使用MCP Inspector 。
您可以使用以下命令通过npm启动 MCP Inspector:
npx @modelcontextprotocol/inspector uv --directory /Users/shannon/Workspace/artivus/playwright-mcp run playwright-mcp启动后,检查器将显示一个 URL,您可以在浏览器中访问该 URL 以开始调试。
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Appeared in Searches
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/misanthropic-ai/playwrite-mcp'
If you have feedback or need assistance with the MCP directory API, please join our Discord server