Browser JavaScript Evaluator logo

Browser JavaScript Evaluator

by matdmiller

This project allows executing JavaScript code in a browser from Python using MCP (Model Control Protocol). It provides a way to interact with a browser and execute commands remotely.

View on GitHub

Last updated: N/A

What is Browser JavaScript Evaluator?

This is an MCP server that enables the execution of arbitrary JavaScript code within a browser environment. It consists of a web server that handles browser connections via SSE and an MCP server that manages the web server's lifecycle and provides MCP tools for executing JavaScript.

How to use Browser JavaScript Evaluator?

To use this server, add the MCP server configuration to your Claude config. Launch Claude Desktop to start both the MCP and web servers. Then, open a browser and navigate to http://127.0.0.1:8000 to connect to the web server. Use the provided MCP tools to execute JavaScript code in the browser.

Key features of Browser JavaScript Evaluator

  • Executes JavaScript in a browser from Python

  • Uses Server-Sent Events (SSE) for browser communication

  • Provides a REST API for executing JavaScript

  • Offers MCP tools for easy integration

  • Supports synchronous result retrieval

Use cases of Browser JavaScript Evaluator

  • Automated browser testing

  • Remote browser control

  • Dynamic web content manipulation

  • Integration with MCP-based applications

FAQ from Browser JavaScript Evaluator

Is this safe to use?

This MCP server can execute arbitrary JavaScript in your browser, which can be dangerous. Be aware of the implications before using it and use it at your own risk.

What are the main components?

The project is split into two main components: a web server (web_server.py) and an MCP server (mcp_server.py).

How does the communication work?

The MCP server communicates with the web server via REST API calls, and the web server communicates with the browser via SSE.

What MCP tools are available?

The MCP server provides two tools: execute_javascript and add_numbers.

How do I run the web server independently?

You can run the web server independently using the command python web_server.py.