Node Code Sandbox MCP Server

Run arbitrary JavaScript inside disposable Docker containers and install npm dependencies on the fly.

Local serverstdio

What is the Node Code Sandbox MCP MCP server?

Connect Node Code Sandbox MCP to Claude, Cursor or any other MCP client and it stops being a tab you switch to. Run arbitrary JavaScript inside disposable Docker containers and install npm dependencies on the fly. The node code sandbox mcp mcp server is what makes that connection.

What the server does

Node.js server implementing the Model Context Protocol (MCP) for running arbitrary JavaScript in ephemeral Docker containers with on‑the‑fly npm dependency installation.

  • Start and manage isolated Node.js sandbox containers
  • Execute arbitrary shell commands inside containers
  • Install specified npm dependencies per job
  • Run ES module JavaScript snippets and capture stdout
  • Tear down containers cleanly
  • Detached Mode: — Keep the container alive after script execution (e.g. for long-running servers)

Available tools

The toolset is worth reading before you wire it up, because it tells you what the integration is really for:

  • Session — based tools** (sandbox_initialize ➔ run_js ➔ sandbox_stop) are ideal when you want to:
  • One — shot execution** with run_js_ephemeral is perfect for:
  • run_js_ephemeral — Run a one-off JS script in a brand-new disposable container
  • sandbox_initialize — The sandbox_initialize tool exposed by this server
  • sandbox_exec — The sandbox_exec tool exposed by this server
  • run_js — The run_js tool exposed by this server
  • sandbox_stop — The sandbox_stop tool exposed by this server
  • search_npm_packages — Search for npm packages by a search term and get their name, description, and a README snippet

Installation

npm on npm is all you need. Most clients run it directly, so configuration is a few lines and a restart.

Credentials and setup notes

Configuration is passed through the environment: FILES_DIR, SANDBOX_MEMORY_LIMIT, SANDBOX_CPU_LIMIT. Treat anything key-shaped as a real credential — scope it to the minimum the server needs, and rotate it if it ever lands in a shared config.

Where it fits

Among the cloud and infrastructure options, the useful question is rarely "what can it do" but "what does it cost you to run" — permissions, credentials, and how much of your context its toolset consumes. Node Code Sandbox MCP's toolset — Session, One, run_js_ephemeral and 5 more — is a fair guide to whether it matches your workflow. It is maintained by alfonsograziano; worth a glance at recent repository activity before you build anything load-bearing on it.

SyncDev reviews every entry in this directory against the project's own documentation before publishing, and revisits them as servers change.

Worth knowing first

  • It runs with your machine's permissions. That is convenient and also the reason to think about what you point it at before you approve a tool call.
  • Keep per-call confirmation enabled while you learn its behaviour; it is the cheapest safeguard you have.

Available tools

ToolWhat it does
Sessionbased tools** (sandbox_initialize ➔ run_js ➔ sandbox_stop) are ideal when you want to:
Oneshot execution** with run_js_ephemeral is perfect for:
run_js_ephemeralRun a one-off JS script in a brand-new disposable container.
sandbox_initializeThe sandbox_initialize tool exposed by this server.
sandbox_execThe sandbox_exec tool exposed by this server.
run_jsThe run_js tool exposed by this server.
sandbox_stopThe sandbox_stop tool exposed by this server.
search_npm_packagesSearch for npm packages by a search term and get their name, description, and a README snippet.

How to install the Node Code Sandbox MCP MCP server

or with NPX:

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

Configuration as documented by the project. Restart the client after saving.

Configuration

VariableDescriptionRequired
FILES_DIRFilesystem location the server is allowed to use.Optional
SANDBOX_MEMORY_LIMITConfiguration value read at startup.Optional
SANDBOX_CPU_LIMITConfiguration value read at startup.Optional

Example prompts to try

  • Use Node Code Sandbox MCP to Session.
  • Use Node Code Sandbox MCP to One.
  • Use Node Code Sandbox MCP to run js ephemeral.

Frequently asked questions

It connects Node Code Sandbox MCP to MCP-compatible AI assistants such as Claude and Cursor, exposing 8 tools (Session, One, run_js_ephemeral, and more) that the assistant can call on your behalf. Instead of copying data back and forth by hand, the assistant works with Node Code Sandbox MCP directly.