SafeBox / README.md
gabyorel
Add YT video link
e167a16

A newer version of the Gradio SDK is available: 6.1.0

Upgrade
metadata
title: SafeBox
emoji: πŸ› οΈ
colorFrom: gray
colorTo: pink
sdk: gradio
sdk_version: 5.33.0
app_file: app.py
tags:
  - mcp-server-track
  - code-execution
  - modal
  - sandbox
  - dynamic-dependencies
pinned: false
license: apache-2.0
short_description: Execute Python code safely in a dynamic sandbox.

SafeBox MCP Server

This project is a Gradio-based MCP server that allows both users and AI agents to safely execute arbitrary Python code snippets in a Modal sandbox. It automatically detects and installs Python dependencies before executing the code.

✨ Features

  • Sandboxed Code Execution: All code is executed inside a secure, isolated Modal sandbox.
  • Dynamic Dependency Resolution: Automatically detects imported packages in the code and installs them on the fly using pip.
  • Runtime Feedback: Returns stdout, stderr, returncode, and any error messages from the execution.
  • Build Logs: Returns Modal build logs for full visibility.

πŸ€– Designed for AI Agents

SafeBox was built with autonomous AI agents in mind.

It is ideal for agents that need to reflect on code changes by executing, analyzing, and iterating on their own generated Python code.

πŸ”Œ Integration with MCP clients

All you need to do is add this URL endpoint to your MCP Client (e.g., Cursor, Cline, or Tiny Agents), which typically means pasting this config in the settings:

{
  "mcpServers": {
    "safebox": {
      "url": "https://agents-mcp-hackathon-safebox.hf.space/gradio_api/mcp/sse"
    }
  }
}

Some MCP Clients, notably Claude Desktop, do not yet support SSE-based MCP Servers. In those cases, you can use a tool such as mcp-remote. First install Node.js. Then, add the following to your own MCP Client config:

{
  "mcpServers": {
    "safebox": {
      "command": "npx",
      "args": [
        "mcp-remote",
        "https://agents-mcp-hackathon-safebox.hf.space/gradio_api/mcp/sse",
        "--transport",
        "sse-only"
      ]
    }
  }
}

πŸ” Authentication & Tokens

βœ… You do not need to set up your own Modal account to use this Space.

This Space uses a preconfigured Modal token, and you are free to use my credits to run your code snippets in a secure sandbox.

πŸ“Ί Demo Video

Curious to see it in action? Watch the demo showing how the sandbox runs Python code with automatic dependency detection and live output.