Morpha UI

CLI

Install and manage Morpha UI components from your terminal with the morpha-ui CLI.

Overview

morpha-ui is a thin wrapper around the shadcn CLI that installs Morpha UI components from a gated registry. Free components install with no authentication; pro components require a one-time browser login. The CLI captures a short-lived token and forwards it to the registry when you run add — every other command is delegated straight to shadcn.

Installation

No install step — run it with your package manager's runner:

npx morpha-ui@latest add button
pnpm dlx morpha-ui@latest add button
bunx --bun morpha-ui@latest add button

Prerequisites

  • A project with shadcn/ui configured (a valid components.json in the project root).
  • Node.js ≥ 18.
  • For pro components, an approved account (plan: pro).

Authentication

Morpha UI authenticates through Clerk with a browser OAuth flow:

npx morpha-ui@latest login
  1. The CLI starts a temporary local server on 127.0.0.1:<random-port> and opens /cli/authorize in your browser (the URL is printed as a fallback).
  2. You sign in. If your account has pro access, the page redirects back to the local server with a signed token — you never copy/paste anything.
  3. The token is saved to ~/.morpha/config.json (permissions 0600).

The token is a JWT that expires after ~30 days. When it expires, add prompts you to run npx morpha-ui@latest login again.

Pro access is granted by the Morpha UI owner. A logged-in account without pro access sees an upgrade prompt and no token is issued.

Headless mode (CI)

When no browser is available, supply the token directly:

# paste a token captured from the authorize page
npx morpha-ui@latest login --token <jwt>

# or pass it ambiently to a single command (wins over the stored token)
MORPHA_TOKEN="$MORPHA_TOKEN" npx morpha-ui@latest add button

Commands

CommandDescription
npx morpha-ui@latest loginAuthenticate via browser (Clerk OAuth).
npx morpha-ui@latest login --token <jwt>Authenticate headless with a pasted token.
npx morpha-ui@latest logoutRemove the stored token.
npx morpha-ui@latest add <name> [args…]Add a component; extra args pass through to shadcn.
npx morpha-ui@latest listList all free and pro components.
npx morpha-ui@latest whoamiShow the current plan and token expiry (never the token).
npx morpha-ui@latest configShow the site, store path, and auth status.
npx morpha-ui@latest <other>Delegated to shadcn@latest.
npx morpha-ui@latest add button                 # add a component
npx morpha-ui@latest add card --overwrite       # overwrite existing files
npx morpha-ui@latest add theme --dry-run        # preview without writing
npx morpha-ui@latest whoami                      # check plan / expiry

Configuration

Two environment variables tune the CLI:

VariablePurposeDefault
MORPHA_TOKENAmbient token for add (wins over the stored token).
MORPHA_SITE_URLOverride the base URL the CLI talks to.https://morphaui.com

From MORPHA_SITE_URL the CLI derives the registry (${SITE}/r) and the authorize URL (${SITE}/cli/authorize).

The token store at ~/.morpha/config.json (chmod 0600) looks like:

{
  "token": "<jwt>",
  "site": "https://morphaui.com",
  "savedAt": "2026-06-11T10:00:00.000Z",
  "exp": 1752230400
}

The token is never printed — whoami and config only show the decoded plan and exp.

Troubleshooting

StatusMeaningFix
401Registry got no token.npx morpha-ui@latest login
403Token expired/invalid, or account not pro.npx morpha-ui@latest login
404Unknown component name.npx morpha-ui@latest list

On this page