Skip to main content
Glama
Browser[X]MCP
by rnd-pro

Browser[X]MCP Banner

AI-Powered Browser Automation with Advanced Form Testing

License Node.js Version Status

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

Related MCP server: BrowserPilot

šŸš€ 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

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

  1. Server Extensions: Add new MCP methods in src/server/index.js

  2. AI Capabilities: Enhance AI logic in test/ai-mcp-interaction-test.js

  3. 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

  1. Fork the repository

  2. Create a feature branch: git checkout -b feature/amazing-feature

  3. Commit changes: git commit -m 'Add amazing feature'

  4. Push to branch: git push origin feature/amazing-feature

  5. 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


Made with ā¤ļø by RND-PRO Team for the AI automation community

Available Tools

14 tools
batch_actionsA

Execute multiple actions in batch (up to 5 actions for performance)

Inputs: actions (required).

click_element_by_xpathC

Click an element using XPath selector

Inputs: xpath (required).

compare_with_screenshotA

Compare virtual canvas data size with screenshot for performance testing

Inputs: no named parameters.

evaluate_in_pageC

Execute JavaScript code in the browser page context

Inputs: code (required).

execute_atomic_actionB

Execute an atomic action generated by get_element_details

Inputs: action (required), text_input.

extract_virtual_canvasA

Extract virtual canvas data from current page instead of taking screenshot

Inputs: url, wait_for, include_non_interactive.

get_element_detailsC

Step 2: Get detailed information about specific element for precise action execution

Inputs: element_id (required), action_intent.

get_performance_metricsA

Get Browser[X]MCP server performance metrics and statistics

Inputs: random_string.

helpA

Get detailed usage instructions and workflow examples for Browser[X]MCP

Inputs: topic.

input_textA

Input text into a form field using virtual canvas data

Inputs: text (required), element_id (required), clear_first.

list_navigation_elementsB

Step 1: List all available interactive elements on the page with descriptions

Inputs: url, group_by.

scroll_pageB

Scroll the page in specified direction

Inputs: direction (required), amount.

start_browserC

Start browser instance for testing

Inputs: headless.

Tool Schema Changelog

Recent tool additions, removals, and schema changes observed during successful MCP inspections.

Loading tool schema changelog…

    TDQS

    B3.4/5.0

    Scored across 14 tools

    Disambiguation4/5

    Most tools target distinct actions (navigate, input, scroll, start, etc.), and the two-step element workflow is clear. However, click_element_by_xpath and execute_atomic_action both can perform clicks, and evaluate_in_page could also replicate any action, creating minor overlap. Descriptions mostly clarify but ambiguity exists in action execution tools.

    Naming Consistency4/5

    Almost all tools follow snake_case verb_noun pattern, with verbs like extract, navigate, input, scroll, start, list, get, execute, evaluate, click. Inconsistencies: 'compare_with_screenshot' uses preposition structure, and 'batch_actions' uses a noun as verb, but overall readable and predictable.

    Tool Count5/5

    14 tools is within the ideal range for a browser automation server, covering navigation, interaction, element inspection, and performance utilities without feeling bloated.

    Completeness3/5

    The set covers navigation, interaction, element inspection, and even performance testing, but lacks a browser shutdown/close tool and explicit waiting/synchronization operations, which are common in browser automation. Core workflows are present but the lifecycle is incomplete.

    Maintenance

    ActivityInactive
    ResponsivenessOutdated data

    Related MCP Connectors

    Related MCP Servers