Install the Metorial CLI and sign in from your terminal
Install metorial and metorial-admin with one script, npm, Homebrew or Scoop, sign in with metorial login, and use an API key instead of a browser in CI.
Metorial ships two command-line tools. metorial is for people who use a portal: it connects apps, calls their tools and installs them into AI clients. metorial-admin is for the people who run the organization: portals, groups, Magic MCP, logs and API keys. One script installs both, and metorial login signs you in through your browser.
What you'll learn
- How to install both CLIs on macOS, Linux and Windows
- How to sign in, switch profiles and check who you are
- How to run the CLI in CI with an API key
Before you start
- An account in a Metorial portal for
metorial, or a member account in a Metorial organization formetorial-admin - A terminal on the machine where your AI client runs
Install the CLI
On macOS or Linux, run the install script. It downloads both binaries for your CPU, checks their SHA-256 checksum, and places them in ~/.metorial/cli. It then links metorial and metorial-admin into /usr/local/bin when that directory is writable, and into ~/.local/bin otherwise.
To pin a release or choose the directory for the links, set METORIAL_CLI_VERSION or METORIAL_CLI_BIN_DIR for the script:
The script supports macOS and Linux on amd64 and arm64. On other systems, use a package manager.
To run a CLI once without installing it, use npx @metorial/cli@latest or npx @metorial/admin@latest.
Check the install:
Sign in
Start the sign-in
Run metorial login, or metorial-admin login for the admin CLI. The CLI opens your browser and prints the same link with a verification code, so you can open it yourself on a machine without a browser.
Approve the request
The page is titled Authorize Metorial CLI. For metorial-admin, choose your Organization. For metorial, choose your Portal. Then select Grant Access. The tab closes and the CLI saves a profile in ~/.metorial/cli/config.json.
Check who you are
The output shows your name and email, the portal, the instance, and the groups you belong to.
metorial logout removes the current profile from the machine.
Switch between profiles
Each sign-in creates a profile, and the latest one becomes current. Signing in again to the same organization updates the existing profile.
In the admin CLI the same commands live under cli: metorial-admin cli profile list and metorial-admin cli profile set <profile-name-or-id>. An admin profile can reach several instances, so pass --instance <instance-id> to choose one. metorial-admin instance list shows the IDs.
Change the output format
Every command accepts --format with structured (the default), json, yaml or toml. Use json in scripts.
Use an API key in CI
A build machine has no browser. Pass a key instead of signing in. The CLI reads it from the --api-key flag, then METORIAL_API_KEY, then METORIAL_TOKEN.
METORIAL_INSTANCE_ID does the same job as --instance. If you run Metorial yourself, point the CLI at your API with --api-host, METORIAL_API_HOST, or metorial settings set default_api_host <host>. To create a key, see API keys for CI and agents.
Turn on shell completion
completion also has bash, fish and powershell subcommands, and metorial-admin completion works the same way.
Upgrade
metorial upgrade detects how the CLI was installed and upgrades it the same way.
Troubleshooting
Authentication Required
The full message is "Sign in with metorial login to use your saved profile on this machine." No profile is saved and no key is set. Run metorial login, or set METORIAL_API_KEY.
metorial: the login session expired before it was completed. Run "metorial login" to try again
The sign-in link is valid for 15 minutes. Run the login command again and approve the request in the browser before it runs out.
metorial: CLI login is not enabled on this host
The API host you are pointing at does not offer browser sign-in. Check --api-host and METORIAL_API_HOST, or use an API key.