Skip to main content
Glama
nora-weisser

Playwright Report MCP

by nora-weisser

Playwright Report MCP

一个 MCP 服务器,将 Playwright JSON 测试报告以工具的形式提供给 LLM 智能体。

环境要求

  • Python >= 3.10

  • uvbrew install uvcurl -LsSf https://astral.sh/uv/install.sh | sh

  • Node.js + npx — 仅用于 mcp dev,它会启动 MCP Inspector

Related MCP server: Tesults MCP

1. 安装依赖

从仓库根目录:

uv sync

这会创建 .venv/,并以可编辑模式安装项目。下面的所有命令都通过 uv run 运行,因此你无需手动激活 venv。

2. 生成 Playwright JSON 报告

服务器读取由 json 报告器生成的 Playwright 报告。在你的 Playwright 项目中:

npx playwright test --reporter=json > results.json

或者将其永久配置在 playwright.config.ts 中:

export default defineConfig({
  reporter: [['json', { outputFile: 'results.json' }]],
});

该文件必须包含标准顶层键 configsuiteserrorsstats

如果你只是想试用服务器,仓库中附带了一份示例报告 results.json。

3. 配置报告路径

在仓库根目录创建一个指向该报告的 .env 文件(建议使用绝对路径):

REPORT_PATH=/absolute/path/to/results.json

如果要改用附带的示例报告:

REPORT_PATH=/absolute/path/to/playwright-test-analysis-mcp/src/playwright_report_mcp/results.json

REPORT_PATH 在每次工具调用时都会被读取,因此你无需重启服务器即可重新生成报告。如果未设置,工具调用将失败并提示 REPORT_PATH environment variable is not set.

4. 运行服务器

交互式开发(MCP Inspector)

uv run mcp dev src/playwright_report_mcp/server.py

会在你的浏览器中打开 MCP Inspector,让你可以手动列出并调用工具。需要 npx

纯 stdio 服务器

uv run playwright-report-mcp

或者,等价地:

uv run mcp run src/playwright_report_mcp/server.py

通过 stdin/stdout 以 MCP 协议进行通信。适合接入 MCP 客户端,或用于快速冒烟测试:

printf '{"jsonrpc":"2.0","id":1,"method":"initialize","params":{"protocolVersion":"2024-11-05","capabilities":{},"clientInfo":{"name":"t","version":"1"}}}\n' \
  | uv run playwright-report-mcp

你应该会收到一个 JSON-RPC 结果,其中包含 "serverInfo":{"name":"Playwright Report",...}

将其连接到客户端

将服务器注册到 Claude Desktop:

uv run mcp install src/playwright_report_mcp/server.py

或者手动将其添加到 MCP 客户端配置中(例如 claude_desktop_config.json):

{
  "mcpServers": {
    "playwright-report": {
      "command": "uv",
      "args": [
        "--directory",
        "/absolute/path/to/playwright-test-analysis-mcp",
        "run",
        "playwright-report-mcp"
      ]
    }
  }
}

--directory 很重要:它使 uv 能够解析此项目的 venv,并让 load_dotenv() 找到 .env 文件。

工具

工具

描述

get_test_summary

最近一次运行的摘要:start_timeduration_mspassedfailedskippedflaky

get_failures

失败测试的列表,每项包含 titlefilestatus 和第一条 error 消息。

运行测试

pytestpytest-asyncio 已安装,但仓库中还没有测试文件,因此目前会收集到 0 个测试:

uv run pytest

故障排除

症状

解决方法

REPORT_PATH environment variable is not set.

在仓库根目录创建 .env,或在启动服务器的 shell 中导出 REPORT_PATH

工具调用时出现 FileNotFoundError

REPORT_PATH 指向的文件不存在——请使用绝对路径。

KeyError: 'stats'

该 JSON 不是 Playwright json 报告器生成的报告(例如它是 HTML 报告或原始数据块)。

mcp dev 启动失败

安装 Node.js 以确保 npx 可用,或改用 mcp run

F
license - not found
A
quality
C
maintenance

Maintenance

Maintainers
Response time
Release cycle
Releases (12mo)
Commit activity

Resources

Unclaimed servers have limited discoverability.

Looking for Admin?

If you are the server author, to access and configure the admin panel.

Related MCP Servers

  • A
    license
    A
    quality
    D
    maintenance
    Enables LLMs to explore and analyze UK Government BEIS inspect_ai evaluation logs directly from tools like Claude Code and Cursor. It provides capabilities to list logs, view evaluation summaries, and inspect conversation histories for specific samples.
    6
    MIT
  • A
    license
    Not graded
    quality
    D
    maintenance
    Connect AI agents to your test results, insights, and targets. Query test runs, failures, flaky tests, and regressions across frameworks including Playwright, Jest, Pytest, Cypress and more.
    37
    MIT

View all related MCP servers

Related MCP Connectors

  • Browser-backed QA with evidence and fix-ready reports for coding agents.

  • Playwright selector risk checks with healing suggestions and receipts.

  • BuildPulse CI test analytics for AI agents — flaky tests, coverage, and CI run history.

View all MCP Connectors

Latest Blog Posts

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/nora-weisser/playwright-test-analysis-mcp'

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