Chrome Testing MCP Server
by prabhubng
README.md
# Chrome Testing MCP Server
A Model Context Protocol (MCP) server for automated testing of Angular and DevExtreme web UI applications using Chrome browser automation. Works with Cursor, Claude Code, and any MCP-compatible client.
## Features
### ๐งช Virtual Tester Capabilities
- **Automated Page Testing**: Navigate to URLs and collect comprehensive metrics
- **Multi-Device Screenshots**: Capture screenshots at mobile, tablet, laptop, and desktop viewports
- **Performance Analysis**: Core Web Vitals (FCP, LCP, CLS) and detailed timing metrics
- **Network Monitoring**: Track all HTTP requests, API calls, and failures
- **Error Detection**: Capture JavaScript errors and console warnings
- **HTML/JSON Reports**: Generate beautiful, detailed test reports
### ๐ฑ Device Viewports
| Device | Resolution | Scale | Type |
|--------|-----------|-------|------|
| Mobile (iPhone 14) | 390x844 | 3x | Touch |
| Tablet (iPad) | 820x1180 | 2x | Touch |
| Laptop (14") | 1366x768 | 1x | Desktop |
| Desktop (24" Widescreen) | 1920x1080 | 1x | Desktop |
### ๐ง DevExtreme Component Detection
Automatically detects and analyzes DevExtreme widgets:
- DataGrid, TreeList, PivotGrid
- Chart, Scheduler
- Form, Popup, Button
- TextBox, SelectBox, DateBox
- Menu, Tabs, Accordion
- And more...
### ๐
ฐ๏ธ Angular Application Support
- Detects Angular framework
- Identifies Angular version
- Lists component selectors
- Analyzes application structure
## Installation
### Prerequisites
- Node.js 18 or higher
- Chrome/Chromium browser (Puppeteer will download one automatically)
### Setup
```bash
# Clone or download the project
cd chrome-testing-mcp-server
# Install dependencies
npm install
# Build the project
npm run build
```
## Configuration
### For Cursor IDE
Add to your `.cursor/mcp.json`:
```json
{
"mcpServers": {
"chrome-testing": {
"command": "node",
"args": ["/path/to/chrome-testing-mcp-server/dist/index.js"]
}
}
}
```
### For Claude Code
Add to your Claude Code MCP settings:
```json
{
"mcpServers": {
"chrome-testing": {
"command": "node",
"args": ["/path/to/chrome-testing-mcp-server/dist/index.js"]
}
}
}
```
### For Claude Desktop
Add to `claude_desktop_config.json`:
```json
{
"mcpServers": {
"chrome-testing": {
"command": "node",
"args": ["/path/to/chrome-testing-mcp-server/dist/index.js"]
}
}
}
```
## Available Tools
### Browser Control
| Tool | Description |
|------|-------------|
| `chrome_launch_browser` | Launch a Chrome browser instance |
| `chrome_navigate` | Navigate to a URL |
| `chrome_close_browser` | Close the browser |
| `chrome_status` | Check browser status |
### Testing & Analysis
| Tool | Description |
|------|-------------|
| `chrome_run_full_test` | Run comprehensive test suite |
| `chrome_capture_screenshots` | Capture multi-device screenshots |
| `chrome_get_performance` | Get performance metrics |
| `chrome_get_network_requests` | Get network request details |
| `chrome_get_errors` | Get console errors |
| `chrome_generate_report` | Generate test report |
### Framework Inspection
| Tool | Description |
|------|-------------|
| `chrome_inspect_devextreme` | Find DevExtreme components |
| `chrome_inspect_angular` | Analyze Angular application |
### Interaction
| Tool | Description |
|------|-------------|
| `chrome_wait_for_element` | Wait for element to appear |
| `chrome_click` | Click an element |
| `chrome_type` | Type text into input |
| `chrome_execute_script` | Execute custom JavaScript |
## Usage Examples
### Basic Test Flow
```
User: Test my Angular application at https://myapp.example.com
Claude will:
1. Launch browser
2. Navigate to URL
3. Wait for Angular to load
4. Capture screenshots at all device sizes
5. Collect performance metrics
6. Monitor network requests
7. Check for errors
8. Generate detailed report
```
### Run Full Test Suite
```
User: Run a complete test on https://app.example.com and save the report
Tools used:
- chrome_launch_browser (headless: true)
- chrome_run_full_test (url: "https://app.example.com")
- chrome_close_browser
Output: HTML report with screenshots, performance data, network analysis
```
### Check Performance
```
User: What's the performance like on the dashboard page?
Tools used:
- chrome_navigate (url: "https://app.example.com/dashboard")
- chrome_get_performance (response_format: "markdown")
```
### Find Slow API Calls
```
User: Which API calls are taking more than 500ms?
Tools used:
- chrome_get_network_requests (filterType: "api", minDuration: 500)
```
### Multi-Device Screenshots
```
User: Show me how the app looks on mobile and desktop
Tools used:
- chrome_capture_screenshots (devices: ["mobile", "desktop"])
```
### Inspect DevExtreme Components
```
User: What DevExtreme components are on this page?
Tools used:
- chrome_inspect_devextreme (componentType: "all")
```
## Performance Thresholds
The following thresholds are used to evaluate performance:
| Metric | Good | Needs Improvement |
|--------|------|-------------------|
| First Contentful Paint | โค 1.8s | > 1.8s |
| Largest Contentful Paint | โค 2.5s | > 2.5s |
| Cumulative Layout Shift | โค 0.1 | > 0.1 |
| API Response Time | โค 500ms | > 500ms |
## Report Output
### HTML Report Includes:
- ๐ Performance metrics with visual indicators
- ๐ Network analysis with API call details
- ๐จ Console errors and warnings
- ๐ฑ Multi-device screenshots
- ๐ Resource timing breakdown
- โฑ๏ธ Slowest requests identification
### JSON Report Structure:
```json
{
"id": "test-1234567890",
"url": "https://example.com",
"timestamp": "2024-01-15T10:30:00.000Z",
"duration": 5234,
"performance": {
"metrics": {
"firstContentfulPaint": 1200,
"largestContentfulPaint": 2100,
"cumulativeLayoutShift": 0.05,
"domContentLoaded": 1500,
"loadComplete": 2800
}
},
"networkSummary": {
"totalRequests": 45,
"failedRequests": 0,
"apiCalls": 12,
"averageLatency": 234
},
"errors": [],
"screenshots": [...]
}
```
## Troubleshooting
### Browser fails to launch
- Ensure Chrome/Chromium is installed or let Puppeteer download it
- On Linux, install required dependencies: `apt-get install chromium-browser`
- Try with `headless: false` for debugging
### Timeout errors
- Increase timeout in navigate/wait commands
- Check if the page requires authentication
- Verify the URL is accessible
### Network requests not captured
- Ensure you call `chrome_navigate` after `chrome_launch_browser`
- Some requests may fire before monitoring starts
### DevExtreme components not found
- Verify DevExtreme is loaded on the page
- Wait for dynamic content with `chrome_wait_for_element`
- Check component selectors with browser DevTools
## Development
```bash
# Watch mode for development
npm run dev
# Build for production
npm run build
# Run the server
npm start
```
## Architecture
```
chrome-testing-mcp-server/
โโโ src/
โ โโโ index.ts # MCP server setup and tool registration
โ โโโ types.ts # TypeScript interfaces
โ โโโ constants.ts # Configuration constants
โ โโโ schemas/
โ โ โโโ index.ts # Zod validation schemas
โ โโโ services/
โ โโโ browser.ts # Puppeteer browser automation
โโโ package.json
โโโ tsconfig.json
โโโ README.md
```
## License
MIT License - See LICENSE file for details.
## Contributing
Contributions are welcome! Please:
1. Fork the repository
2. Create a feature branch
3. Add tests if applicable
4. Submit a pull request
## Support
For issues and feature requests, please create an issue in the repository.
This server cannot be deployed
Maintenance
ActivityInactive
ResponsivenessNo recent community issues