mcp-registry/node-code-sandbox-mcp

    ==================
      
       /// MCP ///
      /// NOD ///
        
    ==================
        
    [server:online]
    [protocol:ready]

node-code-sandbox-mcp

by alfonsograziano

Node.js Model Context Protocol (MCP) server that launches disposable Docker containers to run arbitrary JavaScript with on-the-fly npm dependency installation.

81
14
Open Source

01

run_js_ephemeral

Run a one-off JavaScript script in a brand-new disposable Docker container, optionally installing npm dependencies, and return stdout plus any files generated by the script.

02

sandbox_initialize

Start a fresh, long-lived sandbox container (optionally specifying image and port) and return its container ID.

03

sandbox_exec

Execute one or more shell commands inside an existing sandbox container and return the combined stdout.

04

run_js

Within an existing sandbox container, install specified npm dependencies and execute JavaScript code (supports detached mode via listenOnPort); returns the script output or a background-running notice.

05

sandbox_stop

Terminate and remove a sandbox container identified by its container ID, returning a confirmation message.

06

search_npm_packages

Search the npm registry for packages matching a term and optional qualifiers, returning details for up to five packages (name, description, README snippet).

Installation

1. Prerequisites
• Docker ≥ 20.10 running locally or reachable via DOCKER_HOST.
• Node.js ≥ 18 and npm (or pnpm/yarn) installed.
2. Clone the repository
git clone https://github.com/alfonsograziano/node-code-sandbox-mcp.git cd node-code-sandbox-mcp
3. Install JavaScript/TypeScript dependencies
npm install # or: pnpm install / yarn install
4. Build the TypeScript sources (if not using ts-node)
npm run build # outputs to /dist # During development you can use: npm run dev # nodemon + ts-node
5. Environment configuration (create .env)
# Maximum execution time (ms) for each sandbox run SANDBOX_TIMEOUT=8000 # Memory limit for the container (e.g., 128m) SANDBOX_MEMORY=128m # Docker socket or remote host (defaults to local /var/run/docker.sock) DOCKER_HOST= # Optional: port on which the MCP server will listen PORT=8080
6. Start the MCP server
# Production (compiled JS in /dist) node dist/index.js # or, if using ts-node directly npm run start
7. Verify
curl -X POST http://localhost:8080/mcp/v1/execute -d '{"code":"console.log(123)"}' -H "Content-Type: application/json"

Documentation

License: Unspecified – no license information found in repository metadata or files.
Updated 7/30/2025