MetorialDocs

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

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.

curl -fsSL https://cli.metorial.com/install.sh | bash

To pin a release or choose the directory for the links, set METORIAL_CLI_VERSION or METORIAL_CLI_BIN_DIR for the script:

curl -fsSL https://cli.metorial.com/install.sh | METORIAL_CLI_VERSION=0.1.9 METORIAL_CLI_BIN_DIR="$HOME/bin" bash

The script supports macOS and Linux on amd64 and arm64. On other systems, use a package manager.

# npm
npm install -g @metorial/cli
npm install -g @metorial/admin

# Homebrew
brew install metorial/tap/metorial
brew install metorial/tap/metorial-admin
# Scoop (Windows)
scoop bucket add metorial https://github.com/metorial/scoop-bucket
scoop install metorial
scoop install metorial-admin

To run a CLI once without installing it, use npx @metorial/cli@latest or npx @metorial/admin@latest.

Check the install:

metorial version
metorial 0.1.9
commit: ddeaeb3bafefda686daf85a17dacafc164d96ee0
built: 2026-11-11T10:36:15Z

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.

Welcome to the Metorial CLI!

Please sign in to your Metorial account.

https://<your-api-host>/oauth/authorize?token=mtout_...

Verification Code: 1234-5678

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

metorial whoami

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.

metorial profile list
metorial profile set <profile-name-or-id>
metorial catalog list --profile <profile-id>

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.

metorial list --format json
metorial settings set default_format json

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.

export METORIAL_API_KEY=<your-api-key>
export METORIAL_INSTANCE_ID=<instance-id>
metorial-admin sessions list --format json

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

# zsh, for the current shell
source <(metorial completion zsh)

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.

Next steps