> ## Documentation Index
> Fetch the complete documentation index at: https://help.21st.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Overview

> One terminal tool for the whole of 21st — search, install, generate, publish, and manage.

`@21st-dev/cli` (binary `21st`) is the single command-line tool for everything 21st: search and install marketplace items, generate UI with [21st AI](https://help.21st.dev/ai.md), publish your own components, manage your profile, and wire the [21st MCP](https://help.21st.dev/ai/mcp.md) into your editor. The CLI and the MCP share one endpoint and one login, so a command returns exactly what an MCP client sees.

> [!NOTE]
>
> `@21st-dev/cli` supersedes the older `@21st-dev/registry` (publish/install)
> and `@21st-dev/magic` (Magic MCP) packages. Use `21st` for all of it. Old
> `@21st-dev/magic` configs still work — since 0.2.0 that package proxies to
> the same 21st MCP endpoint.

## Install

```bash theme={null}
npm i -g @21st-dev/cli
# or run without installing:
npx @21st-dev/cli search "pricing table"
```

## Sign in

```bash theme={null}
21st login     # sign in via the browser, saved locally to ~/.config/21st/auth.json
21st whoami    # show the signed-in account
21st usage     # tier, AI access, and remaining daily component-code retrieval quota
21st usage --json # structured account status in CLI 1.17.1+
21st logout    # clear the saved session
```

You can also authenticate with an [API key](https://21st.dev/settings/api-keys) instead of a browser session. The CLI resolves credentials in this order:

1. `--token` / `--api-key` flag
2. `TWENTYFIRST_TOKEN` env var
3. `API_KEY_21ST` env var
4. the stored `21st login` session

A retired `an_…` key left in either env var is skipped, so an old export can no
longer shadow a working `21st login` session.

Generation and iteration require AI enabled on your account and available
[credits](https://help.21st.dev/ai/pricing.md). Base Builder and Team subscriptions start with AI off.
`21st usage --json` reports this access as `aiGenerationEnabled`; it does not
report the AI credit balance. On older CLI versions, read the `21st AI generation`
line from `21st usage`. Without AI, search and retrieve components, then
adapt the code with your own coding agent.

> [!WARNING]
>
> `21st publish <component>` accepts a stored `21st login` session or a secret API
> key. Theme/template publishing and management commands (`edit`, `delete`,
> `profile`) still require a real `21st_sk_…` API key.

## What you can do

> [card] [Find & install](https://help.21st.dev/cli/find.md)
>
> Search components, themes, and templates; fetch code; install via shadcn;
> manage bookmarks, lists, and teams.

> [card] [Generate with 21st AI](https://help.21st.dev/cli/generate.md)
>
> Start a generation, list its drafts, refine a take, and grab the code.

> [card] [Publish & manage](https://help.21st.dev/cli/publish.md)
>
> Publish components, themes, and templates, then edit or unpublish them.

> [card] [Project-aware design](https://help.21st.dev/cli/design-runtime.md)
>
> Extract your project's Design Context, ground search and generation in it,
> review UI locally, and manage the design skills.

> [card] [Your profile](https://help.21st.dev/cli/profile.md)
>
> Read and replace your bento profile board and upload media from the CLI.

> [card] [Editor & MCP setup](https://help.21st.dev/cli/setup.md)
>
> Wire the 21st MCP into Cursor, Claude, VS Code, and install the skills.

> [card] [Command reference](https://help.21st.dev/cli/reference.md)
>
> Every command and flag in one table.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.