--- 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: ```json { "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: ```json { "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](https://youtu.be/Kft9YsK08D0) showing how the sandbox runs Python code with automatic dependency detection and live output.