Mentra Miniapp SDK betaThe SDK is in beta, so its APIs may change before general availability.To put a miniapp in front of users, host it at an HTTPS URL and share the link, or get it listed in the Mentra Miniapp Store. See Publish your miniapp.Developing on Mentra Live? We recommend using the Mentra Bluetooth SDK.The developer tools are available in the Mentra App under Settings → Miniapp Developer Settings.Share feedback with an in-app bug report, on Discord, or by email at help@mentra.glass.
@mentra/miniapp-cli provides the mentra-miniapp command. It’s installed as a dev dependency in every scaffolded project, so your package.json scripts call it directly ("dev": "mentra-miniapp dev").
Run with no arguments to print the usage table.
The CLI is Bun-only: it ships as TypeScript and runs under Bun. Use bun (or bunx), not npx/Node.

dev

Validates miniapp.json, builds both layers, serves them over your LAN, and prints a QR of its local-network miniapp URL, http://<lan-ip>:<port>/. That URL serves miniapp.json like any miniapp URL, naming the build’s ZIP, <pkg>-<version>-<hash>.zip, and its SHA-256. <hash> is the first 8 hex digits of that SHA-256, so every build has its own file name. It also runs a dev sidecar WebSocket on the next port up, which tells the phone when a saved change is built and forwards the miniapp’s console back to your terminal (non-fatal if it can’t start). It watches for Wi-Fi/LAN-IP changes every 10 seconds and reprints the QR. The starting port comes from "port" in miniapp.json (default 3000); if it or its sidecar neighbor is busy, the CLI scans upward for a free adjacent pair. On the phone: In the Mentra App, open Settings → Miniapp Developer Settings → Scan Miniapp QR Code. Phone and laptop must share Wi-Fi. Ctrl+C stops everything. dev runs your miniapp the way an installed one runs: the Mentra App installs it from the URL and runs it from the phone, screen included, so everything your miniapp does in development (its storage, photo.url) works as it will once installed. Your screen can’t load files from the LAN server by relative URL, just as an installed one can’t. On each saved change the CLI tells the phone, which installs the new build and restarts the miniapp, screen and background. The phone also checks the URL each time the miniapp opens. It never asks your computer in the background.
Keep the CLI and computer running to get your changes. The phone keeps the build it installed, so the miniapp still opens from it while the computer is away, after a check of at most 5 seconds; start dev again and save, and the phone takes the change. You scan again only when the URL changes. A dev build is the package named in its miniapp.json, one tile per package, so you can scan several miniapps side by side. It stands in for an installed copy of its package until you uninstall it or install the release yourself: updates from another URL, a workspace and Fleet never replace it. Use dev --production to try the build users will get.

Production build

Serves the production build from your computer: how you try what users will get before you upload it. It builds as pack builds, with NODE_ENV=production, and serves that ZIP at the same kind of URL as dev, with the same plain-URL QR. miniapp.json names the ZIP pack would write and its SHA-256. Nothing is watched: a saved change neither rebuilds nor reloads. After a change, stop it and run it again. The Mentra App takes the new build from the same URL the next time it opens the miniapp, so you scan again only when the address changed. The phone keeps the build it downloaded, so the miniapp opens with your computer away. The bundle is unsigned unless you pass --sign or --signing-key; see Signing. --usb and --device work as they do for dev. It writes nothing to build/.
mentra-miniapp release is the former name of dev --production. It still runs for one more release of the CLI and says so. Its QR code is now a plain URL, not a miniapp://release one. Change scripts that call it to dev --production.

pack

Writes build/, a folder ready to upload as is to your miniapp’s URL (dev --production serves the same ZIP from your computer). It builds with NODE_ENV=production, verifies dist/, validates the manifest, copies miniapp.json + icon.png into dist/, and zips to build/<pkg>-<version>-<hash>.zip, where <hash> is the first 8 hex digits of the ZIP’s SHA-256. The same files always pack to the same ZIP, whenever and wherever you pack them, and with the same key to the same signed ZIP. It prints the bundle’s SHA-256 and its publisher key, or unsigned. build/ then holds what a miniapp URL serves: Your miniapp.json must not declare bundle or versions itself; pack fills them in. Upload the folder to any static host, such as GitHub Pages, Cloudflare Pages or R2, or S3. For each release, upload the ZIP before miniapp.json, so your URL never names a ZIP that isn’t there yet. Phones update when the ZIP’s SHA-256 changes, with or without a new version. See Publish your miniapp for hosting, the domain rule and getting listed. versions has one {version, url, sha256} entry per version, highest version first, at most 50. Each pack adds the version it packed, or replaces that version’s entry, and keeps the others:
  • With --url <your miniapp URL>, the ones the miniapp.json published there lists. Use it in CI: a clean checkout has no build/, and without --url it would write a list with one version. A URL that can’t be reached, or whose list can’t be read, stops the pack. Only a 404, nothing published yet, starts a new list.
  • Without --url, the ones in build/miniapp.json from the last pack whose ZIPs are still in build/.
See Versions people can pin.
build/ self-ignores from git with its own .gitignore; leave that file out if you deploy the folder by committing it to git.

Signing

Bundles are unsigned by default. --sign signs with the package’s stored publisher key (see keys); --signing-key <path> signs with a key file without storing it, for CI. CI can also set MENTRA_MINIAPP_SIGNING_KEY_FILE or MENTRA_MINIAPP_SIGNING_KEY_JSON together with --sign. A signed ZIP carries META-INF/MENTRA.SIG: the package’s Ed25519 public key and a signature over its package name, version, manifest and every file.
Signing is permanent for a package. The first signed bundle a phone installs records the publisher key, and from then on that phone accepts only bundles signed with the same key. An unsigned bundle or a different key is refused until the user uninstalls the miniapp. There is no key rotation, so back up the key (keys export) before you ship a signed bundle. Signing needs a lowercase reverse-DNS package name (letters, digits and underscores).

keys

Manages one publisher signing key per package. Keys are stored in the OS keychain, or in a mode-0600 file under ~/.mentra/cli-v2/signing-keys/ when the keychain refuses the write. If the keychain can’t be read, key commands stop without creating or changing a key; on machines without a keychain, such as CI, sign with --signing-key. show prints the key’s sha256: fingerprint. export writes the private key to a new file; keep it secret and in a secure backup.

manifest

An interactive wizard for miniapp.json: edit permissions and hardware requirements, show the current manifest, or finish. It saves after each confirmed change, so Ctrl+C never loses a saved edit.

permission and hardware

Object-verb edits that share the wizard’s validation:
Permission TYPE: MICROPHONE, CAMERA, CALENDAR, LOCATION, BACKGROUND_LOCATION, READ_NOTIFICATIONS, POST_NOTIFICATIONS. Hardware TYPE: CAMERA, DISPLAY, MICROPHONE, SPEAKER, IMU, BUTTON, LIGHT, WIFI; LEVEL: REQUIRED, OPTIONAL. See the manifest for what each means.

schema

Prints the canonical miniapp.json JSON Schema to stdout: useful for CI validation or IDE config. The same schema ships at node_modules/@mentra/miniapp-cli/schema/miniapp.schema.json, which the $schema line in a scaffolded miniapp.json references for editor autocomplete.