Required Environment Variables
302AI_API_KEY
: Your API key for accessing the 302 Sandbox MCP Server.
Step-by-step
-
Install Meshagent and Required Extras
- Sign Up and Authenticate See: Meshagent CLI: Getting Started
-
Start MCP Test Service in a Room
- This launches a test MCP server inside a Room named
test
. If the Room goes inactive, everything is automatically removed.
- This launches a test MCP server inside a Room named
-
Join Room with a 302 Sandbox Chatbot
- This brings in a chatbot to the Room that can use the full 302_sandbox toolkit. You can add additional toolkits as needed.
- Meshagent CLI will output a clickable room link.
-
Try it Out
- Visit the Room link in your browser and send messages to interact with 302 Sandbox MCP Server tools!
Project-Level Deployment (Persistent Room Services)
Want the MCP server and chatbot auto-available in all project rooms? Register them once as persistent services:-
Create Persistent MCP Server Service
-
Create Persistent Chatbot Service
Tools Available
Summary
Tools provided by this Server | Short Description |
---|---|
createSandbox | Create a Linux sandbox that can execute code, run commands, upload and download files, and has complete Linux functionality. |
directRunCode | Automatically creates a sandbox, executes code, and immediately destroys the sandbox after execution. |
downloadSandboxFiles | Export files from a sandbox directory or file path to downloadable URLs. |
killSandbox | Destroy a sandbox by its ID. |
listSandboxFiles | List files and directories at specified paths within a sandbox. |
listSandboxes | Query the list of sandboxes associated with the current API key. |
runCode | Run code on a specific sandbox. |
runCommand | Run a command line command on a specific Linux sandbox. |
writeSandboxFiles | Import files from public URLs or base64 data into a sandbox. |
Tool Details
createSandbox
Create a Linux sandbox that can execute code, run commands, upload and download files, and has complete Linux functionality. After successful creation, a sandbox_id
will be returned for subsequent operations. The sandbox automatically pauses after creation and between operations to minimize cost.
Parameters:
max_alive_time
(integer
): Maximum alive time in seconds (recommended: 300)envs
(object
, optional): Environment variablesmetadata
(object
, optional): Sandbox metadatasandbox_name
(string
, optional): Custom sandbox name
directRunCode
Automatically create a sandbox, execute code, and destroy the sandbox after execution. Optionally exports sandbox files.
Parameters:
code
(string
): Code to executelanguage
(string
): Programming language (default: Python)envs
(object
, optional): Custom environment variablesis_download
(boolean
, optional): Download generated files flagtimeout
(number
, optional): Max execution time in seconds (default: 5)
downloadSandboxFiles
Export files from a sandbox directory or file path to downloadable URLs. Batch export supported.
Parameters:
path
(string
): Path(s) to exportsandbox_id
(string
): Sandbox ID
killSandbox
Destroy a sandbox by its ID.
Parameters:
sandbox_id
(string
): Sandbox ID
listSandboxFiles
List files and directories at specified paths within a sandbox.
Parameters:
path
(string
)sandbox_id
(string
): Sandbox ID
listSandboxes
Query the list of sandboxes associated with the current API key.
Parameters:
sandbox_id
(string
, optional): Filter by sandbox IDsandbox_name
(string
, optional): Filter by sandbox name
runCode
Run code on a specific sandbox and return output.
Parameters:
code
(string
): Code to runsandbox_id
(string
): Sandbox IDenvs
(object
, optional): Environment variableslanguage
(string
, optional): Programming language (default: Python)timeout
(integer
, optional): Timeout in seconds
runCommand
Run a shell command on a specific sandbox.
Parameters:
cmd
(string
): The command to runsandbox_id
(string
): Sandbox IDenvs
(object
, optional): Environment variablestimeout
(integer
, optional): Timeout in seconds (suggest >120 for installs, etc.)
writeSandboxFiles
Import files from public URLs or base64 data into a sandbox (supports batch).
Parameters:
file_list
(array
): Files to importsandbox_id
(string
): Sandbox ID