MCP Operator

MCP Operator

A web browser automation server that allows AI assistants to control Chrome with persistent state management, enabling complex browsing tasks through asynchronous browser operations.

Category
Visit Server

README

MCP Browser Operator

A Model Control Protocol (MCP) server for browser automation that enables LLMs to control a web browser, interact with web pages, and analyze web content through a standardized JSON-RPC interface.

Features

  • Browser Management: Create, navigate, operate, and close browser instances
  • Job Management: Track status of browser operations with job IDs
  • Web Interaction: Execute natural language instructions using OpenAI's Computer Use API
  • Browser Tools: Access console logs, network activity, screenshots, and more
  • Auditing: Run accessibility, performance, SEO, and other web page audits

Requirements

  • Python 3.11+
  • Playwright
  • OpenAI API key (for the Computer Use API)

Installation

  1. Clone this repository:

    git clone https://github.com/yourusername/operator-mcp.git
    cd operator-mcp
    
  2. Install dependencies:

    pip install -e .
    
  3. Install Playwright browsers:

    playwright install chromium
    
  4. Set your OpenAI API key:

    export OPENAI_API_KEY=your-api-key
    

Usage

Start the MCP server:

./run-server

The server listens for JSON-RPC requests on stdin and responds on stdout, following the MCP protocol.

Executable Scripts

  • run-server - Runs the MCP server (main entry point)

    # Run the MCP server
    ./run-server
    
    # Run with specific log directory
    ./run-server --log-dir /path/to/logs
    
    # Run in debug mode
    ./run-server --debug
    
  • run-tests - Runs all tests (with options for unit or integration only)

    # Run all tests
    ./run-tests
    
    # Run only unit tests (faster)
    ./run-tests --unit-only
    
    # Run only integration tests
    ./run-tests --integration-only
    
    # Run with verbose output
    ./run-tests --verbose
    
    # Run a specific test
    ./run-tests --test TestBrowserOperatorMethods
    
  • run-test-harness - Runs the server with MCP Inspector for interactive testing

    # Run with the MCP Inspector for interactive testing
    ./run-test-harness
    

Core Methods

Browser Management

  • Create Browser: Initialize a new browser instance

    {
      "jsonrpc": "2.0",
      "id": 1,
      "method": "mcp__browser-operator__create-browser",
      "params": {
        "project_name": "my-project"
      }
    }
    
  • Navigate Browser: Direct the browser to a specified URL

    {
      "jsonrpc": "2.0",
      "id": 2,
      "method": "mcp__browser-operator__navigate-browser",
      "params": {
        "project_name": "my-project",
        "url": "https://example.com"
      }
    }
    
  • Operate Browser: Execute natural language instructions for browser interaction

    {
      "jsonrpc": "2.0",
      "id": 3,
      "method": "mcp__browser-operator__operate-browser",
      "params": {
        "project_name": "my-project",
        "instruction": "Find the heading on this page and tell me what it says."
      }
    }
    
  • Close Browser: Terminate a browser instance

    {
      "jsonrpc": "2.0",
      "id": 4,
      "method": "mcp__browser-operator__close-browser",
      "params": {
        "project_name": "my-project"
      }
    }
    

Job Management

  • Get Job Status: Retrieve the status and result of an operation by job ID

    {
      "jsonrpc": "2.0",
      "id": 5,
      "method": "mcp__browser-operator__get-job-status",
      "params": {
        "job_id": "job-12345"
      }
    }
    
  • List Jobs: View recent browser operation jobs

    {
      "jsonrpc": "2.0",
      "id": 6,
      "method": "mcp__browser-operator__list-jobs",
      "params": {
        "limit": 10
      }
    }
    

User Notes

  • Add Note: Create and store notes related to browser operations
    {
      "jsonrpc": "2.0",
      "id": 7,
      "method": "mcp__browser-operator__add-note",
      "params": {
        "name": "My Note",
        "content": "Important information about this browser session"
      }
    }
    

Additional Methods

Browser Debugging Tools

  • Get Console Logs: mcp__browser-tools__getConsoleLogs
  • Get Console Errors: mcp__browser-tools__getConsoleErrors
  • Get Network Logs: mcp__browser-tools__getNetworkLogs
  • Get Network Errors: mcp__browser-tools__getNetworkErrors
  • Take Screenshot: mcp__browser-tools__takeScreenshot
  • Get Selected Element: mcp__browser-tools__getSelectedElement
  • Wipe Logs: mcp__browser-tools__wipeLogs

Audit Tools

  • Run Accessibility Audit: mcp__browser-tools__runAccessibilityAudit
  • Run Performance Audit: mcp__browser-tools__runPerformanceAudit
  • Run SEO Audit: mcp__browser-tools__runSEOAudit
  • Run NextJS Audit: mcp__browser-tools__runNextJSAudit
  • Run Best Practices Audit: mcp__browser-tools__runBestPracticesAudit
  • Run Debugger Mode: mcp__browser-tools__runDebuggerMode
  • Run Audit Mode: mcp__browser-tools__runAuditMode

Asynchronous Workflow Pattern

Browser operations are asynchronous and use a job-based approach:

  1. Start Operation: Call a browser method which returns a job_id
  2. Poll for Completion: Use get-job-status until job is completed
  3. Process Results: When job completes, access results from the job status

This approach prevents client timeouts while allowing complex browser operations to complete.

Persistent Browser State

The MCP Operator maintains persistent state when browsers are created with a project name:

  • Browser state (cookies, local storage, session storage) is preserved between sessions
  • Multiple projects can maintain independent browser states
  • Useful for maintaining login sessions, shopping carts, or other personalized state

Project Structure

  • src/mcp_operator/: Main package
    • __init__.py: Package initialization
    • __main__.py: Entry point for package
    • server.py: MCP server implementation
    • browser.py: Browser operator implementation
    • cua/: Computer Use API components
      • agent.py: Agent implementation
      • computer.py: Computer interface
      • utils.py: Utility functions
  • run-server: Script to run the MCP server
  • run-tests: Script to run unit and integration tests
  • run-test-harness: Script to run with MCP Inspector

Development

Using MCP Inspector

For debugging, use the MCP Inspector:

# Use the included run-test-harness script
./run-test-harness

# Or directly:
npx @modelcontextprotocol/inspector ./run-server

This provides a web interface to test your MCP server.

Security

  • Domain blocking for potentially harmful sites
  • URL validation before navigation
  • Session isolation between different browser instances
  • File-based logging (no stdout to preserve MCP protocol)

Recommended Servers

playwright-mcp

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.

Official
Featured
TypeScript
Magic Component Platform (MCP)

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.

Official
Featured
Local
TypeScript
Audiense Insights MCP Server

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.

Official
Featured
Local
TypeScript
VeyraX MCP

VeyraX MCP

Single MCP tool to connect all your favorite tools: Gmail, Calendar and 40 more.

Official
Featured
Local
graphlit-mcp-server

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.

Official
Featured
TypeScript
Kagi MCP Server

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.

Official
Featured
Python
E2B

E2B

Using MCP to run code via e2b.

Official
Featured
Neon Database

Neon Database

MCP server for interacting with Neon Management API and databases

Official
Featured
Exa Search

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.

Official
Featured
Qdrant Server

Qdrant Server

This repository is an example of how to create a MCP server for Qdrant, a vector search engine.

Official
Featured