Skip to main content
Glama
Daytona Playwright MCP Server

Daytona Playwright MCP Server

by jamesmurdza

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.git

2. 获取 Daytona API 密钥

  1. 在 daytona.io 注册

  2. 进入仪表板并生成 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"

工作流程

  1. 启动浏览器:Claude 将调用 browser_start 来创建 Daytona 沙箱并启动 Chrome

  2. 导航与交互:使用导航、点击、输入和其他工具

  3. 屏幕截图:使用 browser_screenshot 查看页面内容

  4. 清理:完成后调用 browser_stop 以删除沙箱

可用工具

浏览器生命周期

工具

描述

browser_start

在 Daytona 沙箱中启动新的浏览器会话

browser_stop

停止浏览器并清理沙箱

browser_status

检查浏览器是否正在运行

导航

工具

描述

browser_navigate

导航到指定 URL

browser_back

后退

browser_forward

前进

browser_refresh

刷新当前页面

交互

工具

描述

browser_click

点击元素(CSS、XPath 或文本选择器)

browser_type

在输入框中输入文本

browser_press

按下键盘按键(Enter、Tab 等)

browser_hover

悬停在元素上

browser_select

从下拉菜单中选择

browser_scroll

滚动页面或元素

内容提取

工具

描述

browser_screenshot

截屏(全页或元素)

browser_get_text

获取页面文本内容

browser_get_html

获取 HTML 内容

browser_get_attribute

获取元素属性

browser_evaluate

运行 JavaScript 并获取结果

等待

工具

描述

browser_wait_for_selector

等待元素出现/消失

browser_wait_for_navigation

等待导航完成

标签页管理

工具

描述

browser_new_tab

打开新标签页

browser_list_tabs

列出所有打开的标签页

browser_switch_tab

切换到其他标签页

browser_close_tab

关闭标签页

文件操作

工具

描述

browser_upload_file

上传文件到文件输入框

使用不同传输方式运行

Stdio(默认 - 适用于 Claude Code/Desktop)

daytona-playwright-mcp

HTTP 传输(适用于远程连接)

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_KEY

你的 Daytona API 密钥(必需)

-

DAYTONA_API_URL

Daytona API 服务器 URL

https://app.daytona.io/api

开发

从源码运行

# 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

工作原理

  1. 当你调用 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

  2. 所有浏览器命令均通过连接到远程浏览器的异步 Playwright API 执行

  3. 屏幕截图作为 PNG 图像捕获,并通过 MCP 的图像内容类型返回

  4. 当你调用 browser_stop 时,沙箱会被删除,所有资源都会被释放

致谢

Available Tools

26 tools
browser_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_navigateB

Navigate the browser to a URL.

Inputs: url (required), wait_until. 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_navigationB

Wait for a navigation to complete.

Inputs: url, 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

    A3.6/5.0

    Scored across 26 tools

    Disambiguation5/5

    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.

    Naming Consistency5/5

    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.

    Tool Count3/5

    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.

    Completeness5/5

    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

    ActivityInactive
    ResponsivenessNo recent community issues

    Related MCP Connectors

    Related MCP Servers

    • A
      license
      B
      quality
      D
      maintenance
      An 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.
      99
      11 npm
      3
      Apache 2.0
    • A
      license
      Not graded
      quality
      D
      maintenance
      MCP 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
    • A
      license
      Not graded
      quality
      D
      maintenance
      Local browser automation MCP server for Claude Code, enabling navigation, clicking, typing, and inspecting real web pages via Google Chrome.
      1
      MIT