use Command - Medusa Cloud CLI Reference
Select the active organization, project, and environment, and persist the selection in a context configuration file. Subsequent CLI commands read this configuration so you don't need to repeat --organization, --project, and --environment on every command.
When run without flags, the command launches an interactive picker for each value. Pass any of --organization, --project, or --environment to set them non-interactively.
Options#
Option | Description | Required |
|---|---|---|
| The ID of the organization to set as active. Skips the interactive organization picker. | No |
| The ID or handle of the project to set as active. Skips the interactive project picker. | No |
| The handle of the environment to set as active. Skips the interactive environment picker. | No |
| Remove the persisted organization, project, and environment selection. Run before switching accounts or to reset the context. | No |
| Print the result as JSON instead of formatted text. | No |
Set the Active Context#
Interactively#
Run mcloud use without flags to pick each value from a list. The CLI prompts you to select an organization (if you're in more than one), a project, and an environment from the active project:
After saving, every subsequent command operates on the selected organization, project, and environment by default.
--organization, --project, and --environment directly. See Set the Active Context Non-Interactively below.Non-Interactively#
When working with AI agents, scripts, or CI/CD pipelines, you can set the active context non-interactively by passing any of --organization, --project, or --environment directly. For example:
You can also switch the active environment without changing the organization or project:
Inspect the Active Context#
Use mcloud whoami to see the active organization, project, and environment along with the authenticated user and CLI metadata:
Clear the Active Context#
To clear the persisted organization, project, and environment, pass --clear:
After clearing, commands that require these values will prompt for them or fail unless you pass them as flags or run mcloud use again.