- Home
- MCP servers
- Browser JavaScript Evaluator
Browser JavaScript Evaluator
- python
0
GitHub Stars
python
Language
7 months ago
First Indexed
3 months ago
Catalog Refreshed
Documentation & install
Readme and setup notes from the catalogue, plus a client-ready config you can copy for your MCP host.
Installation
Add the following to your MCP client configuration file.
Configuration
View docs{
"mcpServers": {
"matdmiller-mcp_py_sse_browser_control": {
"command": "uv",
"args": [
"--directory",
"/path/to/this/repo/mcp_py_sse_browser_control",
"run",
"browser_server.py"
]
}
}
}You can run JavaScript in a browser from an MCP client using the Browser JavaScript Evaluator. This server pair lets you send code to the browser, execute it there, and return the results to your MCP workflows for dynamic, browser-based computations.
How to use
You will run the MCP server alongside a small web server that streams code to connected browsers. From any MCP client, call the provided tools to execute JavaScript in the browser and receive the results synchronously. The browser connects to the web server via a browser-accessible URL, and your MCP calls trigger code delivery and result delivery end-to-end.
Practical usage patterns include evaluating short JavaScript expressions, performing calculations in the browser, or leveraging browser APIs within an MCP workflow. To start, ensure the MCP server is running and a browser has connected to the web server. Then call the available tools to run JavaScript in that connected browser and obtain the result for your next steps.
When you call a tool, the system sends the JavaScript you specify to the connected browser. The browser runs the code and sends the output back, allowing your MCP client to proceed with the returned value. You can use this to offload browser-specific logic or leverage the browser environment for computations that benefit from client-side execution.
How to install
Prerequisites: you need Python installed on your machine. A browser will connect to the web server once it is running.
-
Place the Browser JavaScript Evaluator code where you want to run it and prepare the web server alongside the MCP setup.
-
Add the MCP server to your client configuration with the following entry (as an example). The MCP runner will start the web server and expose a command you can use to run it.
{
"browser-js-evaluator": {
"command": "uv",
"args": [
"--directory",
"/path/to/this/repo/mcp_py_sse_browser_control",
"run",
"browser_server.py"
]
}
}
Additional notes
After you start the MCP server using the configuration above, open a browser and navigate to http://127.0.0.1:8000 to connect to the web server. This establishes the SSE channel through which the browser will receive JavaScript and return results.
Development
If you want to run the web server independently of the MCP integration for testing, you can start it with Python directly. This starts only the web server and bypasses the MCP lifecycle integration.
Available tools
execute_javascript
Execute arbitrary JavaScript code in the connected browser and return the result to the MCP caller.
add_numbers
Add two numbers together by running JavaScript in the browser and return the sum to the MCP caller.