SandboxForge MCP is a Python FastMCP server for workspace-scoped Lima VM orchestration, Docker/Compose execution, and local dev-infra automation.
SandboxForge MCP
SandboxForge MCP is a Python MCP server for VM-first isolated execution with workspace-aware tooling.
It supports multiple virtualization backends:
- Lima on macOS and Linux
- Hyper-V on native Windows
Inside each VM, it can prepare and run Docker/Compose workloads, manage supporting services (MySQL/Redis), and orchestrate task execution with lease-based lifecycle controls.
Table of Contents
- What It Provides
- Isolation Model
- OS Support
- Architecture
- Requirements
- Quick Start
- Tool Surface
- Configuration
- Environment Variables
- Windows Notes
- Docker Deployment
- Development
- Migration Notes (v1 Breaking)
- Troubleshooting
- Related Docs
- License
What It Provides
- Ephemeral VM lifecycle orchestration (
create/list/run/copy/destroy) - Workspace bootstrap and sync in/out
- Docker runtime preparation inside guest VM
- Docker / docker-compose execution helpers
- Optional infra setup (network, MySQL, Redis)
- Background task management and artifact collection
- Lease persistence and TTL-based cleanup via SQLite
- Image validation and cache-aware build flow
Isolation Model
SandboxForge is VM-first isolation, not Docker-on-host isolation.
- Isolation boundary: disposable VM guest
- Runtime inside boundary: Docker/Compose
- Result: stronger host separation and reduced host pollution
OS Support
Status as of March 25, 2026:
| Host OS | Status | Backend | Notes |
|---|---|---|---|
| macOS | Supported | Lima | Default vm.vm_type = "vz" |
| Linux | Supported | Lima | Default vm.vm_type = "qemu" |
| Windows (native) | Supported | Hyper-V | Requires Hyper-V + HYPERV_BASE_VHDX + OpenSSH client |
| Windows (WSL2-hosted server runtime) | Not supported in v1 | N/A | v1 target is native Windows server runtime |
Unsupported hosts or missing backend prerequisites return BACKEND_UNAVAILABLE.
Architecture
High-level flow:
- MCP client invokes server tool (
stdioor Streamable HTTP) LeaseServicevalidates request/config and applies lifecycle rulesLeaseStorepersists leases/tasks in SQLite- Selected backend executes VM operations
- Docker/Compose operations run inside guest VM
- Sweeper expires stale leases by TTL
Key modules:
src/lima_mcp_server/server.py: MCP app + tool registrationsrc/lima_mcp_server/service.py: orchestration and response shapingsrc/lima_mcp_server/backend/lima.py: Lima backendsrc/lima_mcp_server/backend/hyperv.py: Hyper-V backendsrc/lima_mcp_server/backend/factory.py: backend selection (auto|lima|hyperv)src/lima_mcp_server/workspace_config.py: workspace/global config parsing and validationsrc/lima_mcp_server/runtime.py: Docker/Compose command builderssrc/lima_mcp_server/db.py: SQLite lease/task persistence
Requirements
- Python
3.11+ uv- Host virtualization prerequisites:
- macOS/Linux:
limactlavailable inPATH - Windows: Hyper-V PowerShell cmdlets +
ssh/scp
- macOS/Linux:
Minimum default VM shape:
cpus = 1memory_gib = 2.0disk_gib = 15.0
Quick Start
uv sync --extra dev
uv run sandboxforge-mcp-server
Using Make:
make setup
make run
Tool Surface
Registered MCP tools include:
create_instancevalidate_workspace_configvalidate_imagelist_instancesrun_commandcopy_to_instancecopy_from_instancedestroy_instanceprepare_workspacesync_workspace_to_instancesync_instance_to_workspacedocker_builddocker_rundocker_execdocker_logsdocker_composedocker_psdocker_imagesdocker_cleanupstart_background_taskget_task_statusget_task_logsstop_taskcollect_artifactsextend_instance_ttl
Configuration
Workspace config files (precedence high -> low):
- Request overrides
<workspace>/.sandboxforge.toml~/.config/sandboxforge-mcp/config.toml- Built-in defaults
Legacy config files still supported:
- Workspace:
.orbitforge.toml,.lima-mcp.toml - Global:
~/.config/orbitforge-mcp/config.toml,~/.config/lima-mcp/config.toml
Default VM config:
template = "template:docker"vm_type = "vz"on macOSvm_type = "qemu"on Linuxvm_type = nullon other hosts
For full schema and examples, see docs/SETUP.md and src/lima_mcp_server/workspace_config.py.
Environment Variables
Core server:
MCP_HTTP_HOST(default127.0.0.1)MCP_HTTP_ALLOW_NON_LOOPBACK(default0)MCP_HTTP_PORT(default8765)MCP_ENABLE_HTTP(default1)LEASE_DB_PATH(defaultstate/leases.db)MAX_INSTANCES(default3)DEFAULT_TTL_MINUTES(default30)MAX_TTL_MINUTES(default120)SANDBOX_SWEEPER_INTERVAL_SECONDS(default60)
Backend selection:
SANDBOX_BACKEND(auto,lima,hyperv; defaultauto)
Hyper-V backend:
HYPERV_SWITCH_NAME(defaultDefault Switch)HYPERV_BASE_VHDX(required for Hyper-V)HYPERV_STORAGE_DIR(defaultstate/hyperv)HYPERV_SSH_USER(defaultubuntu)HYPERV_SSH_KEY_PATH(optional)HYPERV_SSH_PORT(default22)HYPERV_BOOT_TIMEOUT_SECONDS(default180)
Windows Notes
- v1 supports native Windows host runtime, not WSL2-hosted server runtime
HYPERV_BASE_VHDXmust reference an existing base image- OpenSSH client (
ssh,scp) must be available inPATH - On native Windows runtime,
workspace_rootmust be a Windows path
Docker Deployment
Build and run via helper script:
./scripts/docker-deploy.sh deploy
Or with Make:
make docker-up
Useful operations:
./scripts/docker-deploy.sh logs
./scripts/docker-deploy.sh ps
./scripts/docker-deploy.sh down
Development
Run tests:
uv run pytest -q
Integration test gates:
- Lima:
RUN_LIMA_INTEGRATION=1 - Hyper-V:
RUN_HYPERV_INTEGRATION=1(Windows host)
Migration Notes (v1 Breaking)
This project now uses backend-neutral API naming.
Breaking changes from pre-v1:
- Tool rename:
lima_validate_image->validate_image - Response/storage field rename:
lima_name->backend_instance_name - Error code rename:
LIMA_COMMAND_FAILED->BACKEND_COMMAND_FAILED - Env var rename:
LIMA_SWEEPER_INTERVAL_SECONDS->SANDBOX_SWEEPER_INTERVAL_SECONDS
Troubleshooting
BACKEND_UNAVAILABLE:- Verify backend prerequisites for your host
- Confirm selected backend via
SANDBOX_BACKEND
- Linux Lima failures around KVM/QEMU:
- Install host virtualization dependencies required by Lima
- Windows Hyper-V failures:
- Confirm
Get-Command New-VMandGet-Command New-VHD - Confirm
HYPERV_BASE_VHDXexists and is readable
- Confirm
Related Docs
- Setup:
docs/SETUP.md - Project structure:
docs/PROJECT_STRUCTURE.md - Coding constraints:
docs/CODING_STANDARDS.md - Contributor guide:
CONTRIBUTING.md - Changelog:
CHANGELOG.md - Security:
SECURITY.md - Agent orientation:
AGENTS.md
License
MIT. See LICENSE.