Supports containerized deployment of the MCP server, with configuration options for connecting Modal resources.
Utilizes .env files for configuration management, storing API tokens and server settings.
Provides sandbox management in the cloud with GPU support, including launching isolated Python environments, managing packages, configuring resources, and executing remote commands.
Creates customizable Python environments with support for multiple Python versions and package management.
MCP4Modal Sandbox
A powerful Model Context Protocol (MCP) server that provides seamless cloud-based sandbox management using Modal.com. This project enables LLMs and AI assistants to spawn, manage, and interact with isolated compute environments in the cloud with full GPU support.
Features
Core Sandbox Management
- Launch Sandboxes: Create isolated Python environments with custom configurations
- Terminate Sandboxes: Clean resource management and controlled shutdown
- List Sandboxes: Monitor and track active sandbox environments
- App Namespacing: Organize sandboxes within Modal app namespaces
Advanced Configuration
- Python Versions: Support for multiple Python versions (default: 3.12)
- Package Management: Install pip and apt packages during sandbox creation
- Resource Allocation: Configure CPU cores, memory, and execution timeouts
- Working Directory: Set custom working directories for sandbox environments
GPU Support
Comprehensive GPU support for machine learning and compute-intensive workloads:
- T4: Entry-level GPU, ideal for inference workloads
- L4: Mid-range GPU for general ML tasks
- A10G: High-performance GPU for training (up to 4 GPUs)
- A100-40GB/80GB: High-end GPUs for large-scale training
- L40S: Latest generation GPU for ML workloads
- H100: Latest generation high-end GPU
- H200: Latest generation flagship GPU
- B200: Latest generation enterprise GPU
File Operations
- Push Files: Upload files from local filesystem to sandboxes
- Pull Files: Download files from sandboxes to local filesystem
- Read File Content: View file contents directly without downloading
- Write File Content: Create and edit files within sandboxes
- Directory Management: Create, list, and remove directories
Command Execution
- Remote Execution: Run arbitrary commands in sandbox environments
- Output Capture: Capture stdout, stderr, and return codes
- Timeout Control: Configure execution timeouts for long-running tasks
- Performance Metrics: Track execution time and resource usage
Security & Environment Management
- Secrets Management: Inject environment variables and secrets
- Predefined Secrets: Reference existing secrets from Modal dashboard
- Volume Mounting: Attach persistent storage volumes
- Isolated Environments: Complete isolation between sandbox instances
Transport Options
- stdio: Direct command-line interface (default)
- streamable-http: HTTP-based communication
- SSE: Server-Sent Events for real-time updates
rerequisites
- Python 3.12+
- Modal.com account and API key
- Environment variables configured (see Configuration section)
Installation
Using UV (Recommended)
Using Docker
Build the Docker Image
Run with stdio Transport (Default)
Configuration
Environment Variables
Create a .env
file in the project root:
Modal.com Setup
- Create an account at Modal.com
- Generate API tokens from your Modal dashboard
- Configure the tokens in your environment variables
Integration with Claude Desktop
Add to your Claude Desktop configuration:
uvx
docker
Available Tools
The MCP server provides 11 tools for comprehensive sandbox management:
launch_sandbox
- Create new Modal sandboxes with custom configuration (Python version, packages, GPU, secrets)terminate_sandbox
- Stop and clean up running sandboxeslist_sandboxes
- List all sandboxes in an app namespace with their statusexecute_command
- Run shell commands in sandboxes and capture outputpush_file_to_sandbox
- Upload files from local filesystem to sandboxespull_file_from_sandbox
- Download files from sandboxes to local filesystemlist_directory_contents
- List contents of directories within sandboxesmake_directory
- Create directories in sandboxesremove_path
- Remove files or directories from sandboxesread_file_content_from_sandbox
- Read file contents directly from sandboxeswrite_file_content_to_sandbox
- Write content to files within sandboxes
This server cannot be installed
A Model Context Protocol server that enables LLMs and AI assistants to create, manage, and interact with isolated cloud-based Python environments with GPU support on Modal.com.
Related MCP Servers
- AsecurityAlicenseAqualityA Model Context Protocol server that enables AI assistants like Claude to interact with Google Cloud Platform environments through natural language, allowing users to query and manage GCP resources during conversations.Last updated -9209129TypeScriptMIT License
- -securityFlicense-qualityA Model Context Protocol server that enables AI assistants like Claude to perform Python development tasks through file operations, code analysis, project management, and safe code execution.Last updated -5Python
- -securityFlicense-qualityA Python server implementing the Model Context Protocol that exposes tools for querying external APIs, compatible with Claude Desktop and ChatGPT Desktop.Last updated -Python
- -securityFlicense-qualityA Model Context Protocol server that gives Claude access to multiple AI models (Gemini, OpenAI, OpenRouter) for enhanced code analysis, problem-solving, and collaborative development through AI orchestration with conversations that continue across tasks.Last updated -5,128Python