node-code-sandbox-mcp

node-code-sandbox-mcp

60

This project establishes a Node.js server implementing MCP to execute JavaScript in Docker containers. It allows for arbitrary command execution, npm dependency management, and supports both isolated and persistent container operations.

🐢🚀 Node.js Sandbox MCP Server

Node.js server implementing the Model Context Protocol (MCP) for running arbitrary JavaScript in ephemeral Docker containers with on-the-fly npm dependency installation.

Features

  • Start and manage isolated Node.js sandbox containers
  • Execute arbitrary shell commands inside containers
  • Install specified npm dependencies per job
  • Run ES module JavaScript snippets and capture stdout
  • Tear down containers cleanly
  • Detached Mode: Keep the container alive after script execution

⚠️ Prerequisites

Docker must be installed and running on your machine.

API

run_js_ephemeral

Run a one-off JS script in a brand-new disposable container.

sandbox_initialize

Start a fresh sandbox container.

sandbox_exec

Run shell commands inside the running sandbox.

run_js

Install npm dependencies and execute JavaScript code.

sandbox_stop

Terminate and remove the sandbox container.