
Using Medusa Cloud
- 7 installs
- 207 repo stars
- Updated July 31, 2026
- medusajs/medusa-claude-plugins
Helps with ai & agent building tasks.
About
using-medusa-cloud is a Claude Code skill for ai & agent building. It helps solo builders move faster with AI-assisted coding.
- using-medusa-cloud
- AI & Agent Building
- AI-coding skill
Using Medusa Cloud by the numbers
- 7 all-time installs (skills.sh)
- +1 installs in the week ending Aug 4, 2026 (Skillselion tracking)
- Ranked #12,545 of 16,546 AI & Agent Building skills by installs in the Skillselion catalog
- Data as of Aug 4, 2026 (Skillselion catalog sync)
npx skills add https://github.com/medusajs/medusa-claude-plugins --skill using-medusa-cloudAdd your badge
Show developers this skill is listed on Skillselion. Paste this into your README.
| Installs | 7 |
|---|---|
| repo stars | ★ 207 |
| Last updated | July 31, 2026 |
| Repository | medusajs/medusa-claude-plugins ↗ |
What it does
Helps with ai & agent building tasks.
Files
Managing Medusa Cloud Resources
Operational guide for AI agents managing Medusa Cloud infrastructure through the mcloud CLI. Covers setup, deployments, debugging, environments, and variables.
Constraints
- Always pass `--json` when parsing CLI output. Plaintext output is for humans and may change without warning.
- Confirm context before mutating. Run
mcloud whoami --jsonbefore any state change. - Read before you write. Run a
getorlistbefore anydelete,redeploy, ortrigger-build. - Use `--yes` for destructive operations.
deletecommands require--yesin non-interactive mode. - Production environments cannot be deleted.
mcloud environments deleteerrors on production by design. - Never pass `--reveal` unless the user explicitly asks. Secret values appear in terminal scrollback and logs.
- `--json` and `--follow` are incompatible. Use bounded time windows (
--from/--to) with--jsonfor programmatic log ingestion.
CRITICAL: Load Reference Files When Needed
Load these references based on what you're doing:
- Setting up the CLI? → MUST load
setup.mdfirst - Debugging a failed deployment? → MUST load
debugging-deployments.mdfirst - Managing environments or variables? → MUST load
environments-and-variables.mdfirst
Minimum requirement: Load at least one reference file before executing multi-step workflows.
Quick Reference
Authentication Check
Always verify auth and scope before mutating state:
mcloud whoami --json | jq -e '.auth.kind != "none" and .organization.id != null'Exit code 0 = authenticated and scoped. Non-zero = stop and ask the user.
Set Context Once
mcloud use \
--organization org_123 \
--project proj_123 \
--environment productionCRITICAL: mcloud use without flags is interactive and fails in CI/Docker/piped input. Always pass flags.Deployment Status Routing
Route on backend_status (or storefront_status):
| Status | Meaning | Logs to check |
|---|---|---|
build-failed | Build step failed | mcloud deployments build-logs <id> |
deployment-failed | Runtime crashed after build | mcloud logs --deployment <id> |
timed-out | Exceeded time budget | Both: build-logs first, then runtime logs |
Redeployment Decision
| Command | When to use |
|---|---|
mcloud environments redeploy <env> | Fix is environment-side (variable change, infra) — reruns existing build |
mcloud environments trigger-build <env> | Fix is in source code on the tracked branch — starts new build |
Common Pitfalls
- TTY-only commands.
mcloud login,mcloud use(without flags), anddeletewithout--yesrequire a TTY. They fail in CI, Docker, or piped input. - `MCLOUD_TOKEN` precedence. When set, file-based credentials are ignored and
mcloud loginis rejected. Unset it to switch accounts. - Personal vs org access keys. Personal keys require
--organization; org keys are pre-scoped. - `organizations list` requires personal auth. Org access keys return 401 on this command.
- Build IDs vs deployment IDs.
depl_*= deployment ID; anything else = build ID (resolved to latest deployment).mcloud logs --deploymentaccepts both; other commands take build IDs only.
Reference Files
setup.md - CLI installation, authentication, context setup
debugging-deployments.md - Build/deployment failure recipes and log analysis
environments-and-variables.md - Environment lifecycle and variable managementDebugging Deployments
Inspecting Deployments
Status fields per deployment: backend_status and storefront_status.
Values: created, building, built, deploying, deployed, build-failed, deployment-failed, timed-out (backend only), canceled, idle.
# Most recent failed deployment
mcloud deployments list --json \
| jq -r '[.[] | select(.backend_status == "build-failed" or .backend_status == "deployment-failed")][0].id'
# Deployments for a specific commit
mcloud deployments list --commit a1b2c3d --json | jq '.'
# Only preview deployments
mcloud deployments list --environment-type preview --json | jq '.'
# Single deployment details
mcloud deployments get bld_01ABC123 --jsonBuild Failure Recipe
Use when backend_status == "build-failed":
# Find the most recent build-failed deployment
DEPLOYMENT_ID=$(
mcloud deployments list --json \
| jq -r '[.[] | select(.backend_status == "build-failed")][0].id'
)
# Inspect deployment metadata
mcloud deployments get "$DEPLOYMENT_ID" --json
# Read the build output
mcloud deployments build-logs "$DEPLOYMENT_ID"
# For storefront build failures
mcloud deployments build-logs "$DEPLOYMENT_ID" --type storefrontbuild-logs returns a build_status field. When failed, check metadata.failed_docker_layer via mcloud deployments get --json to identify the failing layer.
Deployment Failure Recipe
Use when backend_status == "deployment-failed" (build succeeded, runtime crashed):
# Find the most recent deployment-failed
DEPLOYMENT_ID=$(
mcloud deployments list --json \
| jq -r '[.[] | select(.backend_status == "deployment-failed")][0].id'
)
# Runtime logs for that deployment
mcloud logs --deployment "$DEPLOYMENT_ID" --limit 1000
# Error-level lines only
mcloud logs --deployment "$DEPLOYMENT_ID" --search error --limit 1000
# Filter by HTTP status
mcloud logs --deployment "$DEPLOYMENT_ID" --metadata status=500 --limit 1000
# Structured analysis
mcloud logs --deployment "$DEPLOYMENT_ID" --json | jq '.[] | {timestamp, source, message}'Note:--followcannot be combined with--json. Use bounded time windows with--from/--toand--jsonfor scripts.
Rerunning a Deployment
Two options — not interchangeable:
Redeploy (environment-side fix): Re-runs the active deployment's existing build. Use when the fix is a variable change or infra issue.
mcloud environments redeploy env_123Requires the environment to have an active deployment. If it doesn't, use trigger-build first.
Trigger build (source code fix): Starts a new build from the tracked branch. Use when the fix is in committed code.
mcloud environments trigger-build env_123Verify the new build:
mcloud deployments list --environment env_123 --limit 5 --json \
| jq '.[] | {id, backend_status, commit_hash, updated_at}'Environments and Variables
Managing Environments
Create a Preview Environment
mcloud environments create \
--name "Staging" \
--branch developInspect an Environment
mcloud environments get staging --json | jq '{id, name, type, status, external_id}'Delete an Environment
mcloud environments delete env_123 --yesCRITICAL: Production environments are protected —deletereturns a non-zero exit code. Always check thetypefield viaenvironments get --jsonbefore attempting a delete in automation.
Managing Environment Variables
Variables are scoped to a single environment.
List Variables
mcloud variables list --jsonGet a Variable
# By key (requires active project and environment)
mcloud variables get DATABASE_URL --json
# By ID (works without project/environment context)
mcloud variables get var_01XYZ --jsonReveal Secret Values
CRITICAL: Only pass --reveal when the user explicitly asks. Plaintext values appear in terminal scrollback, log aggregators, and process listings.mcloud variables get STRIPE_SECRET_KEY --reveal --json | jq -r '.value'Export to .env
Replicate a Cloud environment's variables locally:
mcloud variables list --reveal --json \
| jq -r '.[] | "\(.key)=\(.value)"' \
> .envCLI Setup and Authentication
One-time setup for the Medusa Cloud CLI. Skip steps whose checks already pass.
1. Check if CLI is Installed
mcloud --versionIf this exits 0 and prints a version, skip to Confirm Authentication.
2. Verify Node.js Version
The CLI requires Node.js v22+:
node --versionIf below v22, ask the user to upgrade (via nvm or the official installer). Do not upgrade without authorization.
3. Install the CLI
npm install -g @medusajs/mcloudVerify:
mcloud --versionIf not found, ask the user to check their global npm bin directory is on PATH.
4. Confirm Authentication
Ask the user if they have a Medusa Cloud account.
Has account:
mcloud loginOpens a browser to complete auth.
No account:
mcloud signup
mcloud loginNon-interactive environments (CI, Docker, headless):
export MCLOUD_TOKEN=<access-key>When MCLOUD_TOKEN is set, the CLI uses it on every command and mcloud login is rejected.
5. Verify Setup
mcloud whoami --jsonCheck auth and scope:
mcloud whoami --json | jq -e '.auth.kind != "none" and .organization.id != null'Setting the Active Context
Persist org, project, and environment so subsequent commands skip --organization, --project, --environment flags:
mcloud use \
--organization org_123 \
--project proj_123 \
--environment productionResolving Names to IDs
If you only have names:
# Resolve organization ID by name
ORGANIZATION_ID=$(
mcloud organizations list --json \
| jq -r '.[] | select(.name == "My Organization") | .id'
)
# Resolve project handle by name
PROJECT_HANDLE=$(
mcloud projects list --organization "$ORGANIZATION_ID" --json \
| jq -r '.[] | select(.name == "My Store") | .handle'
)
# Resolve environment handle by name
ENVIRONMENT_HANDLE=$(
mcloud environments list --organization "$ORGANIZATION_ID" --project "$PROJECT_HANDLE" --json \
| jq -r '.[] | select(.name == "Production") | .handle'
)
mcloud use \
--organization "$ORGANIZATION_ID" \
--project "$PROJECT_HANDLE" \
--environment "$ENVIRONMENT_HANDLE"Clearing Context
mcloud use --clear