mcp_py_sse_browser_control
This project provides a way to execute JavaScript code in a browser from Python using MCP (Model Control Protocol).
Browser JavaScript Evaluator
This project provides a way to execute JavaScript code in a browser from Python using MCP (Model Control Protocol).
⚠️ WARNING ⚠️
This MCP server can execute arbitrary JavaScript in your browser. This can be dangerous. Be aware of the implications of this before using this plugin. Use at your own risk.
Architecture
The project is split into two main components:
-
Web Server (
web_server.py
):- Handles browser connections via Server-Sent Events (SSE)
- Provides a REST API endpoint for executing JavaScript
- Returns results synchronously
-
MCP Server (
mcp_server.py
):- Manages the lifecycle of the web server
- Provides MCP tools for executing JavaScript
- Communicates with the web server via REST API calls
How It Works
- The MCP server starts the web server during its lifecycle initialization
- A browser connects to the web server via SSE
- When an MCP tool is called, it makes a REST API call to the web server
- The web server sends the JavaScript code to the browser via SSE
- The browser executes the code and sends the result back to the web server
- The web server returns the result to the MCP server
- The MCP server returns the result to the caller
Usage
Add the MCP server to your Claude config
...
"browser-js-evaluator": {
"command": "uv",
"args": [
"--directory",
"/path/to/this/repo/mcp_py_sse_browser_control",
"run",
"browser_server.py"
]
}
}
...
When you launch Claude Desktop this will start both the MCP server and the web server. Then open a browser and navigate to http://127.0.0.1:8000 to connect to the web server.
Using the MCP Tools
The MCP server provides two tools:
execute_javascript
: Execute arbitrary JavaScript code in the browseradd_numbers
: Add two numbers together using JavaScript in the browser
These tools can be called from any MCP client.
Development
To run the web server independently (for testing):
python web_server.py
This will start only the web server without the MCP integration.
Related MCP Servers
View all browser_automation servers →Fetch
by modelcontextprotocol
A Model Context Protocol server that provides web content fetching capabilities, enabling LLMs to retrieve and process content from web pages.
markdownify-mcp
by zcaceres
Markdownify is a Model Context Protocol (MCP) server that converts various file types and web content to Markdown format.
mcp-playwright
by executeautomation
A Model Context Protocol server that provides browser automation capabilities using Playwright.
web-eval-agent
by Operative-Sh
operative.sh's MCP Server is a tool for autonomous debugging of web applications directly from your code editor.
cursor-talk-to-figma-mcp
by sonnylazuardi
This project implements a Model Context Protocol (MCP) integration between Cursor AI and Figma, allowing Cursor to communicate with Figma for reading designs and modifying them programmatically.
ai-agent-marketplace-index-mcp
by AI-Agent-Hub
MCP Server for AI Agent Marketplace Index from DeepNLP, allowing AI assistants to search available AI agents by keywords or categories.
playwright-mcp
by microsoft
Playwright MCP is a Model Context Protocol server that provides browser automation capabilities using Playwright, enabling LLMs to interact with web pages through structured accessibility snapshots.