{
  "display_name": "302AI Sandbox MCP Server",
  "license": "MIT",
  "tags": [
    "code execution",
    "sandbox",
    "MCP",
    "AI tools",
    "code sandbox",
    "development tools"
  ],
  "installations": {
    "npm": {
      "type": "npm",
      "command": "npx",
      "args": [
        "-y",
        "@302ai/sandbox-mcp"
      ],
      "env": {
        "302AI_API_KEY": "${302AI_API_KEY}"
      }
    },
    "docker": {
      "type": "docker",
      "command": "docker",
      "args": [
        "run",
        "-i",
        "--rm",
        "-e",
        "302AI_API_KEY",
        "mcp/302_sandbox"
      ],
      "env": {
        "302AI_API_KEY": "${302AI_API_KEY}"
      }
    }
  },
  "arguments": {
    "302AI_API_KEY": {
      "description": "Your 302AI API key",
      "required": true,
      "example": "your-302ai-api-key"
    }
  },
  "examples": [
    {
      "title": "",
      "description": "",
      "prompt": "Can you help me execute some Python code to calculate the Fibonacci sequence?"
    },
    {
      "title": "",
      "description": "",
      "prompt": "I need to create a sandbox environment to test some JavaScript code."
    },
    {
      "title": "",
      "description": "",
      "prompt": "Can you run this bash command for me: ls -la"
    },
    {
      "title": "",
      "description": "",
      "prompt": "Help me write and execute a simple HTML/CSS webpage."
    },
    {
      "title": "",
      "description": "",
      "prompt": "I need to import a CSV file into the sandbox and analyze it with Python."
    },
    {
      "title": "",
      "description": "",
      "prompt": "Can you create a sandbox and then run a Node.js script in it?"
    },
    {
      "title": "",
      "description": "",
      "prompt": "Show me how to query the files in my sandbox environment."
    },
    {
      "title": "",
      "description": "",
      "prompt": "I want to export the files from my sandbox after I've finished working on them."
    }
  ],
  "name": "sandbox-mcp",
  "repository": {
    "type": "git",
    "url": "https://github.com/302ai/302_sandbox_mcp"
  },
  "homepage": "https://github.com/302ai/302_sandbox_mcp",
  "author": {
    "name": "302ai"
  },
  "description": "Here is a concise description paragraph focused on what the project does:\n\nThe 302AI Sandbox MCP Server is an MCP service that provides a secure code sandbox environment, allowing AI assistants to safely execute arbitrary code from various programming languages and tools without compromising system security.",
  "categories": [
    "Dev Tools"
  ],
  "tools": [
    {
      "name": "downloadSandboxFiles",
      "description": "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).",
      "inputSchema": {
        "type": "object",
        "properties": {
          "sandbox_id": {
            "type": "string",
            "description": "The ID of the sandbox to export files from"
          },
          "path": {
            "description": "Path(s) to export from the sandbox."
          }
        },
        "required": [
          "sandbox_id",
          "path"
        ],
        "additionalProperties": false,
        "$schema": "http://json-schema.org/draft-07/schema#"
      }
    },
    {
      "name": "listSandboxes",
      "description": "Query the list of sandboxes associated with the current API key. If no parameters are passed, all current sandboxes will be returned.",
      "inputSchema": {
        "type": "object",
        "properties": {
          "sandbox_name": {
            "type": "string",
            "description": "Filter by sandbox name provided during creation (optional)"
          },
          "sandbox_id": {
            "type": "string",
            "description": "Filter by sandbox ID (optional)"
          }
        },
        "additionalProperties": false,
        "$schema": "http://json-schema.org/draft-07/schema#"
      }
    },
    {
      "name": "createSandbox",
      "description": "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.",
      "inputSchema": {
        "type": "object",
        "properties": {
          "max_alive_time": {
            "type": "integer",
            "description": "Maximum alive time of the sandbox (seconds), recommand 300."
          },
          "sandbox_name": {
            "type": "string",
            "description": "Custom sandbox name (optional)"
          },
          "metadata": {
            "type": "object",
            "additionalProperties": {
              "type": "string"
            },
            "description": "Sandbox metadata (optional)"
          },
          "envs": {
            "type": "object",
            "additionalProperties": {
              "type": "string"
            },
            "description": "Environment variables to set (optional)"
          }
        },
        "required": [
          "max_alive_time"
        ],
        "additionalProperties": false,
        "$schema": "http://json-schema.org/draft-07/schema#"
      }
    },
    {
      "name": "killSandbox",
      "description": "Destroy a sandbox by its ID.",
      "inputSchema": {
        "type": "object",
        "properties": {
          "sandbox_id": {
            "type": "string",
            "description": "The ID of the sandbox to destroy"
          }
        },
        "required": [
          "sandbox_id"
        ],
        "additionalProperties": false,
        "$schema": "http://json-schema.org/draft-07/schema#"
      }
    },
    {
      "name": "directRunCode",
      "description": "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.",
      "inputSchema": {
        "type": "object",
        "properties": {
          "language": {
            "type": "string",
            "enum": [
              "python",
              "r",
              "java",
              "bash",
              "js"
            ],
            "description": "The 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"
          },
          "code": {
            "type": "string",
            "description": "The source code to be executed in the sandbox"
          },
          "envs": {
            "type": "object",
            "additionalProperties": {
              "type": "string"
            },
            "description": "Environment variables to be set during code execution. Supports passing custom environment variables as key-value pairs"
          },
          "is_download": {
            "type": "boolean",
            "description": "Flag to indicate whether to download generated files. Must be enabled if the code generates files that need to be retrieved"
          },
          "timeout": {
            "type": "number",
            "description": "Maximum 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"
          }
        },
        "required": [
          "language",
          "code"
        ],
        "additionalProperties": false,
        "$schema": "http://json-schema.org/draft-07/schema#"
      }
    },
    {
      "name": "writeSandboxFiles",
      "description": "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.",
      "inputSchema": {
        "type": "object",
        "properties": {
          "sandbox_id": {
            "type": "string",
            "description": "The ID of the sandbox to write files to."
          },
          "file_list": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "file": {
                  "type": "string",
                  "description": "Public URL of the source file or base64 data of file"
                },
                "save_path": {
                  "type": "string",
                  "description": "Target path in the sandbox where the file will be saved (Linux path format) e.g. /home/user"
                }
              },
              "required": [
                "file",
                "save_path"
              ],
              "additionalProperties": false
            },
            "description": "List of files to import into the sandbox"
          }
        },
        "required": [
          "sandbox_id",
          "file_list"
        ],
        "additionalProperties": false,
        "$schema": "http://json-schema.org/draft-07/schema#"
      }
    },
    {
      "name": "runCommand",
      "description": "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.",
      "inputSchema": {
        "type": "object",
        "properties": {
          "cmd": {
            "type": "string",
            "description": "The command line command to run"
          },
          "envs": {
            "type": "object",
            "additionalProperties": {
              "type": "string"
            },
            "description": "Environment variables to set when running the command"
          },
          "timeout": {
            "type": "integer",
            "description": "The timeout for command execution in seconds. When installing dependencies or performing similar operations, it is recommended to set it to above 120 seconds.",
            "default": 60
          },
          "sandbox_id": {
            "type": "string",
            "description": "The ID of the sandbox to run the command on"
          }
        },
        "required": [
          "cmd",
          "sandbox_id"
        ],
        "additionalProperties": false,
        "$schema": "http://json-schema.org/draft-07/schema#"
      }
    },
    {
      "name": "runCode",
      "description": "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.",
      "inputSchema": {
        "type": "object",
        "properties": {
          "language": {
            "type": "string",
            "enum": [
              "python",
              "r",
              "java",
              "bash",
              "js"
            ],
            "description": "The programming language to use. If not specified or if the value is not in the allowed range, it will be treated as Python code.",
            "default": "python"
          },
          "code": {
            "type": "string",
            "description": "The code to run"
          },
          "envs": {
            "type": "object",
            "additionalProperties": {
              "type": "string"
            },
            "description": "Environment variables to set when running the code"
          },
          "timeout": {
            "type": "integer",
            "description": "The timeout for code execution in seconds",
            "default": 5
          },
          "sandbox_id": {
            "type": "string",
            "description": "The ID of the sandbox to run the code on"
          }
        },
        "required": [
          "code",
          "sandbox_id"
        ],
        "additionalProperties": false,
        "$schema": "http://json-schema.org/draft-07/schema#"
      }
    },
    {
      "name": "listSandboxFiles",
      "description": "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.",
      "inputSchema": {
        "type": "object",
        "properties": {
          "sandbox_id": {
            "type": "string",
            "description": "The ID of the sandbox to query files from"
          },
          "path": {}
        },
        "required": [
          "sandbox_id",
          "path"
        ],
        "additionalProperties": false,
        "$schema": "http://json-schema.org/draft-07/schema#"
      }
    }
  ],
  "prompts": [],
  "resources": [],
  "is_official": false,
  "docker_url": "https://hub.docker.com/r/mcp/302_sandbox"
}
