Browser[X]MCP
Enables AI-driven browser automation with advanced form testing, batch operations, and intelligent element extraction for MCP-compatible applications.
README
![Browser[X]MCP Banner](assets/logo/browserx-mcp-logo-banner.png)
AI-Powered Browser Automation with Advanced Form Testing
Browser[X]MCP is a Model Context Provider (MCP) server that enables AI-driven browser automation with advanced form testing capabilities, intelligent element extraction, and comprehensive interaction logging.
Connect your AI apps to browser automation - Works seamlessly with Cursor, Claude Desktop, VS Code, and other MCP-compatible applications.
⨠Features
š¤ AI-Driven Testing
- Smart Form Filling: AI automatically fills forms with realistic test data
- Batch Actions: Efficient bulk operations for multiple elements (up to 5 actions per batch)
- Context Awareness: AI understands page state and avoids redundant actions
- Loop Detection: Prevents infinite testing cycles
ā” Batch Operations System
- Multi-Element Processing: Execute up to 5 actions simultaneously
- Intelligent Grouping: AI automatically groups similar elements for batch processing
- Performance Optimization: Reduce API calls and execution time by 3-5x
- Error Isolation: Individual action failures don't stop the entire batch
- Smart Prioritization: Batch similar input types (text fields, checkboxes, etc.)
šÆ Advanced Element Extraction
- XML Canvas Format: Compact, efficient page representation (800x+ compression)
- ID-Based Targeting: Reliable element identification
- Coordinate Mapping: Precise click positioning
- Real-time Updates: Dynamic page state tracking
š° Token Economics & Cost Efficiency
- Massive Token Savings: 800x+ data compression vs screenshots
- AI Cost Reduction: ~90% lower AI API costs compared to vision models
- Text vs Vision Models: Use cheaper text models instead of expensive vision APIs
- Scalable Operations: Process thousands of pages at fraction of screenshot costs
- Performance Boost: 10x faster processing with compact data format
š Comprehensive Logging
- Action History: Detailed logs of all AI decisions and actions
- Form Data Capture: Real-time extraction of filled form data
- Performance Metrics: Success rates, timing, and efficiency stats
- Test Reports: JSON and console output formats
š”ļø Robust Automation
- Field Clearing: Advanced input field cleaning before entry
- File Upload Handling: Programmatic file upload without OS dialogs
- Error Recovery: Graceful handling of failed operations
- Stealth Mode: Reduced bot detection signatures
š Quick Start
Installation
# Clone the repository
git clone https://github.com/rnd-pro/browser-x-mcp.git
cd browser-x-mcp
# Install dependencies
npm install
# Install Playwright browser binaries for local browser tests
npx playwright install chromium
# Configure environment
cp .env.example .env
# Edit .env with your API keys
# Start the MCP server
npm start
Basic Usage
# Run AI-powered form testing
npm test
# Run with mock AI (faster testing)
npm run test:mock
# Generate test reports
npm run test:report
šļø Architecture
āāāāāāāāāāāāāāāāāāā āāāāāāāāāāāāāāāāāāāā āāāāāāāāāāāāāāāāāāā
ā AI Test āāāāā¶ā MCP Server āāāāā¶ā Browser ā
ā Agent ā ā (BrowserX) ā ā (Playwright) ā
āāāāāāāāāāāāāāāāāāā āāāāāāāāāāāāāāāāāāāā āāāāāāāāāāāāāāāāāāā
ā ā ā
ā¼ ā¼ ā¼
āāāāāāāāāāāāāāāāāāā āāāāāāāāāāāāāāāāāāāā āāāāāāāāāāāāāāāāāāā
ā Test Reports ā ā Action Logs ā ā Screenshots ā
ā & Metrics ā ā & Form Data ā ā & Canvas ā
āāāāāāāāāāāāāāāāāāā āāāāāāāāāāāāāāāāāāāā āāāāāāāāāāāāāāāāāāā
š Project Structure
browserx-mcp/
āāā src/
ā āāā server/ # MCP Server implementation
ā ā āāā index.js # Main server with browser automation
ā ā āāā atomic-navigation.js # Navigation utilities
ā ā āāā daemon.js # Server daemon
ā āāā extractor/ # Page analysis tools
ā āāā VirtualCanvasExtractor.js # XML canvas extraction
āāā test/
ā āāā ai-mcp-interaction-test.js # AI-powered testing
ā āāā real-websites-test.js # Real website validation
ā āāā input-types-test-page.html # Test page
āāā tools/ # Development utilities
ā āāā screenshot-analyzer/ # Screenshot analysis tools (planned)
āāā examples/ # Usage examples
āāā docs/ # Documentation
āāā config/ # Configuration files
š° Cost Efficiency Analysis
Token Usage Comparison
| Approach | Data Size | Tokens | Cost/Request |
|---|---|---|---|
| Screenshots | 200KB | ~400,000 | $0.0048 |
| XML Canvas | 0.25KB | ~500 | $0.0001 |
| Savings | 800x smaller | 800x fewer | 48x cheaper |
Real-World Performance
- Google Search: 276KB screenshot ā 3KB canvas = 92x compression
- GitHub Pages: 166KB screenshot ā 121KB canvas = 1.4x compression
- Average Savings: ~90% cost reduction on AI API calls
š® Usage Examples
AI-Powered Form Testing
import { MCPAIInteractionAgent } from './test/ai-mcp-interaction-test.js';
const agent = new MCPAIInteractionAgent({
maxIterations: 20,
useMockAI: false,
stopOnFailure: true
});
await agent.init();
await agent.runInteractionTest();
const report = await agent.generateReport();
Batch Operations Example
// Execute multiple actions in one batch
const batchResponse = await fetch('http://localhost:3001', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({
jsonrpc: '2.0',
method: 'batch_actions',
params: {
actions: [
{ action: 'input_text', element_id: 'email', text: 'user@example.com' },
{ action: 'input_text', element_id: 'password', text: 'SecurePass123' },
{ action: 'click_element_by_id', element_id: 'submit-btn' }
]
},
id: 1
})
});
Custom MCP Operations
// Connect to MCP server
const response = await fetch('http://localhost:3001', {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({
jsonrpc: '2.0',
method: 'extract_xml_canvas',
params: {},
id: 1
})
});
š¤ AI Editor Integration
Works with Popular AI Applications
Browser[X]MCP integrates seamlessly with MCP-compatible AI applications:
| Application | Support | Setup |
|---|---|---|
| Cursor | ā Full | Add to .cursor/mcp.json |
| Claude Desktop | ā Full | Add to MCP configuration |
| VS Code | ā Full | Use MCP extension |
| Windsurf | ā Full | MCP server integration |
Cursor Integration
To use Browser[X]MCP with Cursor, add this to your .cursor/mcp.json:
{
"mcpServers": {
"browser-x-mcp": {
"command": "node",
"args": ["./src/server/daemon.js"],
"env": {
"BROWSER_X_MCP_DEBUG": "true",
"NODE_ENV": "development"
}
}
}
}
Then restart Cursor and start automating your browser with AI! š
š§ Configuration
Environment Variables
Create a .env file based on .env.example:
# Copy the example file
cp .env.example .env
# Edit with your settings
nano .env
Required environment variables:
# AI Configuration (required for AI testing)
OPENROUTER_API_KEY=your_openrouter_api_key_here
OPENROUTER_MODEL=deepseek/deepseek-r1:free
# Server Configuration
MCP_PORT=3001
BROWSER_HEADLESS=false
Note: Get your OpenRouter API key from openrouter.ai
Test Configuration
const config = {
maxIterations: 30,
stopOnFailure: true,
useMockAI: false,
headless: false,
loopThreshold: 2
};
š Test Reports
Browser[X]MCP generates comprehensive test reports:
{
"testMetadata": {
"testType": "MCP AI-Powered Form Interaction Test",
"timestamp": "2025-01-20T19:30:22.508Z",
"duration": "45.2 seconds",
"model": "deepseek/deepseek-r1:free"
},
"results": {
"totalActions": 12,
"successfulActions": 12,
"failedActions": 0,
"successRate": "100.00%",
"aiDecisions": [...]
}
}
š ļø Development
Running Tests
# AI-powered form testing
npm test
# Alternative AI test command
npm run test:ai
# Mock AI testing (faster, no API required)
npm run test:mock
# View test page manually
npm run test:page
Adding New Features
- Server Extensions: Add new MCP methods in
src/server/index.js - AI Capabilities: Enhance AI logic in
test/ai-mcp-interaction-test.js - Extractors: Create new page analyzers in
src/extractor/
šŗļø Roadmap
šÆ Planned Features
š¼ļø Screenshot Analysis Tools
- Visual element detection and coordinate mapping
- Cropped screenshot analysis for targeted interactions
- AI-powered click coordinate determination
- Visual regression testing capabilities
š§ Enhanced AI Integration
- Multi-model AI support (GPT-4, Claude, Local models)
- Custom AI prompt templates
- Learning from user interactions
- Adaptive testing strategies
š Extended Browser Support
- Multi-browser testing (Chrome, Firefox, Safari)
- Browser profile management
- Existing browser connection support
- Extension-based automation
š Advanced Analysis
- Performance monitoring and optimization
- Accessibility testing integration
- SEO analysis capabilities
- Security vulnerability scanning
š± Cross-Platform Support
- Mobile browser automation
- Responsive design testing
- Touch interaction simulation
- Device emulation
š Priority Features
- [ ] Screenshot analyzer tool implementation
- [ ] Enhanced error handling and recovery
- [ ] Performance optimization
- [ ] Comprehensive documentation
šØ Future Vision
- [ ] Visual testing framework
- [ ] Multi-browser orchestration
- [ ] Cloud deployment options
- [ ] Enterprise features
š¤ Contributing
We welcome contributions! Please see our Contributing Guide for details.
Development Setup
git clone https://github.com/rnd-pro/browser-x-mcp.git
cd browser-x-mcp
npm install
npm run dev
Submitting Changes
- Fork the repository
- Create a feature branch:
git checkout -b feature/amazing-feature - Commit changes:
git commit -m 'Add amazing feature' - Push to branch:
git push origin feature/amazing-feature - Open a Pull Request
š License
This project is licensed under the MIT License - see the LICENSE file for details.
š„ Development Team
Developed by RND-PRO Team
- š Website: rnd-pro.com
- š¼ Professional development team specializing in innovative automation solutions
- š¤ Experts in AI integration and browser automation technologies
š Acknowledgments
- Built on top of Playwright for reliable browser automation
- Inspired by the MCP (Model Context Provider) specification
- AI integration powered by OpenRouter and various LLM providers
- Similar to Browser MCP but with advanced AI testing capabilities
š Support
- š§ Issues: GitHub Issues
- š¬ Discussions: GitHub Discussions
- š Documentation: Repository docs
Made with ā¤ļø by RND-PRO Team for the AI automation community
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.