QA Automation MCP Server
An AI-powered QA automation tool that crawls web pages, generates Playwright-based pytest tests using an LLM, runs them, and automatically heals failing tests.
README
QA Automation MCP Server
An AI-powered QA automation tool built on the Model Context Protocol (MCP). It crawls web pages, generates Playwright-based pytest tests using an LLM, runs them, and automatically heals failing tests — all driven by natural language instructions.
How It Works
User Instruction
│
▼
crawl_page(url)
│ Headless Chromium extracts all interactive elements
▼
write_test(crawl_data, instruction, output_dir)
│ Groq LLM generates a pytest + Playwright test file
▼
run_test(crawl_data, output_dir)
│ Pytest executes the generated test
│
├── PASS → HTML report + text summary
│
└── FAIL (locator/timeout error)
│
▼
Auto-Healer
│ Groq rewrites the broken locators
▼
Re-run test
│
└── HTML report + text summary (marked "healed")
Features
- Page Crawling — Extracts inputs, buttons, and links with CSS selectors, XPaths, and metadata
- AI Test Generation — Converts a plain-English instruction + crawl data into a complete pytest test file
- Automated Execution — Runs tests programmatically with
pytestand captures all output - Auto-Healing — Detects locator/timeout failures and sends the broken test back to the LLM for repair, then re-runs automatically
- Rich Reporting — Generates an HTML report with screenshots and a text summary; opens in browser automatically
- Headless or Headed — Browser is headless by default; pass
show_browser=trueto watch it run
Architecture
MCP-server/
├── main.py # MCP server entry point and request dispatcher
├── pyproject.toml # Project metadata and dependencies
├── .env # API keys (not committed)
└── src/
├── tools.py # MCP tool definitions (schemas exposed to the client)
├── handlers.py # Request handlers that wire tools to logic
├── crawler.py # Playwright-based page crawling
├── writer.py # LLM-powered test code generation
├── runner.py # Pytest execution and result parsing
├── healer.py # Auto-healing logic for failing tests
└── reporter.py # HTML and text report generation
MCP Tools
The server exposes three tools to any MCP-compatible client.
crawl_page
Crawls a URL and returns structured data about all interactive elements on the page.
| Parameter | Type | Description |
|---|---|---|
url |
string | The page URL to crawl |
Returns: JSON with title, inputs, buttons, and links, each containing locator strategies (CSS selector, XPath) and metadata.
write_test
Generates a pytest + Playwright test file from crawl data and a plain-English instruction.
| Parameter | Type | Description |
|---|---|---|
crawl_data |
string | JSON output from crawl_page |
instruction |
string | What to test, e.g. "submit the login form" |
output_dir |
string | Root directory where test files will be saved |
show_browser |
boolean | Show the browser during execution (default: false) |
Returns: Path to the generated test file at {output_dir}/generated_tests/test_*.py.
run_test
Executes the generated test and returns a report. Automatically attempts to heal locator/timeout failures.
| Parameter | Type | Description |
|---|---|---|
crawl_data |
string | JSON from crawl_page (used for healing) |
output_dir |
string | Project root directory |
test_file |
string | Path to test file (optional; defaults to last generated) |
Returns: Text summary + path to the HTML report at {output_dir}/test_results/report_*.html.
Prerequisites
- Python 3.12+
- uv (recommended) or pip
- A Groq API key
- Playwright browsers installed
Installation
1. Clone the repository
git clone <repo-url>
cd MCP-server
2. Install dependencies
uv sync
Or with pip:
pip install -e .
3. Install Playwright browsers
uv run playwright install chromium
4. Create a .env file
GROQ_API_KEY=your_groq_api_key_here
Running the Server
The server communicates over stdio, which is the standard transport for MCP clients like Claude Code.
uv run python main.py
Connecting to Claude Code
Add the server to your Claude Code MCP configuration (.claude/settings.json or ~/.claude/settings.json):
{
"mcpServers": {
"qa-automation": {
"command": "uv",
"args": ["run", "python", "main.py"],
"cwd": "/absolute/path/to/MCP-server"
}
}
}
Once connected, you can drive the entire QA workflow through natural language in Claude Code:
"Crawl https://example.com, then write a test that fills in the search box and clicks Submit, and run it."
Generated Output
Each test run produces the following structure inside output_dir:
{output_dir}/
├── generated_tests/
│ └── test_<slug>.py # Generated pytest test file
├── test_results/
│ └── report_YYYYMMDD_HHMMSS.html # HTML report with screenshot
└── result.png # Screenshot from the last test run
The HTML report is opened automatically in your default browser after each run.
Auto-Healing
When a test fails due to a locator or timeout error, the healer:
- Parses the pytest output to identify the broken locator
- Sends the original test code, the error, and the fresh crawl data to the LLM
- Receives a rewritten version with corrected selectors (
get_by_role,get_by_text, or CSS) - Saves the patched file and re-runs the test
- Marks the final report with
healed: true
Only one healing attempt is made per run. Logic errors (wrong assertions, incorrect flow) are not healed automatically.
Dependencies
| Package | Purpose |
|---|---|
mcp / fastmcp |
MCP server framework |
playwright |
Browser automation |
pytest |
Test execution |
pytest-playwright |
Playwright fixtures for pytest |
groq |
LLM API for test generation/healing |
python-dotenv |
.env file loading |
httpx |
Async HTTP client |
pydantic |
Data validation |
LLM Configuration
- Provider: Groq
- Model:
llama-3.3-70b-versatile - Temperature:
0.3for test generation,0.1for healing (tighter, more deterministic)
To switch models or providers, update src/writer.py and src/healer.py.
Limitations
- Auto-healing only addresses locator and timeout errors, not test logic errors
- Only one healing attempt per test run
- Authentication and multi-step login flows are not handled automatically
- Hardcoded to Groq's
llama-3.3-70b-versatilemodel
License
MIT
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。