Skip to main content
Glama

Playwright MCP Server

by showfive

剧作家 MCP 服务器

English |日语

该项目是一个使用模型上下文协议 (MCP) 提供 Playwright 网页内容检索功能的服务器。

特征

  • 页面导航
  • 整页内容检索
  • 可见内容检索
  • 交互元素检测
  • 鼠标操作模拟
  • 用于测试的回显功能

安装

通过 Smithery 安装

要通过Smithery自动为 Claude Desktop 安装 Playwright MCP 服务器:

npx -y @smithery/cli install @showfive/playwright-mcp-server --client claude

手动安装

npm install

用法

启动服务器

npm run build npm start

MCP 工具

可以使用以下工具:

  1. navigate
    • 导航到指定的 URL
    • 参数: { url: string }
    • 返回:导航结果
  2. get_all_content
    • 检索整个页面的内容
    • 参数:无
    • 返回:页面的所有文本内容
  3. get_visible_content
    • 检索当前可见的内容
    • 参数: { minVisiblePercentage?: number }
    • 返回:可见的文本内容
  4. get_interactive_elements
    • 获取页面上交互元素(按钮、链接等)的位置信息
    • 参数:无
    • 返回:交互元素的坐标和边界信息
  5. move_mouse
    • 移动鼠标到指定坐标
    • 参数: { x: number, y: number }
    • 返回:运算结果
  6. mouse_click
    • 在指定坐标处执行鼠标点击
    • 参数: { x: number, y: number, button?: "left" | "right" | "middle", clickCount?: number }
    • 返回:点击操作结果
  7. mouse_wheel
    • 执行鼠标滚轮滚动
    • 参数: { deltaY: number, deltaX?: number }
    • 返回:滚动操作结果
  8. drag_and_drop
    • 执行拖放操作
    • 参数: { sourceX: number, sourceY: number, targetX: number, targetY: number }
    • 返回:拖放操作结果
  9. echo
    • 用于测试的 Echo 工具
    • 参数: { message: string }
    • 返回:已发送消息

发展

运行测试

# Run all tests npm test # Run tests in watch mode npm run test:watch # Generate coverage report npm run test:coverage

测试结构

  • tools/*.test.ts :每个工具的功能测试
  • mcp-server.test.ts :MCP 服务器功能测试

实现特点

  1. 内容检索
    • 整页内容检索
    • 仅检索可见内容
    • 正确的 HTML 解析
  2. 相互作用
    • 交互元素的检测和位置信息检索
    • 鼠标操作模拟(移动、点击、滚动)
    • 拖放支持
  3. 错误处理
    • 正确的导航错误处理
    • 超时处理
    • 无效 URL 检测
  4. 配置灵活性
    • 无头/有头模式选择
    • 自定义用户代理
    • 视口大小设置

重要提示

  • 确保在使用 MCP 服务器之前设置必要的环境变量
  • 检索网页内容时遵循目标网站的服务条款
  • 发送多个请求时保持适当的间隔
  • 执行鼠标操作时,保持适当的间隔,以模拟实际的用户交互

执照

国际学习中心

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

hybrid server

The server is able to function both locally and remotely, depending on the configuration or use case.

提供利用模型上下文协议的服务器,通过 Playwright 实现类似人类的浏览器自动化,从而控制浏览器操作,例如导航、元素交互和滚动。

  1. 特征
    1. 安装
      1. 通过 Smithery 安装
      2. 手动安装
    2. 用法
      1. 启动服务器
      2. MCP 工具
    3. 发展
      1. 运行测试
      2. 测试结构
    4. 实现特点
      1. 重要提示
        1. 执照

          Related MCP Servers

          • A
            security
            A
            license
            A
            quality
            A Model Context Protocol server that provides browser automation capabilities using Playwright. This server enables LLMs to interact with web pages, take screenshots, and execute JavaScript in a real browser environment.
            Last updated -
            13
            10,534
            3,956
            TypeScript
            MIT License
            • Linux
            • Apple
          • A
            security
            F
            license
            A
            quality
            A server that enables browser automation using Playwright, allowing interaction with web pages, capturing screenshots, and executing JavaScript in a browser environment through LLMs.
            Last updated -
            12
            10,534
            1
            TypeScript
          • -
            security
            A
            license
            -
            quality
            A Model Context Protocol server that provides browser automation capabilities using Playwright, enabling LLMs to interact with web pages, take screenshots, and execute JavaScript in a real browser environment.
            Last updated -
            3
            Python
            Apache 2.0
          • -
            security
            A
            license
            -
            quality
            A browser automation server providing Playwright capabilities for controlling web browsers, capturing screenshots, extracting content, and performing complex interactions through an MCP interface.
            Last updated -
            Python
            Apache 2.0
            • Apple

          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/showfive/playwright-mcp-server'

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