Daytona Playwright MCP Server
Daytona Playwright MCP 服务器
一个 MCP (Model Context Protocol) 服务器,允许你控制在 Daytona 云沙箱中运行的 stealth patchright+Chrome 浏览器。将其与 Claude Code、Claude Desktop 或任何兼容 MCP 的客户端配合使用,即可浏览网页、截屏、填写表单等。
https://github.com/user-attachments/assets/23b13e1f-4ed3-4204-ad0d-b2fdb1f77d0d
功能特性
Stealth Chrome:通过 patchright 的隐身补丁,将真实的 Chrome(非无头模式)渲染到虚拟显示器中
实时 VNC 视图:
browser_start返回的签名预览 URL 会流式传输沙箱桌面,因此你可以实时观察 Claude 的操作云沙箱:浏览器安全地运行在 Daytona 沙箱中,与你的本地机器隔离
丰富的工具集:导航、点击、输入、滚动、截屏、提取内容、管理标签页
屏幕截图支持:将屏幕截图作为图像返回,供 Claude 查看和分析
多种传输方式:支持 stdio(默认)、SSE 或 HTTP
Related MCP server: Glance
快速入门
1. 安装包
pipx install git+https://github.com/jamesmurdza/playwright-daytona-mcp-server.git2. 获取 Daytona API 密钥
在 daytona.io 注册
进入仪表板并生成 API 密钥
3. 配置 Claude Code / Claude Desktop
添加到你的 MCP 设置中:
{
"mcpServers": {
"daytona-playwright": {
"command": "daytona-playwright-mcp",
"env": {
"DAYTONA_API_KEY": "your-api-key-here"
}
}
}
}使用方法
配置完成后,你可以要求 Claude 浏览网页:
"Start a browser and go to https://news.ycombinator.com"
"Take a screenshot of the page"
"Click on the first article link"
"Search for 'AI news' on Google and show me the results"
"Fill out the contact form on example.com with test data"工作流程
启动浏览器:Claude 将调用
browser_start来创建 Daytona 沙箱并启动 Chrome导航与交互:使用导航、点击、输入和其他工具
屏幕截图:使用
browser_screenshot查看页面内容清理:完成后调用
browser_stop以删除沙箱
可用工具
浏览器生命周期
工具 | 描述 |
| 在 Daytona 沙箱中启动新的浏览器会话 |
| 停止浏览器并清理沙箱 |
| 检查浏览器是否正在运行 |
导航
工具 | 描述 |
| 导航到指定 URL |
| 后退 |
| 前进 |
| 刷新当前页面 |
交互
工具 | 描述 |
| 点击元素(CSS、XPath 或文本选择器) |
| 在输入框中输入文本 |
| 按下键盘按键(Enter、Tab 等) |
| 悬停在元素上 |
| 从下拉菜单中选择 |
| 滚动页面或元素 |
内容提取
工具 | 描述 |
| 截屏(全页或元素) |
| 获取页面文本内容 |
| 获取 HTML 内容 |
| 获取元素属性 |
| 运行 JavaScript 并获取结果 |
等待
工具 | 描述 |
| 等待元素出现/消失 |
| 等待导航完成 |
标签页管理
工具 | 描述 |
| 打开新标签页 |
| 列出所有打开的标签页 |
| 切换到其他标签页 |
| 关闭标签页 |
文件操作
工具 | 描述 |
| 上传文件到文件输入框 |
使用不同传输方式运行
Stdio(默认 - 适用于 Claude Code/Desktop)
daytona-playwright-mcpHTTP 传输(适用于远程连接)
daytona-playwright-mcp --transport http --host 0.0.0.0 --port 8765然后通过以下方式连接:http://localhost:8765/mcp
SSE 传输(旧版)
daytona-playwright-mcp --transport sse --host 0.0.0.0 --port 8765环境变量
变量 | 描述 | 默认值 |
| 你的 Daytona API 密钥(必需) | - |
| Daytona API 服务器 URL |
|
开发
从源码运行
# Clone the repository
git clone https://github.com/jamesmurdza/playwright-daytona-mcp-server.git
cd playwright-daytona-mcp-server
# Install dependencies
uv sync
# Run the server
uv run daytona-playwright-mcp为开发配置 MCP
在本地开发时,请使用此 MCP 配置:
{
"mcpServers": {
"daytona-playwright": {
"command": "uv",
"args": ["run", "--directory", "/path/to/playwright-daytona-mcp-server", "daytona-playwright-mcp"],
"env": {
"DAYTONA_API_KEY": "your-api-key-here"
}
}
}
}运行测试
uv run pytest工作原理
当你调用
browser_start时,服务器会:声明式地构建一个最小化的 Daytona 沙箱镜像(包含用于
computer_use的 xfce + VNC 堆栈,以及带有 Chrome 通道的 patchright)启动
computer_use,以便沙箱桌面在 6080 端口流式传输(返回的“实时视图”URL)通过 patchright 将 Chrome 启动到
DISPLAY=:0,并在0.0.0.0:9222上绑定 CDP —— 无需 TCP 代理,因为 patchright 的隐身补丁是在启动时应用的通过 Daytona 的安全预览 URL 连接到签名后的 CDP WebSocket
所有浏览器命令均通过连接到远程浏览器的异步 Playwright API 执行
屏幕截图作为 PNG 图像捕获,并通过 MCP 的图像内容类型返回
当你调用
browser_stop时,沙箱会被删除,所有资源都会被释放
致谢
基于 synacktraa 的 Daytona browser-in-sandbox 模式
使用 Patchright 进行 Playwright CDP 连接
使用 FastMCP 构建 MCP 服务器
由 Daytona 云沙箱提供支持
Available Tools
26 toolsbrowser_backB
Navigate back in browser history.
Inputs: no named parameters. Returns: result
browser_clickA
Click on an element on the page.
Supports CSS selectors, XPath, and text selectors. Examples:
CSS: "button.primary", "#submit-btn", "[data-testid='login']"
XPath: "//button[@type='submit']"
Text: "text=Sign In", "text=Submit"
Inputs: selector (required), button, click_count, timeout. Returns: result
browser_close_tabB
Close a browser tab.
Inputs: index. Returns: result
browser_download_waitA
Wait for a download to start and complete, returning the downloaded file path.
Call this before triggering the download action.
Inputs: timeout. Returns: result
browser_evaluateA
Execute JavaScript in the page context and return the result.
Examples:
"document.title"
"window.location.href"
"document.querySelectorAll('a').length"
"JSON.stringify(localStorage)"
Inputs: script (required). Returns: result
browser_forwardB
Navigate forward in browser history.
Inputs: no named parameters. Returns: result
browser_get_attributeB
Get an attribute value from an element.
Inputs: selector (required), attribute (required), timeout. Returns: result
browser_get_htmlB
Get HTML content from the page or a specific element.
Inputs: selector, outer. Returns: result
browser_get_textB
Get text content from the page or specific elements.
Inputs: selector, timeout. Returns: result
browser_hoverB
Hover over an element on the page.
Inputs: selector (required), timeout. Returns: result
browser_list_tabsA
List all open tabs with their URLs and titles.
Inputs: no named parameters. Returns: result
browser_new_tabA
Open a new browser tab and switch to it.
Inputs: url. Returns: result
browser_pressB
Press a keyboard key, optionally on a specific element.
Key examples: Enter, Tab, Escape, Backspace, Delete, ArrowUp, ArrowDown, Control+a, Control+c, Control+v, Shift+Tab, Alt+F4
Inputs: key (required), selector, timeout. Returns: result
browser_refreshB
Refresh the current page.
Inputs: no named parameters. Returns: result
browser_screenshotC
Take a screenshot of the current page or a specific element.
Returns the screenshot as an image that can be displayed.
Inputs: full_page, selector.
browser_scrollB
Scroll the page or a specific element.
Inputs: direction, amount, selector. Returns: result
browser_selectA
Select an option from a dropdown ( element).
Provide one of: value, label, or index.
Inputs: selector (required), value, label, index, +1 more. Returns: result
browser_startA
Start a new browser session in a Daytona sandbox.
This creates a cloud sandbox with Chrome installed, launches the browser, and establishes a connection for remote control. Must be called before using any other browser tools.
Inputs: timeout. Returns: result
browser_statusB
Check the current status of the browser session.
Inputs: no named parameters. Returns: result
browser_stopA
Stop the browser and clean up the Daytona sandbox.
Call this when you're done using the browser to free up resources.
Inputs: no named parameters. Returns: result
browser_switch_tabB
Switch to a different browser tab by index.
Inputs: index (required). Returns: result
browser_typeB
Type text into an input field or editable element.
Inputs: selector (required), text (required), clear_first, delay, +1 more. Returns: result
browser_upload_fileB
Upload a file to a file input element.
Note: The file must exist on the machine running this MCP server.
Inputs: selector (required), file_path (required), timeout. Returns: result
browser_wait_for_selectorB
Wait for an element to reach a specific state.
States:
attached: Element is in the DOM
detached: Element is removed from the DOM
visible: Element is visible on the page
hidden: Element is hidden or removed
Inputs: selector (required), state, timeout. Returns: result
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 26 tools
Each tool has a clearly distinct purpose with no ambiguity. For example, browser_click is for clicking, browser_type is for typing, browser_screenshot is for capturing images, and browser_wait_for_selector is for waiting on element states. The descriptions reinforce these distinctions, making misselection unlikely.
All tools follow a consistent 'browser_verb' or 'browser_verb_noun' naming pattern (e.g., browser_back, browser_click, browser_screenshot). This uniformity makes the tool set predictable and easy to navigate, with no deviations in style or convention.
With 26 tools, the count feels heavy for a browser automation server, though not extreme. While it covers many operations, some tools could potentially be consolidated (e.g., browser_back and browser_forward are simple navigations), making the set borderline in scope.
The tool set provides complete coverage for browser automation, including session management (start, stop, status), navigation, interaction (click, type, hover), inspection (get_html, get_text), and utilities (screenshot, download). There are no obvious gaps, and agents can handle typical workflows without dead ends.
Maintenance
Related MCP Connectors
Hosted Web Crawler MCP server for Claude, ChatGPT and Cursor, with each action switched per account.
Official Browserless MCP server: browser automation, scraping, screenshots and PDFs for AI agents.
Hosted real Google Chrome MCP with per-user persistent state. Navigate, click, type, screenshot.
Give AI agents a real cloud Chrome: open sessions, navigate, read pages, click, type and screenshot.
Related MCP Servers
- AlicenseBqualityDmaintenanceAn MCP server that provides AI models with full browser automation capabilities through Chrome. It enables navigation, interaction, screenshots, and complete DevTools access by bridging AI clients with a companion Chrome extension.9911 npm3Apache 2.0
- AlicenseCqualityDmaintenanceAn MCP server that gives Claude Code real browser control for web automation, testing, and screenshots.32104 npm159MIT
- AlicenseNot gradedqualityDmaintenanceMCP server to control Chrome browsers locally or remotely via the Claude extension, enabling navigation, form filling, screenshots, and JavaScript execution from any MCP client.MIT
- AlicenseNot gradedqualityDmaintenanceLocal browser automation MCP server for Claude Code, enabling navigation, clicking, typing, and inspecting real web pages via Google Chrome.1MIT