MCP ExplorerExplorer

Javascript Sandbox Mcp

@shanejonason 19 days ago
1 MIT
FreeCommunity
AI Systems
Provides a javascript sandbox via SES (Secure Ecmascript)

Overview

What is Javascript Sandbox Mcp

javascript-sandbox-mcp is a Model Context Protocol (MCP) server that securely executes JavaScript code in a sandboxed environment using SES (Secure ECMAScript).

Use cases

Use cases include running untrusted JavaScript code safely, testing JavaScript snippets, and integrating with applications that require secure code execution.

How to use

To use javascript-sandbox-mcp, install the dependencies with ‘npm install’, build the server using ‘npm run build’, and then run it directly with ‘npm start’ or by executing the built binary with ‘node build/index.js’.

Key features

Key features include the ability to execute arbitrary JavaScript code in a secure SES compartment, returning results and console logs in JSON format.

Where to use

javascript-sandbox-mcp can be used in environments where secure execution of JavaScript code is required, such as web applications, server-side applications, and testing frameworks.

Content

JavaScript Sandbox MCP Server

A Model Context Protocol (MCP) server that executes JavaScript code securely in a sandboxed environment using SES (Secure ECMAScript).

https://github.com/user-attachments/assets/654f71e7-fb88-41ca-a6d0-634cc07fe426

Features

Tools

  • run_javascript - Execute arbitrary JavaScript code in a secure SES compartment
    • Accepts a string of JavaScript code
    • Returns the result and all console logs as JSON-formatted text

Development

Install dependencies:

npm install

Build the server:

npm run build

For development with auto-rebuild:

npm run watch

Usage

You can run the server directly:

npm start

Or use the built binary:

node build/index.js

Installation

To use with Claude Desktop, add the server config:

On MacOS: ~/Library/Application Support/Claude/claude_desktop_config.json
On Windows: %APPDATA%/Claude/claude_desktop_config.json

{
  "mcpServers": {
    "run-javascript-sandbox": {
      "command": "npx",
      "args": [
        "-y",
        "javascript-sandbox-mcp"
      ]
    }
  }
}

Debugging

Since MCP servers communicate over stdio, debugging can be challenging. We recommend using the MCP Inspector:

npm run inspector

The Inspector will provide a URL to access debugging tools in your browser.


Security Note:

This server uses SES to sandbox code execution, but running untrusted code always carries risk. Use with caution and only in trusted environments.

Tools

No tools

Comments