AI QA Agent MCP
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
在推送和拉取请求时自动执行
Related MCP server: mcp-playwright-test
🧰 技术栈
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.mdpages/
包含可复用的页面对象模型类,封装了 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.jsrun_tests MCP 工具支持多个套件:
logininventorycheckoutapiregression
示例请求:
{
"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 测试套件。
该流水线执行以下操作:
仓库检出
Node.js 环境设置
依赖安装
Playwright 浏览器安装
自动化测试执行
Playwright 报告上传
这为每次代码变更提供自动化的回归反馈。
🔮 未来增强
将 LLM 连接到 MCP 服务器,实现自然语言测试执行
AI 辅助失败分析
自动缺陷摘要
从自然语言需求生成测试
更多 API 覆盖
并行和跨浏览器执行
Docker 化测试执行
测试结果通知
This server cannot be deployed
Maintenance
Related MCP Connectors
Discover Playwright workflows, start runs, and inspect results in Playrunner Cloud.
Run, debug, and triage tests from your IDE using natural language, no dashboard switching, no manual data transfers. The TestMu AI (formerly LambdaTest) MCP Server is a single remote server exposing four tool suites: HyperExecute — analyze your project, generate YAML configs and test runner commands, then monitor jobs and sessions. Automation — pull a TestID's details plus command, network, and console logs into one chat for instant root-cause analysis. Includes mobile app upload. SmartUI — explain pixel, layout, DOM, and perceptual changes in a visual regression run, with context-aware React/HTML/CSS fixes. Accessibility — audit any public URL or a local React app against WCAG and get ready-to-apply remediation steps. Connects over https://mcp.lambdatest.com/mcp using OAuth 2.1 — no API keys in your config. One-click install in Cursor; works with Claude, GitHub Copilot, Cline, and any MCP client. Tests execute on the TestMu AI cloud: 3,000+ browsers and 10,000+ real devices.
Katalon True Platform MCP: design tests, run with AI, upload reports, assess release readiness.
MEOK MCP Test MCP — golden-file + schema-drift + tool-failure tests for any MCP server. Drop-in
Related MCP Servers
- AlicenseAqualityBmaintenanceMCP server for autonomous end-to-end testing with Wopee.io. Analyzes web applications, generates and executes Playwright-based functional tests, and validates results — all driven by natural language commands.15135 npm4MIT
- AlicenseNot gradedqualityDmaintenanceAn MCP server that automates Playwright-based UI and API testing, supporting test case generation from requirements or API specs, and execution with detailed reports.12 npm1MIT
- AlicenseBqualityDmaintenanceMCP server for end-to-end QA automation: generates test scenarios, discovers Playwright locators, creates TypeScript test code, executes tests, and creates GitHub issues for failures.627 npmMIT
- AlicenseAqualityDmaintenanceEnables test execution and management through MCP clients, allowing retrieval of projects, listing tests, executing tests with browser selection, and monitoring results.610 npmMIT