|
| 1 | +# MIOSA for AI Agents |
| 2 | + |
| 3 | +A universal guide for any AI agent (Claude, GPT, Gemini, open models) to drive MIOSA cloud infrastructure. |
| 4 | + |
| 5 | +## What is MIOSA |
| 6 | + |
| 7 | +MIOSA gives AI agents: |
| 8 | + |
| 9 | +- **Sandboxes** — headless Firecracker microVMs for code execution |
| 10 | +- **Computers** — full desktop VMs (Linux XFCE) for browser/GUI automation |
| 11 | +- **Deployments** — git-backed web hosting with builds, releases, custom domains |
| 12 | +- **Storage** — S3-compatible object storage |
| 13 | +- **Databases** — managed Postgres, MySQL, Redis |
| 14 | +- **Volumes** — persistent block storage attachable to computers |
| 15 | + |
| 16 | +145 tools, exposed via MCP at `https://api.miosa.ai/api/v1/mcp` or locally via `miosa mcp serve`. |
| 17 | + |
| 18 | +## Setup |
| 19 | + |
| 20 | +### Get an API key |
| 21 | + |
| 22 | +```bash |
| 23 | +npm install -g @miosa/cli |
| 24 | +miosa login |
| 25 | +``` |
| 26 | + |
| 27 | +Or grab one from `https://miosa.ai/dashboard/api-keys` — format `msk_u_...`. |
| 28 | + |
| 29 | +### Configure MCP |
| 30 | + |
| 31 | +For any MCP-compatible agent (Claude Code, Cursor, Gemini CLI, OSS clients): |
| 32 | + |
| 33 | +```json |
| 34 | +{ |
| 35 | + "mcpServers": { |
| 36 | + "miosa": { |
| 37 | + "command": "miosa", |
| 38 | + "args": ["mcp", "serve"], |
| 39 | + "env": { "MIOSA_API_KEY": "msk_..." } |
| 40 | + } |
| 41 | + } |
| 42 | +} |
| 43 | +``` |
| 44 | + |
| 45 | +Or hit the hosted endpoint directly with `Authorization: Bearer msk_...`. |
| 46 | + |
| 47 | +## Universal conventions |
| 48 | + |
| 49 | +Apply these whether you're using MCP, the REST API, or an SDK: |
| 50 | + |
| 51 | +| Convention | Detail | |
| 52 | +|---|---| |
| 53 | +| **IDs** | Every tool takes `<resource>_id` first. `create_sandbox` returns one; reuse it. | |
| 54 | +| **Status** | Poll `<resource>_get` until `status: "running"`. Never `active`. | |
| 55 | +| **Sizes** | xs(1/2GB), small(2/4GB), medium(4/8GB), large(8/16GB), xl(16/32GB). Default `small`. | |
| 56 | +| **Paths** | Writable inside VMs: `/workspace` (default cwd), `/home`, `/root`, `/tmp`, `/opt`, `/srv` | |
| 57 | +| **Timeouts** | `exec` default 30s. Pass `timeout_ms: 120000` for `npm install` / `pip install`. | |
| 58 | +| **Screenshots** | PNG 1024×768. Coordinates absolute pixels, (0,0) top-left. | |
| 59 | + |
| 60 | +## The 5 core workflows |
| 61 | + |
| 62 | +### Run code |
| 63 | + |
| 64 | +``` |
| 65 | +create_sandbox → exec → read output → destroy_sandbox |
| 66 | +``` |
| 67 | + |
| 68 | +### Automate a desktop |
| 69 | + |
| 70 | +``` |
| 71 | +computer_create → desktop_screenshot → desktop_click/type → desktop_screenshot → repeat |
| 72 | +``` |
| 73 | + |
| 74 | +### Deploy from git |
| 75 | + |
| 76 | +``` |
| 77 | +deployment_create(repo_url) → deployment_env_set → deployment_publish |
| 78 | +``` |
| 79 | + |
| 80 | +### Store and share files |
| 81 | + |
| 82 | +``` |
| 83 | +storage_bucket_create → storage_object_upload → storage_presign (returns public URL) |
| 84 | +``` |
| 85 | + |
| 86 | +### Provision a database |
| 87 | + |
| 88 | +``` |
| 89 | +database_create(engine="postgres") → database_credentials → use connection string |
| 90 | +``` |
| 91 | + |
| 92 | +## Decision tree |
| 93 | + |
| 94 | +``` |
| 95 | +Need a screen / browser / GUI? |
| 96 | + YES → computer |
| 97 | + NO ↓ |
| 98 | +
|
| 99 | +Need to run code or build something? |
| 100 | + YES → sandbox |
| 101 | + NO ↓ |
| 102 | +
|
| 103 | +Deploying from GitHub? |
| 104 | + YES → deployment |
| 105 | + NO ↓ |
| 106 | +
|
| 107 | +Need to store files? |
| 108 | + YES → storage (bucket + presign) |
| 109 | + NO ↓ |
| 110 | +
|
| 111 | +Need a database? |
| 112 | + YES → database |
| 113 | +``` |
| 114 | + |
| 115 | +## Tool catalog (145 tools) |
| 116 | + |
| 117 | +All MCP tool names use `snake_case`. REST endpoints mirror them. |
| 118 | + |
| 119 | +### Sandbox (18) |
| 120 | +`create_sandbox`, `get_sandbox`, `list_sandboxes`, `destroy_sandbox`, `sandbox_pause`, `sandbox_resume`, `exec`, `exec_python`, `sandbox_write_file`, `sandbox_read_file`, `sandbox_list_files`, `sandbox_expose`, `sandbox_deploy`, `sandbox_logs`, `sandbox_snapshot_create`, `sandbox_snapshot_list`, `sandbox_snapshot_restore`, `sandbox_template_list` |
| 121 | + |
| 122 | +### Computer (~50) |
| 123 | +Lifecycle: `computer_create`, `computer_get`, `computer_list`, `computer_destroy`, `computer_start`, `computer_stop`, `computer_restart`, `computer_update`, `computer_wait` |
| 124 | + |
| 125 | +Desktop input: `desktop_screenshot`, `desktop_click`, `desktop_double_click`, `desktop_type`, `desktop_key`, `desktop_scroll`, `desktop_move_cursor`, `computer_right_click`, `computer_drag`, `computer_hotkey`, `computer_mouse_down`, `computer_mouse_up`, `computer_key_down`, `computer_key_up` |
| 126 | + |
| 127 | +Screen: `computer_get_screen_size`, `computer_get_cursor_position`, `computer_get_clipboard`, `computer_set_clipboard` |
| 128 | + |
| 129 | +Windows: `computer_windows`, `computer_focus_window`, `computer_maximize_window`, `computer_minimize_window`, `computer_close_window`, `computer_set_window_size`, `computer_set_window_position` |
| 130 | + |
| 131 | +Files & shell: `computer_bash`, `computer_write_file`, `computer_read_file`, `computer_list_files`, `computer_stat_file`, `computer_mkdir`, `computer_rename_file`, `computer_copy_file`, `computer_delete_file` |
| 132 | + |
| 133 | +Apps & env: `computer_launch`, `computer_get_desktop_env`, `computer_set_wallpaper`, `computer_accessibility_tree` |
| 134 | + |
| 135 | +Checkpoints: `computer_checkpoint_create`, `computer_checkpoint_list`, `computer_checkpoint_restore`, `computer_checkpoint_delete` |
| 136 | + |
| 137 | +Services: `computer_service_create`, `computer_service_list`, `computer_service_start`, `computer_service_stop`, `computer_service_restart`, `computer_service_logs`, `computer_service_delete` |
| 138 | + |
| 139 | +Env & networking: `computer_env_list`, `computer_env_set`, `computer_env_delete`, `computer_logs`, `computer_domain_add`, `computer_domain_list`, `computer_domain_delete` |
| 140 | + |
| 141 | +### Deploy (13) |
| 142 | +`deployment_create`, `deployment_list`, `deployment_get`, `deployment_delete`, `deployment_publish`, `deployment_rollback`, `deployment_env_list`, `deployment_env_set`, `deployment_logs`, `deployment_version_list`, `deployment_version_promote` |
| 143 | + |
| 144 | +### Storage (8) |
| 145 | +`storage_bucket_create`, `storage_bucket_list`, `storage_bucket_delete`, `storage_object_upload`, `storage_object_download`, `storage_object_list`, `storage_object_delete`, `storage_presign` |
| 146 | + |
| 147 | +### Database (6) |
| 148 | +`database_create`, `database_list`, `database_get`, `database_delete`, `database_credentials`, `database_logs` |
| 149 | + |
| 150 | +### Volume (5) |
| 151 | +`volume_create`, `volume_list`, `volume_attach`, `volume_detach`, `volume_delete` |
| 152 | + |
| 153 | +### Workspace (6) |
| 154 | +`workspace_create`, `workspace_list`, `workspace_get`, `workspace_update`, `workspace_stats`, `workspace_usage` |
| 155 | + |
| 156 | +### Cron (6) |
| 157 | +`cron_create`, `cron_list`, `cron_pause`, `cron_resume`, `cron_run_now`, `cron_delete` |
| 158 | + |
| 159 | +### Webhooks (4) |
| 160 | +`webhook_create`, `webhook_list`, `webhook_delete`, `webhook_test` |
| 161 | + |
| 162 | +### Functions (4) |
| 163 | +`function_create`, `function_list`, `function_invoke`, `function_delete` |
| 164 | + |
| 165 | +### API keys & platform |
| 166 | +`api_key_create`, `api_key_list`, `api_key_delete`, `billing_usage`, `billing_plan`, `region_list` |
| 167 | + |
| 168 | +## Error handling |
| 169 | + |
| 170 | +| Error | Cause | Fix | |
| 171 | +|---|---|---| |
| 172 | +| `not running` | Action on resource that isn't ready | Poll `<resource>_get` until `status: "running"` | |
| 173 | +| `not found` | Bad ID | Verify with `<resource>_list` | |
| 174 | +| `path outside allowed` | Wrote to restricted path | Use `/workspace`, `/home`, `/tmp` | |
| 175 | +| `timeout` | exec exceeded `timeout_ms` | Increase up to 300000 | |
| 176 | +| `rate limited` | Too many API calls | Back off 5s | |
| 177 | +| OOM killed | Build exceeded RAM | Bump size to medium or larger | |
| 178 | +| `Internal error` | Server bug | Retry once; report if persistent | |
| 179 | + |
| 180 | +## SDKs |
| 181 | + |
| 182 | +If you prefer typed clients over raw MCP: |
| 183 | + |
| 184 | +- **Python**: `pip install miosa` — [github.com/Miosa-osa/miosa-python](https://github.com/Miosa-osa/miosa-python) |
| 185 | +- **Elixir**: `{:miosa, "~> 1.0"}` — [github.com/Miosa-osa/miosa-elixir](https://github.com/Miosa-osa/miosa-elixir) |
| 186 | +- **Node/TypeScript**: `@miosa/cli` includes a programmatic client — [github.com/Miosa-osa/miosa-cli](https://github.com/Miosa-osa/miosa-cli) |
| 187 | + |
| 188 | +All SDKs use the same REST endpoints as the MCP server. Pick whichever feels native. |
| 189 | + |
| 190 | +## Hosted documentation |
| 191 | + |
| 192 | +- Full docs: https://miosa.ai/docs |
| 193 | +- MCP guide: https://miosa.ai/docs/guides/mcp |
| 194 | +- Quickstart: https://miosa.ai/docs/quickstart |
| 195 | + |
| 196 | +## Repos |
| 197 | + |
| 198 | +- https://github.com/Miosa-osa/miosa-mcp — Python MCP server |
| 199 | +- https://github.com/Miosa-osa/miosa-cli — TypeScript CLI + MCP |
| 200 | +- https://github.com/Miosa-osa/miosa-skills — Claude Code skills (this repo) |
| 201 | +- https://github.com/Miosa-osa/miosa-python — Python SDK |
| 202 | +- https://github.com/Miosa-osa/miosa-elixir — Elixir SDK |
0 commit comments