Follow these steps to run the MCP Node code sandbox server and tools via Meshagent in the cloud.

1. Install Meshagent Python package

pip install "meshagent[all]"

2. Sign up and authenticate

Follow Meshagent CLI Getting Started to create an account and authenticate:

meshagent login

3. Start an MCP Code Sandbox MCP server in a Meshagent room

meshagent service test \
  --room=test \
  --role=agent \
  --image=meshagent/mcp-node-code-sandbox:latest \
  --env MESHAGENT_PORT=8001 \
  --port="num=8001 path=/webhook liveness=/ type=meshagent.callable" \
  --name=mcp-node-code-sandbox-service
  • This starts a Meshagent Room named test with the MCP server available in the room.
  • Rooms close automatically if inactive.

4. Join the room with a chatbot agent and tool

meshagent chatbot join \
  --room=test \
  --agent-name=sample \
  --name=sample \
  --toolkit=mcp-node-code-sandbox
  • This launches a chatbot in the Meshagent Room that can use the Node.js code sandbox toolkit.
  • Multiple toolkits can be loaded for the same agent in a room.
  • A room link will be shown in the output, which you can use to interact with the agent and its tools.

Tools Available

Below are the tools provided by the MCP Node.js code sandbox server, as available through Meshagent:

Tool NameSummary
get_dependency_typesGiven 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.
run_jsInstall npm dependencies and run JavaScript code inside a running sandbox container.
run_js_ephemeralRun a JavaScript snippet in a temporary disposable container with optional npm dependencies, then automatically clean up.
sandbox_execExecute one or more shell commands inside a running sandbox container.
sandbox_initializeStart a new isolated Docker container running Node.js.
sandbox_stopTerminate and remove a running sandbox container.

Tool Details

get_dependency_types

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 to inspect APIs and types exposed by dependencies before running Node.js scripts.

ParameterTypeDescription
dependenciesarrayArray of npm package names/versions

run_js

Install npm dependencies and run JavaScript code inside a running sandbox container.
Manual container stop required to free resources. Code must use ESModules (import/export syntax). Useful for complex workflows with environment reuse.

Use the ./files directory for persistent read/write operations.

ParameterTypeDescription
codestringJavaScript code to run inside the container.
container_idstringDocker container identifier.
dependenciesarray*Optional list of npm dependencies with name and version.
listenOnPortnumber*Optional: Expose container process on this port.

run_js_ephemeral

Run JS code in a temporary container with optional dependencies, then auto-cleanup.
Use ESModules, best for single-use execution; all file IO should happen in ./files.

Example:

import fs from "fs/promises";
await fs.writeFile("./files/hello.txt", "Hello world!");
console.log("Saved ./files/hello.txt");
ParameterTypeDescription
codestringJavaScript code to run ephemerally.
dependenciesarray*Optional npm dependencies (name/version).
imagestring*Optional Docker image for execution. E.g. node:lts-slim, mcr.microsoft.com/playwright, etc.

sandbox_exec

Execute one or more shell commands within a running Node.js sandbox container.

ParameterTypeDescription
commandsarrayCommands to execute.
container_idstringTarget container ID.

sandbox_initialize

Start a new isolated Docker container running Node.js.

ParameterTypeDescription
imagestring*Optional base image.
portnumber*Optional port mapping.

sandbox_stop

Terminate and remove a running sandbox container.
Call after finishing work in a sandbox.

ParameterTypeDescription
container_idstringID of the container