Get the FREE Ultimate OpenClaw Setup Guide →

node-code-sandbox

# 🐢🚀 Node.js Sandbox MCP ServerThis repository hosts a Node.js server that implements the Model Context Protocol (MCP) for running JavaScript in isolated Docker containers. It allows for on-the-fly npm dependency installation, making it easy to execute code safely and efficiently.

Installation
Run this command in your terminal to add the MCP server to Claude Code.
Run in terminal:
Command
claude mcp add --transport stdio mozicim-node-code-sandbox-mcp node path/to/server.js

How to use

Node Code Sandbox MCP provides a secure, JavaScript-execution sandbox designed for AI agents and LLMs to run and test JavaScript code within the Model Control Protocol (MCP) framework. It supports dynamic JavaScript execution in a sandboxed environment, allows on-demand installation of NPM packages, and exposes endpoints to execute code and manage dependencies. Once running, you can interact with the sandboxed runtime through the provided API (execute code and install package) and observe the results directly, enabling code generation, testing, and iterative development within a controlled environment.

How to install

Prerequisites:

  • Node.js (version 14 or higher) and NPM installed on your machine
  • Access to the MCP server repository (clone or download the release zip)

Installation steps:

  1. Clone the repository or download the release package
  2. Navigate to the project directory
  3. Install dependencies
  4. Start the server

Example commands:

# Clone the repository (or download the release zip and extract)
git clone https://github.com/mozicim/node-code-sandbox-mcp
cd node-code-sandbox-mcp

# Install dependencies
npm install

# Start the server
npm start

Once the server starts, it will expose endpoints (e.g., /execute and /install) to run JavaScript code and install NPM packages within the sandbox.

Additional notes

Notes and tips:

  • The sandbox isolates code execution for security; avoid relying on global state across executions.
  • Use the /install endpoint to bring in Node.js packages as needed within the sandbox but be mindful of resource usage and possible package size limits.
  • Ensure your environment exposes the expected port (commonly 3000) and that firewall rules allow access to the MCP endpoints.
  • If you encounter issues with npm install inside the sandbox, check that the package.json (if present) is valid and that network access to npm registry is allowed by the sandbox policy.
  • Regularly update the sandbox and dependencies to incorporate security patches and feature improvements.

Related MCP Servers

Sponsor this space

Reach thousands of developers