Node.js Sandbox
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.
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
Maintainer
Works with
Installation
Manual Installation
npx node-js-sandbox-mcp-serverConfiguration
Configuration Details
claude_desktop_config.json
Performance
Response Metrics
Resource Usage
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
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 infoPre-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-slimCreate 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-outputAdd 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.
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.
Node.js Sandbox Alternatives — Similar Developer Tools Servers
Looking for alternatives to Node.js Sandbox? Here are other popular developer tools servers you can use with Claude, Cursor, and VS Code.
Ecc
★ 188.2kThe agent harness performance optimization system. Skills, instincts, memory, security, and research-first development for Claude Code, Codex, Opencode, Cursor and beyond.
Javaguide
★ 155.8kJava 面试 & 后端通用面试指南,覆盖计算机基础、数据库、分布式、高并发、系统设计与 AI 应用开发
Gemini CLI
★ 104.5kA secure MCP server that wraps the Google Gemini CLI, allowing clients to query Gemini models using local OAuth sessions without requiring an API key. It provides tools for model interaction and diagnostics with built-in protection against command in
Awesome MCP Servers
★ 87.3k⭐ Curated list of Model Context Protocol (MCP) servers - tools that extend Claude Desktop, Cursor, Windsurf, and other MCP clients with custom capabilities.
MCP Servers
★ 86.0kModel Context Protocol Servers
CC Switch
★ 77.5kA cross-platform desktop All-in-One assistant for Claude Code, Codex, OpenCode, OpenClaw, Gemini CLI & Hermes Agent. Only official website: ccswitch.io
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.
Set Up Node.js Sandbox in Your Editor
Choose your AI client for step-by-step setup instructions.
Quick Config Preview
Add this to your claude_desktop_config.json or .cursor/mcp.json
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.