$npx -y skills add medusajs/medusa-agent-skills --skill mcloud-variablesExecute mcloud variables commands to list, get, set, and delete environment variables for a Cloud environment. Use when inspecting, reading, creating, updating, deleting, or exporting environment variables. Never pass --reveal unless the user explicitly requests secret values.
| 1 | # Cloud CLI: Variables Commands |
| 2 | |
| 3 | Execute `mcloud variables` commands to inspect and manage environment variables for Cloud environments. |
| 4 | |
| 5 | ## Constraints |
| 6 | |
| 7 | - **Never pass `--reveal` unless the user explicitly asks.** Secret values appear in terminal scrollback, log aggregators, and process listings. |
| 8 | - **Variable changes need a deploy to apply.** `set`/`delete` don't rebuild or redeploy. Run `mcloud environments redeploy <env>` for a **runtime** variable, or `mcloud environments trigger-build <env>` for a **build** variable (a redeploy reuses the existing image and won't pick up build-variable changes). |
| 9 | - **System variables can't be deleted**, and `delete` requires `--yes` in non-interactive mode. |
| 10 | - Looking up or creating a variable by key requires `--project` and `--environment` (or the equivalent in active context). Referencing by ID (`var_...`) works without project/environment context. |
| 11 | - `set` and `delete` require mcloud CLI v0.1.10+. |
| 12 | |
| 13 | ## Commands |
| 14 | |
| 15 | ### variables list |
| 16 | |
| 17 | List all environment variables for a Cloud environment. |
| 18 | |
| 19 | ```bash |
| 20 | mcloud variables list \ |
| 21 | --organization <org-id> \ |
| 22 | --project <project-id-or-handle> \ |
| 23 | --environment <environment-handle> \ |
| 24 | --json |
| 25 | ``` |
| 26 | |
| 27 | **Options:** |
| 28 | - `-o/--organization <id>` — Organization ID (falls back to active context) |
| 29 | - `-p/--project <id-or-handle>` — Project ID or handle (falls back to active context) |
| 30 | - `-e/--environment <handle>` — Environment handle (falls back to active context) |
| 31 | - `-t/--type <backend|storefront>` — Which variable set to list (default: `backend`) |
| 32 | - `--scope <build|runtime>` — Filter by scope; repeatable (default: both scopes) |
| 33 | - `--include-system` — Include system variables Medusa auto-injects (default: `false`) |
| 34 | - `--reveal` — Print secret values in plaintext instead of masking (**use only when explicitly asked**) |
| 35 | - `--dotenv` — Output `.env`-formatted `KEY=VALUE` lines instead of a table |
| 36 | - `--json` — Output as JSON |
| 37 | |
| 38 | ### variables get |
| 39 | |
| 40 | Retrieve a single variable by its ID (`var_...`) or key. |
| 41 | |
| 42 | ```bash |
| 43 | # By key (requires project + environment context) |
| 44 | mcloud variables get ADMIN_CORS \ |
| 45 | --organization <org-id> \ |
| 46 | --project <project-id-or-handle> \ |
| 47 | --environment <environment-handle> \ |
| 48 | --json |
| 49 | |
| 50 | # By ID (works without project/environment context) |
| 51 | mcloud variables get var_01XYZ --json |
| 52 | ``` |
| 53 | |
| 54 | **Arguments:** |
| 55 | - `variable` — Variable ID (`var_...`) or key (required) |
| 56 | |
| 57 | **Options:** |
| 58 | - `-o/--organization <id>`, `-p/--project <id-or-handle>`, `-e/--environment <handle>` |
| 59 | - `-t/--type <backend|storefront>` — Which variable set to read (default: `backend`) |
| 60 | - `--reveal` — Print secret value in plaintext (**use only when explicitly asked**) |
| 61 | - `--json` — Output as JSON |
| 62 | |
| 63 | ### variables set |
| 64 | |
| 65 | Create or update one or more variables. The CLI updates when you reference an existing key or a `var_...` ID, and creates otherwise. |
| 66 | |
| 67 | ```bash |
| 68 | # Single variable |
| 69 | mcloud variables set API_KEY pk_123 \ |
| 70 | --organization <org-id> \ |
| 71 | --project <project-id-or-handle> \ |
| 72 | --environment <environment-handle> |
| 73 | |
| 74 | # Multiple at once |
| 75 | mcloud variables set -v API_KEY=pk_123 -v CLIENT_ID=my_app |
| 76 | |
| 77 | # From a .env file |
| 78 | mcloud variables set --env-file .env |
| 79 | ``` |
| 80 | |
| 81 | **Arguments:** |
| 82 | - `variable` — Variable ID (`var_...`) or key to set (omit when using `--var`/`--env-file`) |
| 83 | - `value` — Value to set (required when a `variable` argument is passed) |
| 84 | |
| 85 | **Options:** |
| 86 | - `-o/--organization <id>`, `-p/--project <id-or-handle>`, `-e/--environment <handle>` |
| 87 | - `-t/--type <backend|storefront>` — Which variable set to write (default: `backend`) |
| 88 | - `-v/--var <KEY=VALUE|ID=VALUE>` — A variable to set; repeatable |
| 89 | - `--env-file <path>` — Set all variables from a `.env` file |
| 90 | - `--secret`, `--no-secret` — Mark as secret (default: `false` for new variables) |
| 91 | - `--build`, `--no-build` — Available at build time (default: `false` for new variables) |
| 92 | - `--runtime`, `--no-runtime` — Available at runtime (default: `true` for new variables) |
| 93 | - `--json` — Output as JSON |
| 94 | |
| 95 | > Redeploy (runtime) or trigger-build (build) afterward — see Constraints. |
| 96 | |
| 97 | ### variables delete |
| 98 | |
| 99 | Delete a variable by its ID (`var_...`) or key. **Irreversible; system variables can't be deleted.** |
| 100 | |
| 101 | ```bash |
| 102 | mcloud variables delete API_KEY \ |
| 103 | --organization <org-id> \ |
| 104 | --project <project-id-or-handle> \ |
| 105 | --environment <environment-handle> \ |
| 106 | --yes |
| 107 | ``` |
| 108 | |
| 109 | **Arguments:** |
| 110 | - `variable` — Variable ID (`var_...`) or key to delete (required) |
| 111 | |
| 112 | **Options:** |
| 113 | - `-o/--organization <id>`, `-p/--project <id-or-handle>`, `-e/--environment <handle>` |
| 114 | - `-t/--type <backend|storefront>` — Which variable set to delete from (default: `backend`) |
| 115 | - `-y/--yes` — Skip confirmation prompt (required in non-intera |