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.
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:
- Clone the repository or download the release package
- Navigate to the project directory
- Install dependencies
- 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
ipybox
Python code execution sandbox with programmatic MCP tool calling (PTC)
browserai
A powerful Model Context Protocol (MCP) server that provides an access to serverless browser for AI agents and apps
midnight
Midnight MCP server giving AI assistants access to Midnight blockchain — search contracts, analyze code, explore docs
CyberSecurity s
Model Context Protocol Server For Cyber Security
pega-dx
Pega DX MCP Server - Enabling conversational interaction with Pega Infinity™ applications. This MCP Server transforms Pega Infinity™ interactions into intuitive, conversational experiences through the Model Context Protocol.
WAIaaS
Wallet-as-a-Service for all AI agents in the world