mcloud-variables

作成者: medusajs

mcloud variablesコマンドを実行して、Cloud環境の環境変数を一覧表示および取得します。環境変数を検査、読み取り、またはエクスポートする際に使用します。

npx skills add https://github.com/medusajs/medusa-agent-skills --skill mcloud-variables

Cloud CLI: Variables Commands

Execute mcloud variables commands to inspect and manage environment variables for Cloud environments.

Constraints

  • Never pass --reveal unless the user explicitly asks. Secret values appear in terminal scrollback, log aggregators, and process listings.
  • 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).
  • System variables can't be deleted, and delete requires --yes in non-interactive mode.
  • 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.
  • set and delete require mcloud CLI v0.1.10+.

Commands

variables list

List all environment variables for a Cloud environment.

mcloud variables list \
  --organization <org-id> \
  --project <project-id-or-handle> \
  --environment <environment-handle> \
  --json

Options:

  • -o/--organization <id> — Organization ID (falls back to active context)
  • -p/--project <id-or-handle> — Project ID or handle (falls back to active context)
  • -e/--environment <handle> — Environment handle (falls back to active context)
  • -t/--type <backend|storefront> — Which variable set to list (default: backend)
  • --scope <build|runtime> — Filter by scope; repeatable (default: both scopes)
  • --include-system — Include system variables Medusa auto-injects (default: false)
  • --reveal — Print secret values in plaintext instead of masking (use only when explicitly asked)
  • --dotenv — Output .env-formatted KEY=VALUE lines instead of a table
  • --json — Output as JSON

variables get

Retrieve a single variable by its ID (var_...) or key.

# By key (requires project + environment context)
mcloud variables get ADMIN_CORS \
  --organization <org-id> \
  --project <project-id-or-handle> \
  --environment <environment-handle> \
  --json

# By ID (works without project/environment context)
mcloud variables get var_01XYZ --json

Arguments:

  • variable — Variable ID (var_...) or key (required)

Options:

  • -o/--organization <id>, -p/--project <id-or-handle>, -e/--environment <handle>
  • -t/--type <backend|storefront> — Which variable set to read (default: backend)
  • --reveal — Print secret value in plaintext (use only when explicitly asked)
  • --json — Output as JSON

variables set

Create or update one or more variables. The CLI updates when you reference an existing key or a var_... ID, and creates otherwise.

# Single variable
mcloud variables set API_KEY pk_123 \
  --organization <org-id> \
  --project <project-id-or-handle> \
  --environment <environment-handle>

# Multiple at once
mcloud variables set -v API_KEY=pk_123 -v CLIENT_ID=my_app

# From a .env file
mcloud variables set --env-file .env

Arguments:

  • variable — Variable ID (var_...) or key to set (omit when using --var/--env-file)
  • value — Value to set (required when a variable argument is passed)

Options:

  • -o/--organization <id>, -p/--project <id-or-handle>, -e/--environment <handle>
  • -t/--type <backend|storefront> — Which variable set to write (default: backend)
  • -v/--var <KEY=VALUE|ID=VALUE> — A variable to set; repeatable
  • --env-file <path> — Set all variables from a .env file
  • --secret, --no-secret — Mark as secret (default: false for new variables)
  • --build, --no-build — Available at build time (default: false for new variables)
  • --runtime, --no-runtime — Available at runtime (default: true for new variables)
  • --json — Output as JSON

Redeploy (runtime) or trigger-build (build) afterward — see Constraints.

variables delete

Delete a variable by its ID (var_...) or key. Irreversible; system variables can't be deleted.

mcloud variables delete API_KEY \
  --organization <org-id> \
  --project <project-id-or-handle> \
  --environment <environment-handle> \
  --yes

Arguments:

  • variable — Variable ID (var_...) or key to delete (required)

Options:

  • -o/--organization <id>, -p/--project <id-or-handle>, -e/--environment <handle>
  • -t/--type <backend|storefront> — Which variable set to delete from (default: backend)
  • -y/--yes — Skip confirmation prompt (required in non-interactive mode)
  • --json — Output as JSON

Variable Fields (JSON)

FieldDescription
idVariable ID (var_...)
keyVariable name (e.g. ADMIN_CORS)
valueVariable value (masked if is_secret and --reveal not passed)
is_secretWhether the variable is treated as a secret
is_buildAvailable at build time
is_runtimeAvailable at runtime
environment_idThe environment ID this variable belongs to
sourceuser for user-set variables, system for auto-injected ones

Examples

# List all variables for the active environment
mcloud variables list --json

# List only runtime variables, including system ones
mcloud variables list --scope runtime --include-system --json

# List storefront variables
mcloud variables list --type storefront --json

# Get a variable by key (with active context)
mcloud variables get DATABASE_URL --json

# Get a variable by ID (no env context needed)
mcloud variables get var_01XYZ --json

# Set a single variable, then redeploy to apply (runtime)
mcloud variables set REDIS_URL redis://cache:6379
mcloud environments redeploy production

# Set a secret build-only variable, then trigger a build to apply
mcloud variables set STRIPE_SECRET_KEY sk_live_123 --secret --build --no-runtime
mcloud environments trigger-build production

# Set multiple variables from a .env file
mcloud variables set --env-file .env

# Delete a variable (irreversible — confirm before running)
mcloud variables delete OLD_FLAG --yes

# Only reveal secrets when user explicitly asks
mcloud variables get STRIPE_SECRET_KEY --reveal --json | jq -r '.value'

# Export all variables to a .env file (user must explicitly request --reveal)
mcloud variables list --reveal --dotenv > .env

# Check if a specific variable exists
mcloud variables list --json | jq '.[] | select(.key == "REDIS_URL")'

medusajsのその他のスキル

building-storefronts
medusajs
Medusaストアフロント向けのSDKファーストなフロントエンド統合で、React Queryパターンと重要なAPI呼び出しルールを備えています。すべてのAPIリクエストには常にMedusa JS SDKを使用し、通常のfetch()は使用しないでください。必要なヘッダー(ストアルート用の公開可能APIキー、管理ルート用の認証)が欠落するためです。SDKメソッドにはプレーンなJavaScriptオブジェクトを渡し、ボディパラメータにJSON.stringify()を使用しないでください。SDKが自動的にシリアライズを処理します。GETリクエストにはuseQueryを、POST/DELETEリクエストにはuseMutationを使用してください。
official
building-admin-dashboard-customizations
medusajs
Medusa Adminダッシュボード向けのカスタムUI拡張機能。Admin SDKとMedusa UIコンポーネントを使用。管理UIの作業(計画、実装、調査)では、このスキルを最初に読み込むこと。MCPサーバーはAPIリファレンスのみを提供し、デザインパターンやデータ読み込み戦略は提供しない。重要:すべてのAPIリクエストにはMedusa JS SDKを使用すること(通常のfetchは不可)。表示クエリとモーダルクエリを分離し、ミューテーション後は表示データを無効化すること。既存ページにウィジェットを実装するか、カスタムUIルートを作成すること。...
official
learning-medusa
medusajs
対話形式で段階的に進むMedusa開発ブートキャンプ。ブランド機能を構築しながらアーキテクチャパターンを学びます。モジュール、ワークフロー、APIルート、モジュールリンク、ワークフローフック、管理UIのカスタマイズをカバーする3つのレッスン(合計2~3時間)を用意。各主要コンポーネント完了後のチェックポイント検証では、概念理解、コード品質、機能性を確認してから次に進みます。エラーを学習の機会として捉え、診断的な質問と根本原因の分析を通じて一緒にデバッグします。
official
db-migrate
medusajs
保留保留中のMedusaデータベースマイグレーションを実行し、結果を報告します。Bash経由でnpx medusa db:migrateを実行し、保留中のすべてのマイグレーションをMedusaデータベースに適用します。適用されたマイグレーションの数、発生したエラー、成功確認を含むマイグレーション結果を報告します。標準のnpm/npxセットアップを使用したMedusaプロジェクト向けに設計されています。
official
mcloud-environments
medusajs
mcloud environments コマンドを実行して、Cloud環境の一覧表示、取得、作成、削除、再デプロイ、またはビルドのトリガーを行います。環境のライフサイクル管理時に使用します。
official
db-generate
medusajs
単一のコマンドでMedusaモジュールのデータベースマイグレーションを生成します。npx medusa db:generate CLIコマンドをラップして、指定されたMedusaモジュールのマイグレーションファイルを作成します。モジュール名を引数として受け取り、マイグレーションファイルの場所、エラー、次のステップを報告します。生成後にnpx medusa db:migrateを実行してマイグレーションを適用することを自動的に提案します。
official
mcloud-deployments
medusajs
mcloud deploymentsコマンドを実行して、デプロイメントの一覧表示、デプロイメント詳細の取得、ビルドログの取得を行います。デプロイメントの一覧表示時やデプロイメントの確認時に使用します…
official
building-with-medusa
medusajs
Medusaバックエンドアーキテクチャ、ワークフロー、および重要な実装ルールに関する包括的なガイド。6つのルールカテゴリ(アーキテクチャ、型安全性、ビジネスロジックの配置、インポート、データアクセス、ファイル構成)をカバーし、具体的なアンチパターンと実施チェックを含む。厳格なレイヤー分離を強制:Module → Workflow → API Route → Frontend。すべてのミューテーションにワークフローが必要で、GET/POST/DELETEのHTTPメソッドのみ許可。重要なデータ処理ルールを含む:価格はそのまま保存...
official