Skip to content

Installing the CLI

The mecca CLI is a Node package that you install on your local machine. It's how you interact with the AppMecca platform — building images, deploying apps, checking logs, and more.

Install

Both routes install the same package from npm.

Right now the two routes can differ by a version

Homebrew pins an explicit release; npm installs whatever the latest tag points at. Those are temporarily out of step — npm pins latest to a package's first publish, so with only pre-releases out it can sit on an older one.

Ask the registry rather than trusting this page, which cannot know when the two reconverge:

npm view appmecca dist-tags

If latest is behind, install that one version explicitly, once — npm install -g appmecca@0.1.0-alpha.4 or whatever alpha reports.

⚠ Do not pin @alpha as a habit. Once a stable release ships, latest tracks stable and an @alpha pin would silently hold you on pre-releases for good. It is a one-off correction, not a setting.

Homebrew (macOS)

brew tap appmecca/tap https://gitlab.com/appmecca-public/appmecca-homebrew-tap.git
brew trust appmecca/tap
brew install appmecca      # or: brew install mecca — same formula

Homebrew pulls Node in as a dependency, so you do not need it installed first. brew upgrade works normally afterwards.

Both of the one-time steps are structural, not optional:

  • The long-form tap URL — brew tap user/repo resolves to GitHub, and this tap is on GitLab, so the URL must be given explicitly.
  • brew trust — Homebrew 6 refuses to load a formula from an untrusted third-party tap. Skipping it makes brew install fail rather than prompt.

npm

npm install -g appmecca

Requires Node ≥ 22.19. npx appmecca <command> works too, without installing.

The package is appmecca; the command is mecca

Installing the appmecca package puts exactly one executable on your PATH: mecca. That's the CLI in this guide. The package name and the command name differ because the package's bin map says so.

On Homebrew, brew install appmecca and brew install mecca are the same formula — appmecca is an alias. Neither installs a binary called appmecca.

pip and pipx do not work

Nothing is published to PyPI — pip install appmecca fails, and always has. An older version of this page said otherwise; it was wrong. The CLI is distributed through npm and Homebrew only.

appmecca is a different tool

The administrator CLI used for provisioning and tearing down environments is also called appmecca, but it is a separate program installed by cloning its repository — never from npm, Homebrew or PyPI. If a page tells you to run an appmecca … command, that's a task for your platform administrator.

Verify Installation

mecca --version

You should see something like:

0.1.0-alpha.3

Alpha versioning is expected

The CLI is published as a pre-release while the TypeScript rewrite lands. The exact number moves with each release — treat the one above as a shape, not a target. npm install -g appmecca@alpha always takes the newest pre-release.

Configure API Access

The mecca CLI is a thin HTTP client that talks to the deployed AppMecca API — it does not need any cloud-provider credentials. Instead, it needs to know where the API is and how to authenticate.

The API URL is stored in ~/.appmecca/mecca.conf. Set it yourself with mecca configure -e <env> (below); your administrator gives you the URL.

Each environment gets its own section in mecca.conf with its API URL and environment name.

Cloud credentials are for administrators only

Only the appmecca admin CLI needs cloud credentials (for infrastructure setup/teardown). If you're an app developer using mecca, all you need is the API URL and an account on the environment.

Configure Default Environment

If you're always working with the same environment (e.g., dev), configure a default so you don't have to type -e dev on every command:

mecca configure -e dev

This runs an interactive setup that stores the API URL and default environment in ~/.appmecca/mecca.conf. No api-key prompt — authentication happens separately via mecca login (the resulting session token supersedes any key on disk).

To see all configured environments:

mecca configure list

To test connectivity to a configured environment:

mecca configure test -e dev

With a default environment set:

# Instead of:
mecca app deploy -e dev myapp

# You can just run:
mecca app deploy myapp

Explicit flags always win

If your default is dev but you run mecca app deploy -e staging myapp, it uses staging. The -e flag always overrides the configured default.

Set a Default App

If you're always working with the same app, set an environment variable. It supplies the default for the -a/--app option on filter-style commands (e.g. mecca queue list -a myapp, mecca build list --app myapp):

export APPMECCA_APP=myapp

Environment resolution order

mecca resolves the environment from, in order: the explicit -e/--env flag → the APPMECCA_ENV environment variable → the [default] section of ~/.appmecca/mecca.conf.

There is no APPMECCA_BRANCH

Branch is not settable via an environment variable. Pass -b/--branch explicitly; commands that take it default to main, except those that default to the app's registered branch.

Note that most mecca commands take the app as a positional argument (mecca app deploy myapp), which APPMECCA_APP does not fill in — it only backs the -a/--app option.

Git Authentication

AppMecca builds your Docker images by cloning your Git repository. If your repo is private, the build needs credentials that can reach it.

The quickest way is to link your GitHub or GitLab account from the dashboard at https://dashboard.<env>.appmecca.net, then register your app through the repository picker. AppMecca binds that identity to the app, and every build clones with it — no key handling on your side. See Private Repositories for details.

SSH Deploy Keys

For CI/CD pipelines or shared environments, your administrator sets up a per-environment SSH deploy key using the admin CLI (these are not mecca commands — you cannot run them yourself):

# Administrator generates an SSH key for the environment
appmecca git-auth setup -e dev

# Administrator displays the public key
appmecca git-auth show-key -e dev

The administrator gives you the public key, and you add it as a deploy key in your Git hosting provider:

  • GitHub: Repository Settings → Deploy Keys → Add Deploy Key
  • GitLab: Repository Settings → Repository → Deploy Keys

One key per environment

Each AppMecca environment has its own SSH key. If you deploy to both dev and staging, your administrator needs to set up keys for both. These commands live on the appmecca admin CLI (not mecca) because they write to the platform secret store.

Authentication

mecca is the tenant CLI — every user has their own session bound to their email + group memberships. There are two ways to authenticate:

Option 1: Tenant session (the normal flow)

Sign in straight from the CLI (or on the dashboard at https://dashboard.<env>.appmecca.net, whichever you prefer):

mecca login you@example.com -e dev

⚠ There is no password. The command opens a browser to an authorize screen that says which machine is being granted access, for how long, and how to revoke it; approve it there and the CLI receives its session.

⚠ Signing up and signing in are the same act — mecca signup exists as a friendlier name for a first-time user, but login on an address with no account creates one. (mecca register <git-url> is unrelated: that registers an app.)

If you cannot open a browser on this machine, pass --no-browser and the URL is printed for you to open elsewhere.

The session token is stored at ~/.appmecca/session.json (mode 0600, per-environment). Verify with:

mecca whoami -e dev

Output shows your resolved scope: Logged in as <email> + your group memberships. When you list apps you'll see Apps (env · group: your-team) — scoped to apps in your group only.

To log out:

mecca logout -e dev

Option 2: API key (CI / scripts)

For non-interactive use, ask your administrator to mint a per-user api-key scoped to what your pipeline needs (read, deploy, or admin). There is no mecca api-key command — key creation is an administrator operation.

Use the key via the env var (preferred — no on-disk footprint):

export APPMECCA_API_KEY=am_k1_abc123...

Or persist it in mecca.conf for that env. mecca configure doesn't prompt for keys, so add the line by hand:

[dev]
environment = dev
api_url = https://api.dev.appmecca.net
api_key = am_k1_abc123...

Auth priority

mecca prefers a session over an api-key. Order: APPMECCA_API_KEY env var → session token from ~/.appmecca/session.json → api-key from ~/.appmecca/mecca.conf → EdDSA SSH key. The first successful method wins.

⚠️ Don't store the platform-admin root key in mecca.conf

The appmecca config api-key generate command (admin-side) writes the platform admin root key to ~/.appmecca/appmecca.conf — NOT mecca.conf. This separation is deliberate:

  • ~/.appmecca/appmecca.conf — admin credentials read by the appmecca CLI.
  • ~/.appmecca/mecca.conf — tenant config read by the mecca CLI. mecca configure writes only the API URL; api-keys (if you use one) are added by hand or via APPMECCA_API_KEY.

If a platform-admin api-key has ended up in mecca.conf, mecca logout removes it (whatever its scope) and mecca login signs you in as yourself:

mecca logout -e dev     # revoke the session AND remove any saved api-key
mecca login you@… -e dev

mecca logout keeps the api_url and removes only the api_key line. It cannot revoke the key itself: that stays valid until an operator revokes it.

How long a login lasts

A login lasts 24 hours unused and 90 days at most. Each use slides the 24 hours; the 90 days never move. Exit code 4 means the session has ended: run mecca login again, and never retry the command. A script that checks a session reads is_authenticated from mecca whoami --json, because whoami exits 0 even when nobody is logged in.

Keeping a machine signed in (personal keys)

To keep a machine of yours (a Mac mini, a build box) signed in past the 24-hour gap, sign in once with a personal key:

mecca login --with-api-key -e dev   # in a terminal: approve in the browser; nothing is pasted
mecca login --keep -e dev           # the same, and the spelling for scripts and SSH

Both open the browser sign-in. The page is titled "Allow a personal API key for this machine?" and its button reads "Allow key and sign in" (a plain mecca login shows "Authorize this machine?" and "Authorize" instead). It shows the key's name (by default this machine's name, such as Euans-Mac-mini-2 (darwin arm64); --name <label> picks another) and says the key gets what your account can do through your group memberships, "but never platform-administrator power". The key "does not expire on its own unless the command gave it an end date"; the session behind the sign-in lasts 24 hours from its last use, at most 90 days. Once you allow it, mecca creates the key (am_u1_…) in your name and saves it in ~/.appmecca/keys.json (mode 0600), one per environment. From then on the machine uses that key before any session. --expires <duration> gives it an end date; without one it never expires on its own. The key is never printed. mecca whoami says "personal key ''" when that is what it used, and mecca key list and mecca key revoke show and end your keys. You can also revoke a key on the dashboard, under Profile & security → Personal API keys.

If you press "Refuse" instead, the terminal shows "Sign-in was not approved", exits 1, and nothing is stored: no session and no key.

Only a sign-in you approved for a key can create one. A plain mecca login, a dashboard session or an older CLI cannot; mecca key create works only on a session whose browser approval was for a personal key.

If the machine already has a key. Before the browser opens, mecca checks keys.json: if this machine already holds a key for that environment, it says so and asks "Replace it with a new key? [y/N]". After you sign in it also checks your account: if you already have an unrevoked key of the same name that this machine does not hold (for example after a reinstall wiped keys.json; an expired key counts), it asks the same. "n" changes nothing. Outside a terminal there is no question: pass --replace to replace, or the command stops with exit 1. A replace is one step on the server: the old key stops working only once the new one exists, and a failure leaves the old key working. After a replace the terminal says "This machine now uses the personal key '' (…), which keeps it signed in until you revoke it." followed by "It replaced '' (…), which no longer works."

Listing your keys. mecca key list prints one row per key with the columns NAME, PREFIX, CREATED, LAST USED (with the address it came from), EXPIRES and STATUS, and "this machine" in a last column for the key this machine holds. STATUS is active, expired <time> or revoked <time>: revoked and expired keys stay in the list. With no keys it says "No personal keys yet" and suggests mecca login --keep.

Logging out. mecca logout also revokes this machine's personal key and removes it from keys.json: "Revoked this machine's personal key '' and removed it." If the server does not confirm the revoke, which is what happens for a key that was already revoked, it warns "Removed this machine's personal key '', but the server did not confirm the revoke. Revoke it on your Profile & security page." With --keep-key the key is left alone and the terminal says "Kept this machine's personal key; it stays signed in by that key."

On the dashboard. Profile & security → Personal API keys lists your keys with their name, prefix, created, last used and expiry, and revoked keys stay listed with a "Revoked" badge. Each live key has a "Revoke…" button; it asks "Revoke the key ?" ("The machine holding it stops working at once, and needs mecca login --keep to sign in again.") and a "Key revoked" toast follows. The page has no control to create a key: only a sign-in approved for a key (mecca login --keep) creates one.

A personal key is you: it can do what you can do in your own groups, never more, and it never makes you a platform admin on that machine.

Which to use. A personal key is for a person's own machine. An operator API key (next section) is for a script or machine that acts as an operator, not as you. In a terminal --with-api-key makes a personal key; with a key piped on stdin it saves that operator key, which is refused on a machine that holds a personal key for that environment (revoke it or mecca logout first).

When a key stops. A key ends when you revoke it, when it expires, or when your account is locked or disabled: a lock or a disable revokes every personal key you have, and an unlock or an enable does not bring them back, so each machine needs mecca login --keep again afterwards. While the account is locked or disabled the machine says so ("Account locked — contact your platform operator" or "Account disabled — contact your platform operator"); that is for an operator to resolve, not a login you can run. mecca logout revokes this machine's key unless you add --keep-key.

Signing in with an API key (operators)

An operator who wants a machine to stay signed in past a 24-hour gap can save an API key they already hold. The key never expires on its own; it lasts until an operator revokes it.

printf '%s' "$KEY" | mecca login --with-api-key -e dev   # the key is piped on stdin

The key is read from stdin only, never from the command line or a prompt (in a terminal with nothing piped, --with-api-key creates a personal key instead, above), and is never printed. An empty or silent stdin is refused at once. mecca checks the key with one whoami and saves it only if the server accepts it. It is saved in ~/.appmecca/mecca.conf (mode 0600), ends any stored session for that environment, and is also read by appmecca on that machine as its last fallback credential. A platform-admin key is refused unless you add --allow-admin. mecca logout removes it.

Verify Everything Works

Confirm the CLI can reach the environment's API and that you're authenticated:

mecca configure test -e dev   # connectivity
mecca whoami -e dev           # who the API thinks you are

If both succeed, you're ready to go. Head to the Quick Start to deploy your first app.

Command Reference

Run mecca --help to see all available commands:

mecca --help

Every command group also has its own help:

mecca app --help      # deploy, redeploy, retry, logs, backup, publish/protect, …
mecca build --help    # trigger, status, logs, list
mecca var --help      # environment variables
mecca queue --help    # inspect and cancel queued actions