Skip to main content
Glama

Node.js Sandbox MCP Server

run_js

Execute JavaScript code with npm dependencies in an isolated Docker sandbox, supporting persistent file operations and optional port exposure for long-running services.

Instructions

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.

Input Schema

NameRequiredDescriptionDefault
codeYesJavaScript code to run inside the container.
container_idYesDocker container identifier
dependenciesNoA list of npm dependencies to install before running the code. Each item must have a `name` (package) and `version` (range). If none, returns an empty array.
listenOnPortNoIf set, leaves the process running and exposes this port to the host.

Input Schema (JSON Schema)

{ "$schema": "http://json-schema.org/draft-07/schema#", "additionalProperties": false, "properties": { "code": { "description": "JavaScript code to run inside the container.", "type": "string" }, "container_id": { "description": "Docker container identifier", "type": "string" }, "dependencies": { "default": [], "description": "A list of npm dependencies to install before running the code. Each item must have a `name` (package) and `version` (range). If none, returns an empty array.", "items": { "additionalProperties": false, "properties": { "name": { "description": "npm package name, e.g. lodash", "type": "string" }, "version": { "description": "npm package version range, e.g. ^4.17.21", "type": "string" } }, "required": [ "name", "version" ], "type": "object" }, "type": "array" }, "listenOnPort": { "description": "If set, leaves the process running and exposes this port to the host.", "type": "number" } }, "required": [ "container_id", "code" ], "type": "object" }

Other Tools from Node.js Sandbox MCP Server

Related Tools

    MCP directory API

    We provide all the information about MCP servers via our MCP API.

    curl -X GET 'https://glama.ai/api/mcp/v1/servers/ssdeanx/node-code-sandbox-mcp'

    If you have feedback or need assistance with the MCP directory API, please join our Discord server