Sign inSign up

mcp/302_sandbox

Verified Publisher

By mcp

Updated over 1 year ago

302 Sandbox MCP

Image
Machine learning & AI
2

8.9K

mcp/302_sandbox repository overview

302 Sandbox MCP Server

302 Sandbox MCP.

What is an MCP Server?

Characteristics

AttributeDetails
Docker Imagemcp/302_sandbox
Author302ai
Repositoryhttps://github.com/302ai/302_sandbox_mcp
Dockerfilehttps://github.com/302ai/302_sandbox_mcp/blob/main/Dockerfile
Docker Image built byDocker Inc.
Docker Scout Health ScoreDocker Scout Health Score
Verify SignatureCOSIGN_REPOSITORY=mcp/signatures cosign verify mcp/302_sandbox --key https://raw.githubusercontent.com/docker/keyring/refs/heads/main/public/mcp/latest.pub
LicenceMIT License

Available Tools

Tools provided by this ServerShort Description
createSandboxCreate a Linux sandbox that can execute code, run commands, upload and download files, and has complete Linux functionality.
directRunCodeAutomatically creates a sandbox, executes code, and immediately destroys the sandbox after execution.
downloadSandboxFilesExport files from a sandbox directory or file path to downloadable urls.
killSandboxDestroy a sandbox by its ID.
listSandboxFilesList files and directories at specified paths within a sandbox.
listSandboxesQuery the list of sandboxes associated with the current API key.
runCodeRun code on a specific sandbox.
runCommandRun a command line command on a specific linux sandbox.
writeSandboxFilesImport files from public URLs or base64 data into a sandbox.

Tools Details

Tool: 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, and all subsequent operations will need to include this sandbox_id to specify the corresponding sandbox. After successful creation, the sandbox will automatically pause. When calling other sandbox operation interfaces later, it will automatically reconnect and pause again after execution to avoid generating extra costs.

ParametersTypeDescription
max_alive_timeintegerMaximum alive time of the sandbox (seconds), recommand 300.
envsobject optionalEnvironment variables to set (optional)
metadataobject optionalSandbox metadata (optional)
sandbox_namestring optionalCustom sandbox name (optional)

Tool: directRunCode

Automatically creates a sandbox, executes code, and immediately destroys the sandbox after execution. Optionally exports sandbox files (compresses multiple files into a zip archive if there are multiple files in the specified path, or exports a single file directly). Recommended for use cases that don't require continuous sandbox operations.

ParametersTypeDescription
codestringThe source code to be executed in the sandbox
languagestringThe programming language to execute the code. If not provided or if the value is not in the allowed options, it will be treated as Python code
envsobject optionalEnvironment variables to be set during code execution. Supports passing custom environment variables as key-value pairs
is_downloadboolean optionalFlag to indicate whether to download generated files. Must be enabled if the code generates files that need to be retrieved
timeoutnumber optionalMaximum execution time in seconds for the sandbox. If code execution exceeds this time, it will be terminated and return a timeout error. Default is 5

Tool: downloadSandboxFiles

Export files from a sandbox directory or file path to downloadable urls. Supports batch export of multiple directories or files. When exporting directories, only common file formats are included (documents, images, audio, video, compressed files, web files, and programming language files).

ParametersTypeDescription
pathstringPath(s) to export from the sandbox.
sandbox_idstringThe ID of the sandbox to export files from

Tool: killSandbox

Destroy a sandbox by its ID.

ParametersTypeDescription
sandbox_idstringThe ID of the sandbox to destroy

Tool: listSandboxFiles

List files and directories at specified paths within a sandbox. Supports batch queries with multiple paths. This operation can be used before downloadSandboxFiles to check if the file exists.

ParametersTypeDescription
pathstring
sandbox_idstringThe ID of the sandbox to query files from

Tool: listSandboxes

Query the list of sandboxes associated with the current API key. If no parameters are passed, all current sandboxes will be returned.

ParametersTypeDescription
sandbox_idstring optionalFilter by sandbox ID (optional)
sandbox_namestring optionalFilter by sandbox name provided during creation (optional)

Tool: runCode

Run code on a specific sandbox. This returns text output only. For operations that generate files, you'll need to use separate file viewing and export endpoints. Default file saving path is /home/user.

ParametersTypeDescription
codestringThe code to run
sandbox_idstringThe ID of the sandbox to run the code on
envsobject optionalEnvironment variables to set when running the code
languagestring optionalThe programming language to use. If not specified or if the value is not in the allowed range, it will be treated as Python code.
timeoutinteger optionalThe timeout for code execution in seconds

Tool: runCommand

Run a command line command on a specific linux sandbox. This returns text output only. For operations that generate files, you'll need to use separate file viewing and download endpoints.

ParametersTypeDescription
cmdstringThe command line command to run
sandbox_idstringThe ID of the sandbox to run the command on
envsobject optionalEnvironment variables to set when running the command
timeoutinteger optionalThe timeout for command execution in seconds. When installing dependencies or performing similar operations, it is recommended to set it to above 120 seconds.

Tool: writeSandboxFiles

Import files from public URLs or base64 data into a sandbox. Supports batch import of multiple files. If the target file already exists, it will be overwritten. If the target directory doesn't exist, it will be automatically created. You must create a sandbox before calling this tool.

ParametersTypeDescription
file_listarrayList of files to import into the sandbox
sandbox_idstringThe ID of the sandbox to write files to.

Use this MCP Server

{
  "mcpServers": {
    "302_sandbox": {
      "command": "docker",
      "args": [
        "run",
        "-i",
        "--rm",
        "-e",
        "302AI_API_KEY",
        "mcp/302_sandbox"
      ],
      "env": {
        "302AI_API_KEY": "YOUR_API_KEY_HERE"
      }
    }
  }
}

Why is it safer to run MCP Servers with Docker?

Tag summary

Content type

Image

Digest

sha256:360407a82

Size

55.1 MB

Last updated

over 1 year ago

docker pull mcp/302_sandbox

This week's pulls

Pulls:

3

Last week