Cover image
Try Now
2025-03-23

这是MCP服务器的参考设计,该网页托管了通过SSE连接回服务器的网页,并允许Claude在页面上执行JavaScript。

3 years

Works with Finder

1

Github Watches

1

Github Forks

0

Github Stars

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:

  1. Web Server (web_server.py):

    • Handles browser connections via Server-Sent Events (SSE)
    • Provides a REST API endpoint for executing JavaScript
    • Returns results synchronously
  2. 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

  1. The MCP server starts the web server during its lifecycle initialization
  2. A browser connects to the web server via SSE
  3. When an MCP tool is called, it makes a REST API call to the web server
  4. The web server sends the JavaScript code to the browser via SSE
  5. The browser executes the code and sends the result back to the web server
  6. The web server returns the result to the MCP server
  7. 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:

  1. execute_javascript: Execute arbitrary JavaScript code in the browser
  2. add_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.

相关推荐

  • NiKole Maxwell
  • I craft unique cereal names, stories, and ridiculously cute Cereal Baby images.

  • Bora Yalcin
  • Evaluator for marketplace product descriptions, checks for relevancy and keyword stuffing.

  • Joshua Armstrong
  • Confidential guide on numerology and astrology, based of GG33 Public information

  • https://suefel.com
  • Latest advice and best practices for custom GPT development.

  • Callycode Limited
  • A geek-themed horoscope generator blending Bitcoin prices, tech jargon, and astrological whimsy.

  • Alexandru Strujac
  • Efficient thumbnail creator for YouTube videos

  • Emmet Halm
  • Converts Figma frames into front-end code for various mobile frameworks.

  • Khalid kalib
  • Write professional emails

  • Elijah Ng Shi Yi
  • Advanced software engineer GPT that excels through nailing the basics.

  • https://maiplestudio.com
  • Find Exhibitors, Speakers and more

  • Lists Tailwind CSS classes in monospaced font

  • apappascs
  • 发现市场上最全面,最新的MCP服务器集合。该存储库充当集中式枢纽,提供了广泛的开源和专有MCP服务器目录,并提供功能,文档链接和贡献者。

  • ShrimpingIt
  • MCP系列GPIO Expander的基于Micropython I2C的操作,源自ADAFRUIT_MCP230XX

  • OffchainLabs
  • 进行以太坊的实施

  • huahuayu
  • 统一的API网关,用于将多个Etherscan样区块链Explorer API与对AI助手的模型上下文协议(MCP)支持。

  • deemkeen
  • 用电源组合控制您的MBOT2:MQTT+MCP+LLM

    Reviews

    4 (1)
    Avatar
    user_68wg2nnk
    2025-04-16

    I've been using Z3 Theorem Prover with Functional Programming for several months now, and it has significantly improved my workflow. The integration of functional programming paradigms with theorem proving is seamless, enabling complex logical verifications more intuitively. Javergar has done an exceptional job in creating a tool that is both powerful and user-friendly. Highly recommended for anyone serious about functional programming and formal verification.