Node.js Sandbox

v1.0.0Developer Toolsstable

Enables running arbitrary JavaScript code in isolated Docker containers with on-demand npm dependency installation, allowing for ephemeral script execution and long-running services with controlled resource limits.

node-js-sandbox-mcp-servermcpai-integration
Share:
153
Stars
0
Downloads
0
Weekly
0/5

What is Node.js Sandbox?

Node.js Sandbox is a Model Context Protocol (MCP) server that allows AI assistants like Claude, Cursor, and VS Code to enables running arbitrary javascript code in isolated docker containers with on-demand npm dependency installation, allowing for ephemeral script execution and long-running services with controlled re...

Enables running arbitrary JavaScript code in isolated Docker containers with on-demand npm dependency installation, allowing for ephemeral script execution and long-running services with controlled resource limits.

This server falls under the Developer Tools category on MCPgee, the world's largest MCP server directory with 33,000+ servers.

Features

  • Enables running arbitrary JavaScript code in isolated Docker

Use Cases

Enables running arbitrary JavaScript code in isolated Docker containers with on-
alfonsograziano

Maintainer

LicenseMIT
Languagetypescript
Versionv1.0.0
UpdatedMay 21, 2026
Statushealthy
Maintenanceactive

Works with

ClaudeOpenAIwindowsmacoslinux

Installation

Manual Installation

npx node-js-sandbox-mcp-server

Configuration

Configuration Details

Config File

claude_desktop_config.json

Performance

Response Metrics

Response Time< 200ms
ThroughputMedium

Resource Usage

Memory UsageLow
CPU UsageLow

How to Set Up and Use Node.js Sandbox

The Node.js Sandbox MCP server lets AI assistants execute arbitrary JavaScript in ephemeral Docker containers, safely isolated from the host system. It supports on-demand npm dependency installation, persistent sandbox sessions for stateful workflows, file output, and even headless browser automation via Playwright — giving Claude a fully functional Node.js runtime environment to run, test, and iterate on code on your behalf.

Prerequisites

  • Docker installed and running on the host machine
  • Node.js 18 or higher (for npx-based launch)
  • Docker socket accessible at /var/run/docker.sock
  • An MCP-compatible client such as Claude Desktop or Cursor
  • Optionally pre-pull the node:lts-slim Docker image to avoid first-run delays
1

Install and start Docker

Docker is required for container isolation. Install Docker Desktop (macOS/Windows) or Docker Engine (Linux) and confirm the daemon is running.

docker info
2

Pre-pull the default sandbox image (optional but recommended)

Pulling the base image in advance prevents timeout issues when Claude first runs code.

docker pull node:lts-slim
3

Create an output directory

The sandbox writes generated files (charts, QR codes, etc.) to a host directory mounted into the container. Create it before configuring the server.

mkdir -p ~/Desktop/sandbox-output
4

Add the server to your MCP client configuration

Edit your claude_desktop_config.json to add the node-code-sandbox-mcp entry. The FILES_DIR env var points to the output directory you created, and the resource limits control container CPU and memory.

5

Restart your MCP client

Save the config and restart Claude Desktop. The server exposes six tools: run_js_ephemeral, sandbox_initialize, sandbox_exec, run_js, sandbox_stop, and search_npm_packages.

Node.js Sandbox Examples

Client configuration

NPX-based configuration for Claude Desktop. Adjust FILES_DIR to match your output directory path.

{
  "mcpServers": {
    "node-code-sandbox-mcp": {
      "type": "stdio",
      "command": "npx",
      "args": ["-y", "node-code-sandbox-mcp"],
      "env": {
        "FILES_DIR": "/Users/yourname/Desktop/sandbox-output",
        "SANDBOX_MEMORY_LIMIT": "512m",
        "SANDBOX_CPU_LIMIT": "0.75"
      }
    }
  }
}

Prompts to try

Use these prompts to run JavaScript code through Claude with the sandbox server active.

- "Run a JavaScript script that fetches the top 5 posts from the Hacker News API and prints their titles."
- "Install the 'sharp' npm package and create a thumbnail of this image at 200x200 pixels, saving it to the output folder."
- "Generate a QR code for https://example.com using the qrcode package and save it as qrcode.png."
- "Start a persistent sandbox, install express, create a simple HTTP server, and check that it responds on port 3000."

Troubleshooting Node.js Sandbox

Error: Cannot connect to Docker daemon / permission denied on /var/run/docker.sock

Ensure Docker is running and your user has permission to access the Docker socket. On Linux, add your user to the docker group: 'sudo usermod -aG docker $USER' and log out/in.

Container startup is slow or times out on first use

The sandbox pulls the node:lts-slim image on first run. Pre-pull it with 'docker pull node:lts-slim' to eliminate the delay. For Playwright tasks, also pull 'mcr.microsoft.com/playwright:v1.55.0-noble'.

Generated files are not visible on the host

Ensure the FILES_DIR environment variable in your config matches the actual output directory path and that the directory exists. Files are written inside the container to /root and mirrored to FILES_DIR on the host.

Frequently Asked Questions about Node.js Sandbox

What is Node.js Sandbox?

Node.js Sandbox is a Model Context Protocol (MCP) server that enables running arbitrary javascript code in isolated docker containers with on-demand npm dependency installation, allowing for ephemeral script execution and long-running services with controlled resource limits. It connects AI assistants to external tools and data sources through a standardized interface.

How do I install Node.js Sandbox?

Follow the installation instructions on the Node.js Sandbox GitHub repository. Clone the repo, install dependencies, and add the server config to your AI client.

Which AI clients work with Node.js Sandbox?

Node.js Sandbox works with all major MCP-compatible AI clients including Claude Desktop, Claude Code, Cursor, VS Code (GitHub Copilot), Windsurf, and Cline.

Is Node.js Sandbox free to use?

Yes, Node.js Sandbox is open source and available under the MIT license. You can use it freely in both personal and commercial projects.

Browse More Developer Tools MCP Servers

Explore all developer tools servers available in the MCPgee directory. Each server includes setup guides for Claude, Cursor, and VS Code.

Quick Config Preview

{ "mcpServers": { "node-js-sandbox-mcp-server": { "command": "npx", "args": ["-y", "node-js-sandbox-mcp-server"] } } }

Add this to your claude_desktop_config.json or .cursor/mcp.json

Read the full setup guide →

Ready to use Node.js Sandbox?

Browse our complete directory of 33,000+ MCP servers, read setup guides for your editor, and start building with the Model Context Protocol.

33,000+ ServersFree & Open SourceStep-by-Step Guides