Node Code Sandbox MCP logo

Node Code Sandbox MCP

by alfonsograziano

Runs JavaScript in temporary Docker sandboxes with npm installs, command execution, output capture, and optional detached processes.

Install Node Code Sandbox MCP

Pick your client, then add it in one click or paste the config.

Streamable HTTP (Remote)
Server URL
https://hub.docker.com/r/mcp/node-code-sandbox

Remote servers are added in the app, not the config file: Customize → Connectors → Add custom connector, then paste this URL.

Overview

alfonsograziano/node-code-sandbox-mcp MCP server runs JavaScript inside isolated Docker containers and installs requested npm packages for each job. It supports one-off execution, persistent sandbox sessions, shell commands, stdout capture, and optional port exposure for detached processes. Use it when an MCP client needs to execute Node.js code without running it directly on the host, or when scripts need generated files returned from an ephemeral job. Docker must be installed and running, with access to the Docker socket.

Use cases

  • Run JavaScript with temporary npm dependencies
  • Generate files such as images or JSON from a script
  • Execute shell commands in an isolated container
  • Keep a Node.js process running and expose a port
  • Search npm packages before installing them

Key features

  • Ephemeral Docker-based JavaScript execution
  • On-demand npm dependency installation
  • Reusable sandbox containers
  • Shell command execution
  • Detached processes with port exposure
  • Generated file and stdout capture

Tools1

What Node Code Sandbox MCP lets your agent do. Expand a tool for its parameters.

Self-reported~6 tokens of context

Security & health

What it can reach and how reliably it runs — from our own checks, not the maintainer’s claims.

ActiveLast checked Today

Recent health check succeeded.

20/20 checks healthy over the last 79d

Adoption & maintenance

Factual signals from GitHub, npm, and our automated checks — not a rating.

GitHub stars158Stargazers on the source repository.
Last commit11mo agoMost recent push to the default branch.
Tools exposed1Callable tools this server registers over MCP.
Directory activity4 viewsConfig copies, upvotes, and views on AllMCPs.

How Node Code Sandbox MCP works

What alfonsograziano/node-code-sandbox-mcp MCP server does

The alfonsograziano/node-code-sandbox-mcp MCP server gives an MCP client a way to run JavaScript in Docker-backed Node.js environments. It can create a disposable container for a single script or maintain a container across several operations. Scripts use ES modules, can install npm dependencies specified as package-and-version pairs, and return captured standard output.

The ephemeral execution path also returns files created in the script's working directory. Image files such as PNG and JPEG files are returned as image content, while other files such as text or JSON are returned as resources. This supports tasks such as generating an artifact with a Node package and sending the result back through the tool response.

How it works

A one-shot request selects a Docker image, supplies JavaScript source, and optionally lists npm dependencies. The server creates a new container, writes an entry script and minimal package metadata, installs the requested packages, runs the code, captures stdout, and removes the container afterward.

For longer workflows, sandbox_initialize creates a container and returns its ID. sandbox_exec runs one or more shell commands in that container. run_js creates a temporary workspace, installs dependencies with npm using production-only, script-disabled, audit-disabled settings, and runs the supplied ES module. A listenOnPort value changes this behavior: the process remains in the background and the selected port is exposed to the host. sandbox_stop terminates and removes the container.

The server supports resource controls through memory and CPU settings. Docker images can be selected per sandbox, with node:lts-slim used by default. A port can be mapped when initializing a sandbox.

Setup and configuration

Docker must be installed and running before the alfonsograziano/node-code-sandbox-mcp MCP server can execute jobs. The documented NPX configuration runs node-code-sandbox-mcp with npx -y. A Docker-based MCP configuration instead runs the mcp/node-code-sandbox image and mounts /var/run/docker.sock so the server can create child containers.

FILES_DIR can identify a host directory for generated files. The directory is mounted into the server container in the Docker configuration examples. SANDBOX_MEMORY_LIMIT and SANDBOX_CPU_LIMIT configure optional container resource limits. Pre-pulling the images used for jobs can reduce first-run delays.

Tools and capabilities

  • run_js_ephemeral: execute JavaScript in a new disposable container and receive stdout plus files created by the script.
  • sandbox_initialize: start a reusable sandbox and return its container ID.
  • sandbox_exec: execute shell commands in an existing sandbox.
  • run_js: install selected npm packages and run JavaScript in an existing sandbox, with optional detached mode and port exposure.
  • sandbox_stop: stop and remove a sandbox by container ID.

Limitations and notes

The server depends on Docker and requires access to the Docker socket when it is itself run in a container. Dependency installation occurs during execution, so network access and npm availability affect jobs that request packages. Detached processes are not cleaned up with the temporary workspace; callers should stop the associated container when it is no longer needed.

Reviews

No reviews yet — be the first to share how it worked for you.

Frequently Asked Questions about Node Code Sandbox MCP

Use the documented NPX configuration with `npx -y node-code-sandbox-mcp`, or run the Docker image configuration. Docker must be installed and running.

Yes. The README provides Claude Desktop configuration examples using either NPX or the `mcp/node-code-sandbox` Docker image.

Yes. Pass dependency objects containing an npm package name and version to `run_js_ephemeral` or `run_js`.

Files saved during an ephemeral run are returned automatically. Images are returned as image content, and other files are returned as resources.

Yes. Docker must be installed and running, and containerized deployments need access to the Docker socket.

Related MCP servers

Add a badge to your READMEShow it’s listed — live SVG, Markdown or HTML.

AllMCPs Directory Badge

Full Badge Customizer

Showcase your server listing on GitHub or your project documentation. Embed this dynamic SVG badge to highlight official listing status and live engagement.

Badge Style:
Live Dynamic SVG PreviewNode Code Sandbox MCP AllMCPs Directory Badge
Markdown (GitHub README)
[![AllMCPs](https://allmcps.com/api/badge/alfonsograziano-node-code-sandbox-mcp?style=directory)](https://allmcps.com/mcp/alfonsograziano-node-code-sandbox-mcp)
HTML Embed
<a href="https://allmcps.com/mcp/alfonsograziano-node-code-sandbox-mcp"><img src="https://allmcps.com/api/badge/alfonsograziano-node-code-sandbox-mcp?style=directory" alt="Node Code Sandbox MCP on AllMCPs" /></a>