# node-code-sandbox-mcp

> node-code-sandbox-mcp is an open-source MCP server for developer tools. MCP server that runs JavaScript and shell commands in disposable Docker sandboxes for AI. It is available on API, CLI, Linux, macOS, Windows, VS Code and Self-hosted.

- **Kind:** MCP server
- **Pricing:** Open source
- **Platforms:** API, CLI, Linux, macOS, Windows, VS Code, Self-hosted
- **Repository:** https://github.com/alfonsograziano/node-code-sandbox-mcp
- **GitHub stars:** 156
- **Categories:** [developer tools](https://ai-powered.com/categories/developer-tools)
- **Listing updated:** 2026-12-01

## About

Gives an AI assistant a place to execute Node.js code without touching the host machine. Each run happens in a throwaway Docker container, with npm packages installed on demand before the script starts. Output from the script is returned to the client, and files the script writes can be sent back as images or resources.

Two workflows are offered. A one-shot tool creates a fresh container, runs a snippet, and removes the container afterward. A session workflow keeps one container alive so several commands and scripts can share installed dependencies. A detached option leaves a process running in the container, which is useful for testing a small server or endpoint that the host can reach through a mapped port.

The server is aimed at developers and people who connect MCP clients such as Claude Desktop or VS Code to Docker and want the model to test code, generate artifacts like charts or QR codes, or check npm packages through an included search tool. Docker must be installed and running, and CPU and memory limits for containers can be set through environment variables.

## Features

- **Disposable Docker containers:** Each one-shot run starts a fresh container that is removed once the script finishes.
- **On-demand npm installs:** Packages and version ranges are installed per job before the script executes.
- **Persistent sandbox sessions:** A long-lived container can be reused for multiple commands and scripts.
- **Detached server mode:** A script can keep running in the container and expose a chosen port to the host.
- **File output capture:** Files saved by a script are returned to the client as images or resources.
- **npm package search:** Searches the npm registry and returns name, description and a README snippet for matches.
- **Configurable resource limits:** Memory and CPU caps for containers are set through environment variables.

## Good for

- Let an assistant test a JavaScript snippet and show its console output
- Generate a chart or QR code image from a script and save it to a local folder
- Try out an npm package in an isolated environment before adding it to a project
- Spin up a temporary Express or other Node server and call its endpoints
- Run a sequence of shell and Node commands in one reusable container

## Tools

From the tool list in its README, going by the names, 4 of 6 tools change data; 1 name doesn't say. From the server's own tool labels and tool names; not verified by us.

- `run_js_ephemeral` (name suggests: changes): Runs a one-off JavaScript script in a new disposable container and returns its output and any saved files.
- `sandbox_initialize`: Starts a fresh sandbox container and returns its ID.
- `sandbox_exec` (name suggests: changes): Runs shell commands inside a running sandbox.
- `run_js` (name suggests: changes): Installs npm dependencies and executes JavaScript inside an existing sandbox.
- `sandbox_stop` (name suggests: changes): Terminates and removes a sandbox container.
- `search_npm_packages` (name suggests: reads): Searches npm packages and returns their name, description and README snippet.

## FAQ

### What must be installed to use node-code-sandbox-mcp?

Docker must be installed and running on the machine where the server runs.

### Can the server return files created by a script?

Yes. Files a script saves in its working directory are returned automatically, with images sent as image content and other files as resources. This is available in the one-shot tool.

### Which Node image does node-code-sandbox-mcp use by default?

The default image is node:lts-slim, though a different Docker image can be specified for each run.

### Can I run node-code-sandbox-mcp without the Docker image?

Yes. It can be launched with npx using the node-code-sandbox-mcp package, provided Docker is running.

### Is node-code-sandbox-mcp free?

Yes. node-code-sandbox-mcp is open source, so you can use and self-host it for free.

### What are the best alternatives to node-code-sandbox-mcp?

The closest alternatives to node-code-sandbox-mcp are Sandbox Env MCP, NEPHIS MCP Server, mcp-v8, MCP Server Commands and mcp-server-commands.

## Where this comes from

- Description: written from the project's README.

## Alternatives

- [Sandbox Env MCP](https://ai-powered.com/mcp/sandbox-env-mcp): Sandbox Env MCP is an open-source MCP server for developer tools.
- [NEPHIS MCP Server](https://ai-powered.com/mcp/nephis-mcp-server): NEPHIS MCP Server is a freemium MCP server for developer tools.
- [mcp-v8](https://ai-powered.com/mcp/mcp-v8): mcp-v8 is an open-source MCP server for developer tools.
- [MCP Server Commands](https://ai-powered.com/mcp/mcp-server-commands): MCP Server Commands is an open-source MCP server for developer tools.
- [mcp-server-commands](https://ai-powered.com/mcp/mcp-server-commands-2): mcp-server-commands is an open-source MCP server for developer tools.
- [MCP Sandbox Computer VM for AI](https://ai-powered.com/mcp/mcp-sandbox-computer-vm-for-ai): MCP Sandbox Computer VM for AI is an MCP server for developer tools.
- [Dmcps](https://ai-powered.com/mcp/dmcps): Dmcps is an open-source MCP server for security.
- [cmdshellmcp](https://ai-powered.com/mcp/cmdshellmcp): cmdshellmcp is an open-source MCP server for developer tools.

---
Source: https://ai-powered.com/mcp/node-code-sandbox-mcp
