Token导航 LogoToken导航TokenDH.com
Playwright Universal MCP logo
浏览器工具stdio官方级别未说明来源级核验

Playwright Universal MCP

MCP Server

Playwright Universal MCP是一个通用的浏览器自动化协议服务器,适用于容器化环境,为AI助手提供浏览器控制能力。

工具数

11

提示词数

0

GitHub Stars

0

资源数

0
浏览器自动化PythonClaudeClaude DesktopClaude

安装说明

本站只整理中文说明和来源信息,不托管安装包,也不代用户安装。

作者 / 组织

xkiranj

提供方

xkiranj

最后核验

2026/5/17 20:19

快速接入

先看主来源和安装命令,再打开仓库或文档;下面只保留这个条目的关键接入事实。

命令预览

pip install git+https://github.com/microsoft/mcp-python-sdk.git

详细介绍

剧作家通用MCP

一个普遍的 模型上下文协议(MCP) 用于浏览器自动化的服务器,在权限有限的容器化环境中可靠工作。它为Claude、GPT-4等人工智能助手提供浏览器控制功能。

特性

  • 🌐 多浏览器支持:在Chromium、Chrome、Microsoft Edge、Firefox或WebKit之间进行选择
  • 🐳 集装箱友好型:适用于权限有限的环境(如Docker容器)
  • 👁️ 无头/有头模式:在服务器环境中以无头模式运行,或在调试中以头模式运行
  • 🛠️ 广泛的浏览器控制:导航、单击、键入、截图等
  • 📄 多页支持:创建和管理多个浏览器页面/选项卡

安装

选项1:使用管道安装(推荐)

# Install the MCP Python SDK
pip install git+https://github.com/microsoft/mcp-python-sdk.git

# Install the MCP server globally
pipx install playwright-universal-mcp

# Install the required browsers
playwright install chromium
# Optional: install other browsers
playwright install firefox webkit msedge chrome

选项2:在Python虚拟环境中安装

# Create and activate a virtual environment
python -m venv playwright-mcp-venv
source playwright-mcp-venv/bin/activate

# Install the MCP Python SDK
pip install git+https://github.com/microsoft/mcp-python-sdk.git

# Install the package
pip install playwright-universal-mcp

# Install browsers
playwright install chromium

选项3:从源代码安装

# Clone the repository
git clone https://github.com/xkiranj/playwright-universal-mcp.git
cd playwright-universal-mcp

# Install the MCP Python SDK
pip install git+https://github.com/microsoft/mcp-python-sdk.git

# Install the package
pip install -e .

# Install browsers
playwright install chromium

用法

命令行选项

playwright-universal-mcp --help
usage: playwright-universal-mcp [-h] [--browser {chromium,firefox,webkit,msedge,chrome}] [--headless] [--headful] [--debug] [--browser-arg BROWSER_ARG]

Universal Playwright MCP server with multi-browser support

options:
  -h, --help            show this help message and exit
  --browser {chromium,firefox,webkit,msedge,chrome}, -b {chromium,firefox,webkit,msedge,chrome}
                        Browser to use (default: chromium)
  --headless            Run browser in headless mode (default: true)
  --headful             Run browser in headful mode (with GUI)
  --debug               Enable debug logging
  --browser-arg BROWSER_ARG
                        Additional browser arguments (can be specified multiple times)

基本示例

# Start with default options (Chromium in headless mode)
playwright-universal-mcp

# Use Microsoft Edge
playwright-universal-mcp --browser msedge

# Use Firefox in headful mode (visible browser window)
playwright-universal-mcp --browser firefox --headful

# Enable debug logging
playwright-universal-mcp --debug

# Pass additional arguments to the browser
playwright-universal-mcp --browser-arg="--disable-gpu" --browser-arg="--window-size=1920,1080"

MCP配置

要将此MCP服务器与Claude Desktop或其他启用MCP的应用程序一起使用,请添加以下配置:

Claude桌面配置

将以下内容添加到您的 ~/.config/Claude/claude_desktop_config.json 文件:

{
  "mcpServers": {
    "browser": {
      "command": "playwright-universal-mcp",
      "args": ["--browser", "msedge", "--headless"]
    }
  }
}

作为PM2服务运行

要将MCP服务器作为PM2的持久服务运行,请执行以下操作:

  1. 创建PM2配置文件:
cat > ~/playwright-universal-mcp.config.js << 'EOF'
module.exports = {
  apps: [{
    name: "playwright-universal-mcp",
    script: "playwright-universal-mcp",
    args: "--browser msedge --headless",
    watch: false,
    autorestart: true,
    restart_delay: 3000
  }]
}
EOF
  1. 启动服务:
pm2 start ~/playwright-universal-mcp.config.js
  1. 保存PM2进程列表:
pm2 save

集装箱化使用

此MCP服务器在容器化环境中运行良好。下面是一个简单的Dockerfile示例:

FROM python:3.10-slim

# Install dependencies
RUN apt-get update && apt-get install -y \
    wget \
    gnupg \
    && rm -rf /var/lib/apt/lists/*

# Install the package
RUN pip install playwright-universal-mcp

# Install browsers (install the ones you need)
RUN playwright install chromium

# Run the MCP server
ENTRYPOINT ["playwright-universal-mcp", "--headless"]

可用的浏览器工具

MCP服务器提供以下工具:

  • navigate:导航到URL
  • click:通过选择器或文本单击元素
  • type:在输入元素中键入文本
  • get_text:从元素中获取文本内容
  • get_page_content:获取当前页面HTML内容
  • take_screenshot:截取当前页面的屏幕截图
  • new_page:创建新的浏览器页面
  • switch_page:切换到其他浏览器页面
  • get_pages:列出所有可用的浏览器页面
  • wait_for_selector:等待页面上的元素可见
  • get_browser_info:获取当前浏览器会话的信息

许可证

MIT许可证

致谢

本项目建立在以下基础之上:

目录标签

目录标签

浏览器自动化PythonClaude本地部署容器化支持多浏览器控制AI助手集成无头浏览器

支持客户端

Claude DesktopClaude

接入字段

传输方式(transport,传输协议)

stdio

鉴权方式(authType,认证方式)

none

工具数量(toolCount,工具数)

11

资源数量(resourceCount,资源数)

0

提示词数量(promptCount,提示词数)

0

权限和风险

stdionone部署方式未说明

接入前请确认传输方式、认证方式和部署位置,并根据实际工具能力限制访问范围。

安装前确认

不要直接授予不必要的文件、网络或账号权限;先核对安装命令和配置内容。

来源信息

继续浏览同类 MCP