Mags CLI - Execute scripts on Magpie's instant VM infrastructure
npm install @magpiecloud/magsExecute scripts instantly on Magpie's microVM infrastructure. VMs boot in <100ms from a warm pool, giving you instant access to isolated compute environments.
Mags is a CLI and SDK for running scripts on ephemeral microVMs. Each execution gets its own isolated VM that:
- Boots in <100ms (from warm pool)
- Has persistent workspaces synced to S3
- Syncs /root directory automatically every 30 seconds
- Can expose public URLs for web services
- Provides SSH access through secure proxy
- Auto-sleeps when idle and wakes on request
``bash`
npm install -g @magpiecloud/mags
`bash`
go install github.com/magpiecloud/mags/cmd/mags@latest
`bash`
mags login
This opens your browser to the Magpie dashboard where you can create an API token. Paste the token when prompted, and it will be saved to ~/.mags/config.json for all future commands.
`bash`
mags login # Authenticate with Magpie
mags whoami # Check current authentication status
mags logout # Remove saved credentials
`bash`
export MAGS_API_TOKEN="your-token-here"
`bash`
mags run 'echo Hello World'
`bashCreate a new VM with workspace "myproject"
mags new myproject
$3
Workspaces persist data between runs using S3 sync:
`bash
First run - install dependencies
mags run -w myproject 'apk add python3 py3-pip && pip install requests'Second run - dependencies are still there
mags run -w myproject 'python3 -c "import requests; print(requests.__version__)"'
`$3
`bash
mags run -p --url 'python3 -m http.server 8080'
Returns: https://abc123.apps.magpiecloud.com
`CLI Reference
$3
| Command | Description |
|---------|-------------|
|
mags login | Authenticate with Magpie (saves token locally) |
| mags logout | Remove saved credentials |
| mags whoami | Show current authentication status |
| mags new | Create a persistent VM with workspace |
| mags run [options]