SuperAPI AI Directory

node-code-sandbox-mcp

Run JavaScript snippets in isolated Docker sandboxes with on-the-fly npm dependency installation and clean teardown.

Open website

About this tool

Purpose: This is a Node.js-based Model Context Protocol (MCP) server that lets clients (such as Claude Desktop, VS Code) run arbitrary JavaScript code in isolated temporary Docker containers, suitable for scenarios requiring secure sandboxed script execution.

Main capabilities: Start and manage isolated Node.js sandbox containers; execute arbitrary shell commands inside the container; install specified npm dependencies per task; run ES module scripts and capture stdout; cleanly destroy containers; support Detached mode (keep the container after script execution, for long-running services). Container runs are subject to controlled CPU/memory limits. Provides search_npm_packages to search npm packages by keyword and return up to 5 results by popularity along with their descriptions and README snippets.

Usage: Docker must first be installed and running on the machine (it is recommended to pre-pull the required images, such as mcr.microsoft.com/playwright:v1.55.0-noble, alfonsograziano/node-chartjs-canvas:latest). After connecting it to a client, you can test: run console.log("Hello World"), or install the qrcode package to generate a QR code image and save it as qrcode.png. Configuration methods include Claude Desktop's claude_desktop_config.json, as well as VS Code's settings.json or .vscode/mcp.json (providing NPX and Docker quick installs).

Tools: run_js_ephemeral runs scripts in a brand-new disposable container, with parameters image (default node:lts-slim), code (required), dependencies; files saved by the script are automatically returned, images as image content and other files as resource content, and the file-saving feature is currently limited to this tool. sandbox_initialize starts a sandbox container, supporting image and port; followed by tools to execute shell commands in a running container, install dependencies and run JS, terminate and remove containers, and search_npm_packages. The conversational tool combination (sandbox_initialize → run_js → sandbox_stop) is suitable for keeping containers for a long time and reusing dependencies; one-off execution is suitable for quick experiments.

Limitations: Docker must be installed and running; containers have CPU/memory limits; file saving is only supported by the ephemeral tool; specific pricing, platform, and performance information is not yet provided.