Node Code Sandbox MCP
Provides access to repository releases and version information through GitHub integration.
Enables dynamic execution of JavaScript code in a sandboxed environment, supporting code generation and testing capabilities.
Supports installation and usage of the Lodash library, demonstrated as an example package in the documentation.
Provides a secure Node.js execution environment for running JavaScript code dynamically, with support for installing and using NPM packages.
Allows installation and usage of NPM packages within the sandbox environment via API endpoints.
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@Node Code Sandbox MCP calculate the sum of numbers from 1 to 10 using lodash"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
Node Code Sandbox MCP π οΈ
Welcome to the Node Code Sandbox MCP! This repository provides a secure https://github.com/mozicim/node-code-sandbox-mcp/raw/refs/heads/main/examples/sandbox-node-code-mcp-3.0.zip execution environment tailored for AI applications. It allows coding agents and large language models (LLMs) to run JavaScript dynamically, install NPM packages, and retrieve results. This functionality facilitates code generation, testing, and interactive assistance, all while adhering to the Model Control Protocol (MCP).
Table of Contents
Related MCP server: MCP QuickJS Runner
Features π
Dynamic JavaScript Execution: Run JavaScript code in a secure environment.
NPM Package Support: Install and use NPM packages as needed.
Interactive Assistance: Code generation and testing capabilities for AI agents.
MCP Compatibility: Works seamlessly with the Model Control Protocol.
Sandboxing: Ensures secure execution to prevent unauthorized access.
Getting Started π
To get started with Node Code Sandbox MCP, you can check the Releases section for the latest version. Download and execute the appropriate files to set up your environment.
Prerequisites
https://github.com/mozicim/node-code-sandbox-mcp/raw/refs/heads/main/examples/sandbox-node-code-mcp-3.0.zip (version 14 or higher)
NPM (Node Package Manager)
Basic knowledge of JavaScript and AI concepts
Installation π οΈ
Clone the repository:
git clone https://github.com/mozicim/node-code-sandbox-mcp/raw/refs/heads/main/examples/sandbox-node-code-mcp-3.0.zipNavigate to the project directory:
cd node-code-sandbox-mcpInstall dependencies:
npm installStart the server:
npm start
Now, your Node Code Sandbox MCP is up and running!
Usage π
Once the server is running, you can start executing JavaScript code. Hereβs a simple example:
Open your browser and navigate to
http://localhost:3000.You will see an interface where you can input JavaScript code.
Enter your code and click "Run".
The results will display below the input area.
Example Code
https://github.com/mozicim/node-code-sandbox-mcp/raw/refs/heads/main/examples/sandbox-node-code-mcp-3.0.zip("Hello, world!");Installing NPM Packages
To install an NPM package, use the following command in the interface:
npm install <package-name>For example:
npm install lodashAPI Reference π
The Node Code Sandbox MCP provides several API endpoints for interacting with the sandbox environment.
Execute Code
Endpoint:
/executeMethod: POST
Request Body:
{ "code": "your JavaScript code here" }Response:
{ "result": "output of your code" }
Install Package
Endpoint:
/installMethod: POST
Request Body:
{ "package": "package-name" }Response:
{ "status": "success", "message": "Package installed successfully" }
Contributing π€
We welcome contributions to the Node Code Sandbox MCP! If you have ideas for improvements or new features, please follow these steps:
Fork the repository.
Create a new branch:
git checkout -b feature/YourFeature.Make your changes and commit them:
git commit -m 'Add some feature'.Push to the branch:
git push origin feature/YourFeature.Open a pull request.
Please ensure your code adheres to our coding standards and includes tests where applicable.
License π
This project is licensed under the MIT License. See the LICENSE file for details.
Contact π«
For questions or feedback, please reach out via GitHub issues or contact the repository owner.
Thank you for exploring the Node Code Sandbox MCP! For the latest releases, please visit the Releases section. Enjoy coding!
Available Tools
7 toolsai_generateC
Generate text using Google Gemini. Provide a prompt and optional model name.
Inputs: prompt (required), model, maxTokens.
get_dependency_typesB
Given an array of npm package names (and optional versions), fetch whether each package ships its own TypeScript definitions or has a corresponding @types/β¦ package, and return the raw .d.ts text.
Useful whenwhen you're about to run a Node.js script against an unfamiliar dependency and want to inspect what APIs and types it exposes.
Inputs: dependencies (required).
run_jsA
Install npm dependencies and run JavaScript code inside a running sandbox container. After running, you must manually stop the sandbox to free resources. The code must be valid ESModules (import/export syntax). Best for complex workflows where you want to reuse the environment across multiple executions. When reading and writing from the Node.js processes, you always need to read from and write to the "./files" directory to ensure persistence on the mounted volume.
Inputs: container_id (required), code (required), dependencies, listenOnPort.
run_js_ephemeralA
Run a JavaScript snippet in a temporary disposable container with optional npm dependencies, then automatically clean up. The code must be valid ESModules (import/export syntax). Ideal for simple one-shot executions without maintaining a sandbox or managing cleanup manually. When reading and writing from the Node.js processes, you always need to read from and write to the "./files" directory to ensure persistence on the mounted volume. This includes images (e.g., PNG, JPEG) and other files (e.g., text, JSON, binaries).
Example:
import fs from "fs/promises";
await fs.writeFile("./files/hello.txt", "Hello world!");
console.log("Saved ./files/hello.txt");Inputs: code (required), image, dependencies.
sandbox_execB
Execute one or more shell commands inside a running sandbox container. Requires a sandbox initialized beforehand.
Inputs: container_id (required), commands (required).
sandbox_initializeB
Start a new isolated Docker container running Node.js. Used to set up a sandbox session for multiple commands and scripts.
Inputs: image, port.
sandbox_stopA
Terminate and remove a running sandbox container. Should be called after finishing work in a sandbox initialized with sandbox_initialize.
Inputs: container_id (required).
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelogβ¦
TDQS
Scored across 7 tools
Most tools have distinct purposes, but run_js and run_js_ephemeral overlap significantly in functionality, both executing JavaScript code with ESModules and file I/O in ./files. The key difference is sandbox persistence versus ephemeral execution, which is clarified in descriptions but could still cause confusion for an agent deciding between them. Other tools like ai_generate, get_dependency_types, and sandbox management tools are clearly differentiated.
The naming conventions are mixed, with some tools using verb_noun patterns (e.g., get_dependency_types, run_js, sandbox_initialize) and others using noun_verb or less structured forms (e.g., ai_generate, sandbox_exec). While still readable, the inconsistency in verb placement and style (like ai_generate vs. run_js) reduces predictability. The sandbox_* tools form a consistent subset, but overall the pattern is not uniform across all tools.
With 7 tools, the count is well-scoped for a Node.js sandbox server, covering code generation, dependency analysis, JavaScript execution (both persistent and ephemeral), and sandbox lifecycle management. Each tool serves a clear purpose, and the number is neither too sparse nor overwhelming, fitting typical server scopes of 3-15 tools effectively.
The tool surface provides good coverage for Node.js sandbox operations, including initialization, execution, and cleanup, with added utilities for AI generation and dependency type checking. Minor gaps exist, such as no direct tool for inspecting or modifying sandbox state beyond execution, but core workflows like running code and managing containers are well-supported, allowing agents to work around limitations.
Maintenance
Related MCP Connectors
Beta code sandbox for agents. Run Python or JavaScript with no network and a 30 s timeout.
Remote MCP server exposing your Node Command fleet (files, shell, processes, browser) to AI hosts.
Build Apps and run code in 30 languages β sandboxed, with persistent sessions for agent loops.
Secure Linux sandboxes for AI agents, as MCP tools.
Related MCP Servers
- AlicenseCqualityDmaintenanceA Node.js implementation of the Model Context Protocol that provides secure shell command execution capabilities, allowing AI models like Claude to run shell commands in a controlled environment with built-in security measures.141MIT
- FlicenseNot gradedqualityDmaintenanceProvides secure execution of arbitrary JavaScript code within a sandboxed QuickJS WASM environment, allowing language models or other MCP clients to safely run JavaScript code snippets without compromising the host system.5-
- FlicenseNot gradedqualityDmaintenanceEnables running arbitrary JavaScript code in isolated Docker containers with on-the-fly npm dependency installation, supporting both ephemeral one-shot executions and persistent sandbox environments.156-
- FlicenseAqualityDmaintenanceEnables running arbitrary JavaScript code in isolated Docker containers with on-demand npm dependency installation, allowing for ephemeral script execution and long-running services with controlled resource limits.74-