Skip to main content
Glama

Playwright MCP

剧作家-mcp

Playwright 的 MCP(模型上下文协议)包装器。该服务器使 LLM 驱动的客户端能够控制浏览器执行自动化任务。

成分

资源

服务器公开访问浏览器截图的资源:

  • 截图资源URI: screenshot://{page_id}
  • 所有打开的页面都会自动提供屏幕截图资源

提示

服务器提供提示来帮助客户端解释网页:

  • interpret-page :分析当前网页内容和结构
    • 可选的page_id参数用于选择要解释的页面
    • 可选focus参数,用于关注特定方面(完整、表格、导航、文本)
    • 返回文本分析和页面截图

工具

该服务器实现了一套全面的浏览器自动化工具:

  • 浏览器导航
    • navigate :转到特定的 URL
    • new_page :创建一个具有特定 ID 的新浏览器页面
    • switch_page :切换到不同的浏览器页面
    • get_pages :列出所有可用的浏览器页面
  • 页面交互
    • click :使用 CSS 选择器单击元素
    • type :在输入元素中输入文本
    • wait_for_selector :等待元素出现在页面上
  • 内容提取
    • get_text :从元素获取文本内容
    • get_page_content :获取整个页面 HTML
    • take_screenshot :捕获页面或元素的视觉状态

配置

安装依赖项

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" ] } }

发展

构建和发布

准备分发包:

  1. 同步依赖项并更新锁文件:
uv sync
  1. 构建软件包分发版:
uv build

这将在dist/目录中创建源和轮子分布。

  1. 发布到 PyPI:
uv publish

注意:您需要通过环境变量或命令标志设置 PyPI 凭据:

  • 令牌: --tokenUV_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 以开始调试。

Install Server
A
security – no known vulnerabilities
F
license - not found
A
quality - confirmed to work

local-only server

The server can only run on the client's local machine because it depends on local resources.

MCP 的 Playwright 包装器使 LLM 驱动的客户端能够控制浏览器以执行自动化任务。

  1. 成分
    1. 资源
    2. 提示
    3. 工具
  2. 配置
    1. 安装依赖项
  3. 快速入门
    1. 安装
  4. 发展
    1. 构建和发布
    2. 调试

Related MCP Servers

  • A
    security
    A
    license
    A
    quality
    A MCP server that provides browser automation tools, allowing users to navigate websites, take screenshots, click elements, fill forms, and execute JavaScript through Playwright.
    Last updated -
    8
    Python
    Apache 2.0
    • Apple
  • A
    security
    A
    license
    A
    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 -
    6
    Python
    Apache 2.0
    • Apple
  • -
    security
    F
    license
    -
    quality
    A service that provides Playwright browser automation functionality through Model Context Protocol (MCP), allowing clients to use Playwright features via SSE connections.
    Last updated -
    6
  • A
    security
    A
    license
    A
    quality
    A Model Context Protocol server that provides browser automation capabilities using Playwright, enabling LLMs to interact with web pages, take screenshots, generate test code, scrape web content, and execute JavaScript in real browser environments.
    Last updated -
    31
    11,273
    TypeScript
    MIT License
    • Linux
    • 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/misanthropic-ai/playwrite-mcp'

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