The MCP Browser Operator is a server implementation of the Model Control Protocol (MCP) that enables large language models to control web browsers. It provides a standardized JSON-RPC interface for browser automation, web interaction, and content analysis, allowing AI models to navigate websites, execute actions, and extract information.
Clone the repository:
git clone https://github.com/yourusername/operator-mcp.git
cd operator-mcp
Install dependencies:
pip install -e .
Install Playwright browsers:
playwright install chromium
Set your OpenAI API key:
export OPENAI_API_KEY=your-api-key
Start the MCP server using the provided script:
./run-server
The server listens for JSON-RPC requests on stdin and responds on stdout, following the MCP protocol.
# Run with specific log directory
./run-server --log-dir /path/to/logs
# Run in debug mode
./run-server --debug
# 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
For interactive testing with MCP Inspector:
./run-test-harness
Initialize a new browser instance:
{
"jsonrpc": "2.0",
"id": 1,
"method": "mcp__browser-operator__create-browser",
"params": {
"project_name": "my-project"
}
}
Direct the browser to a URL:
{
"jsonrpc": "2.0",
"id": 2,
"method": "mcp__browser-operator__navigate-browser",
"params": {
"project_name": "my-project",
"url": "https://example.com"
}
}
Execute natural language instructions:
{
"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."
}
}
Terminate a browser instance:
{
"jsonrpc": "2.0",
"id": 4,
"method": "mcp__browser-operator__close-browser",
"params": {
"project_name": "my-project"
}
}
Retrieve the status and result of an operation:
{
"jsonrpc": "2.0",
"id": 5,
"method": "mcp__browser-operator__get-job-status",
"params": {
"job_id": "job-12345"
}
}
View recent browser operation jobs:
{
"jsonrpc": "2.0",
"id": 6,
"method": "mcp__browser-operator__list-jobs",
"params": {
"limit": 10
}
}
Create and store notes about browser operations:
{
"jsonrpc": "2.0",
"id": 7,
"method": "mcp__browser-operator__add-note",
"params": {
"name": "My Note",
"content": "Important information about this browser session"
}
}
mcp__browser-tools__getConsoleLogs
mcp__browser-tools__getConsoleErrors
mcp__browser-tools__getNetworkLogs
mcp__browser-tools__getNetworkErrors
mcp__browser-tools__takeScreenshot
mcp__browser-tools__getSelectedElement
mcp__browser-tools__wipeLogs
mcp__browser-tools__runAccessibilityAudit
mcp__browser-tools__runPerformanceAudit
mcp__browser-tools__runSEOAudit
mcp__browser-tools__runNextJSAudit
mcp__browser-tools__runBestPracticesAudit
mcp__browser-tools__runDebuggerMode
mcp__browser-tools__runAuditMode
Browser operations use a job-based approach:
This approach prevents client timeouts while allowing complex browser operations to complete.
The MCP Operator maintains persistent state when browsers are created with a project name:
There are two ways to add an MCP server to Cursor. The most common way is to add the server globally in the ~/.cursor/mcp.json
file so that it is available in all of your projects.
If you only need the server in a single project, you can add it to the project instead by creating or adding it to the .cursor/mcp.json
file.
To add a global MCP server go to Cursor Settings > MCP and click "Add new global MCP server".
When you click that button the ~/.cursor/mcp.json
file will be opened and you can add your server like this:
{
"mcpServers": {
"cursor-rules-mcp": {
"command": "npx",
"args": [
"-y",
"cursor-rules-mcp"
]
}
}
}
To add an MCP server to a project you can create a new .cursor/mcp.json
file or add it to the existing one. This will look exactly the same as the global MCP server example above.
Once the server is installed, you might need to head back to Settings > MCP and click the refresh button.
The Cursor agent will then be able to see the available tools the added MCP server has available and will call them when it needs to.
You can also explictly ask the agent to use the tool by mentioning the tool name and describing what the function does.