Skip to main content
Glama

AI QA Agent MCP

一个基于 Playwright 和 Node.js 构建的、支持 MCP 的 QA 自动化框架,用于通过模型上下文协议(MCP)服务器执行 UI 和 API 自动化测试。

该项目展示了如何将传统测试自动化暴露为可复用的 MCP 工具,使兼容 MCP 的客户端能够触发测试套件并接收结构化的测试结果。

🚀 功能特性

  • Playwright UI 自动化

  • 使用 Playwright 进行 API 测试

  • 页面对象模型(POM)

  • MCP 服务器集成

  • 基于 MCP 工具的测试执行

  • 结构化 JSON 测试结果

  • 登录、库存和结账测试覆盖

  • 正向和负向测试场景

  • 回归测试执行

  • 基于环境的配置

  • HTML 测试报告

  • 失败时截图

  • GitHub Actions CI/CD

  • 在推送和拉取请求时自动执行

🧰 技术栈

  • JavaScript

  • Node.js

  • Playwright

  • 模型上下文协议(MCP)

  • MCP Inspector

  • Git

  • GitHub

  • GitHub Actions

🏗️ 架构

                MCP Client / Inspector
                         |
                         v
                    MCP Server
                  (mcp/server.js)
                         |
                         v
                   run_tests Tool
                         |
             +-----------+-----------+
             |                       |
             v                       v
       Test Tool Layer          Suite Selection
       (tools/*.js)        login / inventory /
                           checkout / api /
                           regression
             |
             v
        testRunner.js
             |
             v
          Playwright
         /          \
        v            v
    UI Tests      API Tests
       |
       v
  Page Objects

📁 项目结构

my-ai-qa-agent/
│
├── .github/
│   └── workflows/
│       └── playwright.yml
│
├── data/
│   ├── customer.js
│   └── users.js
│
├── mcp/
│   └── server.js
│
├── pages/
│   ├── LoginPage.js
│   ├── InventoryPage.js
│   ├── CartPage.js
│   └── CheckoutPage.js
│
├── tests/
│   ├── api/
│   │   └── users.api.spec.js
│   ├── login.spec.js
│   ├── inventory.spec.js
│   └── checkout.spec.js
│
├── tools/
│   ├── testRunner.js
│   ├── runLoginTests.js
│   ├── runInventoryTests.js
│   ├── runCheckoutTests.js
│   ├── runApiTests.js
│   └── runRegressionTests.js
│
├── .env.example
├── .gitignore
├── package.json
├── playwright.config.js
└── README.md

pages/

包含可复用的页面对象模型类,封装了 UI 定位器和用户操作。

tests/

包含 Playwright UI 和 API 测试规范。

tools/

充当 MCP 请求与 Playwright 测试执行之间的桥梁。各个工具选择测试套件,而 testRunner.js 执行 Playwright 并汇总结果。

mcp/

包含将 QA 自动化能力暴露为 MCP 工具的 MCP 服务器。

.github/workflows/

包含用于在 CI 中执行自动化测试套件的 GitHub Actions 工作流。

⚙️ 安装

克隆仓库:

git clone https://github.com/bisminizzar84/ai-qa-agent-mcp
cd ai-qa-agent-mcp

安装依赖:

npm install

安装 Playwright 浏览器:

npx playwright install

根据 .env.example 创建本地 .env 文件:

BASE_URL=https://www.saucedemo.com

🧪 运行测试

运行完整测试套件:

npm test

使用可见浏览器运行测试:

npx playwright test --headed

仅运行登录测试:

npx playwright test tests/login.spec.js

运行 API 测试:

npx playwright test tests/api/users.api.spec.js

打开 Playwright HTML 报告:

npx playwright show-report

🤖 MCP 集成

该项目通过 MCP 服务器暴露 QA 自动化能力。

通过 MCP Inspector 启动服务器:

npx -y @modelcontextprotocol/inspector@latest node mcp/server.js

run_tests MCP 工具支持多个套件:

  • login

  • inventory

  • checkout

  • api

  • regression

示例请求:

{
  "suite": "api"
}

示例响应:

{
  "suite": "api",
  "status": "passed",
  "total": 1,
  "passed": 1,
  "failed": 0,
  "skipped": 0,
  "durationMs": 1841
}

MCP 层将测试执行转换为结构化结果,可供兼容 MCP 的客户端使用。

🔄 CI/CD

当代码推送到 main 分支或拉取请求指向 main 分支时,GitHub Actions 会自动执行 Playwright 测试套件。

该流水线执行以下操作:

  1. 仓库检出

  2. Node.js 环境设置

  3. 依赖安装

  4. Playwright 浏览器安装

  5. 自动化测试执行

  6. Playwright 报告上传

这为每次代码变更提供自动化的回归反馈。

🔮 未来增强

  • 将 LLM 连接到 MCP 服务器,实现自然语言测试执行

  • AI 辅助失败分析

  • 自动缺陷摘要

  • 从自然语言需求生成测试

  • 更多 API 覆盖

  • 并行和跨浏览器执行

  • Docker 化测试执行

  • 测试结果通知

-
license - not tested
Not graded
quality - not tested
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 Connectors

  • MEOK MCP Test MCP — golden-file + schema-drift + tool-failure tests for any MCP server. Drop-in

  • Hosted real Google Chrome MCP with per-user persistent state. Navigate, click, type, screenshot.

  • MCP server for AI access to SmartBear tools, including BugSnag, Reflect, Swagger, PactFlow, QTM4J.

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/bisminizzar84/ai-qa-agent-mcp'

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