MCP Test Automation Framework
Enables AI-powered web test automation with self-healing locators and automatic GitHub checkin.
README
π€ MCP Test Automation Framework
SQA Test Automation powered by Claude/Deepseek AI with self-healing locators and auto GitHub checkin
ποΈ Architecture
mcp-automation/
βββ src/
β βββ mcp/ # MCP Server (connects AI to browser)
β β βββ mcp-server.ts # MCP tool definitions & handlers
β β βββ index.ts
β βββ core/ # Core modules
β β βββ browser-manager.ts # Playwright browser lifecycle
β β βββ config.ts # Settings loader
β β βββ logger.ts # Logging utility
β βββ healing/ # Self-Healing Engine
β β βββ locator-healer.ts # Alternative locator strategies
β βββ scripts/ # Utility scripts
β β βββ git-auto-checkin.ts # Auto commit & push to GitHub
β βββ tests/ # Test definitions
β β βββ types.ts
β β βββ google-search.ts
β βββ mcp-server-entry.ts # MCP server entry point
β βββ runner.ts # Direct test runner
βββ config/
β βββ settings.json # Framework configuration
βββ logs/ # Run logs & screenshots
βββ .github/workflows/ # CI/CD pipeline
βββ package.json
βββ tsconfig.json
βββ README.md
π How It Works
1. AI (Claude/Deepseek) calls MCP tool
β
βΌ
2. Playwright executes browser action
β
βΌ
3. Element not found?
β
βΌ
4. Self-Healing Engine kicks in
βββββββββββββββββββββββββββββββ
β Tries: role β text β β
β placeholder β label β testIdβ
β β CSS β XPath β aria-label β
βββββββββββββββββββββββββββββββ
β
βΌ
5. Found? β Logs healing action, proceeds
Not found? β Screenshot, reports failure
β
βΌ
6. GitHub Auto Checkin
βββββββββββββββββββββββββββββββ
β Creates branch β
β test-run/<name>-<timestamp> β
β Stages & commits all files β
β Pushes to remote β
βββββββββββββββββββββββββββββββ
π Quick Start
1. Install dependencies
npm install
npx playwright install chromium
2. Configure
Edit config/settings.json:
- Set AI provider and API keys (via env vars)
- Configure browser options
- Set GitHub remote URL
3. Set API Keys (optional β for AI features)
set ANTHROPIC_API_KEY=sk-ant-... # For Claude
set DEEPSEEK_API_KEY=sk-... # For Deepseek
4. Run tests directly
npm run dev
5. Start MCP Server (for AI assistant connection)
npm run mcp-server
Then connect your AI assistant (Claude/Deepseek) to this MCP server.
π οΈ MCP Tools Available to AI
| Tool | Description |
|---|---|
navigate |
Navigate to a URL |
click |
Click an element (with self-healing) |
type / fill |
Type text into fields (with self-healing) |
get_text |
Get element text (with self-healing) |
wait_for_selector |
Wait for element to appear |
screenshot |
Capture page screenshot |
press_key |
Press keyboard keys |
run_test |
Execute a full test case |
auto_checkin |
Commit & push to GitHub |
get_healing_summary |
View self-healing stats |
π§ͺ Self-Healing
When a locator fails, the engine tries these strategies in order:
getByRoleβ Find by ARIA rolegetByTextβ Find by text contentgetByPlaceholderβ Find by placeholder attributegetByLabelβ Find by associated labelgetByTestIdβ Find bydata-testid- CSS selector β Try original selector as CSS
- CSS alternatives β e.g.,
textareaβinput, attribute variations [aria-label]β Find by aria-label attribute
All healing actions are logged to logs/healing-log.json.
π€ GitHub Auto Checkin
After each test run, the framework automatically:
- Creates a new branch:
test-run/<test-name>-<timestamp> - Stages all changed files (tests, logs, screenshots)
- Commits with descriptive message
- Pushes to remote
π§ Configuration
See config/settings.json for all options:
| Section | Key | Description |
|---|---|---|
ai |
provider |
"auto", "claude", or "deepseek" |
browser |
headless |
true/false for headed mode |
selfHealing |
enabled |
Enable/disable self-healing |
selfHealing |
maxRetries |
Max healing attempts per locator |
github |
autoCheckin |
Enable auto commit/push |
logging |
level |
"debug", "info", "warn", "error" |
π License
MIT
Recommended Servers
playwright-mcp
A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.
Magic Component Platform (MCP)
An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.
Audiense Insights MCP Server
Enables interaction with Audiense Insights accounts via the Model Context Protocol, facilitating the extraction and analysis of marketing insights and audience data including demographics, behavior, and influencer engagement.
VeyraX MCP
Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.
graphlit-mcp-server
The Model Context Protocol (MCP) Server enables integration between MCP clients and the Graphlit service. Ingest anything from Slack to Gmail to podcast feeds, in addition to web crawling, into a Graphlit project - and then retrieve relevant contents from the MCP client.
Kagi MCP Server
An MCP server that integrates Kagi search capabilities with Claude AI, enabling Claude to perform real-time web searches when answering questions that require up-to-date information.
E2B
Using MCP to run code via e2b.
Neon Database
MCP server for interacting with Neon Management API and databases
Exa Search
A Model Context Protocol (MCP) server lets AI assistants like Claude use the Exa AI Search API for web searches. This setup allows AI models to get real-time web information in a safe and controlled way.
Qdrant Server
This repository is an example of how to create a MCP server for Qdrant, a vector search engine.