---
title: "Set up from the command line (soon)"
description: "The UI Rules CLI will connect Claude Code or Cursor from a terminal and export your design tokens as a file your app imports. It is not published yet."
label: "Command line (soon)"
date: "2026-09-28"
---

<Callout type="warn">
The CLI is not published yet, so the commands on this page do not run today. Connect your tool with its own guide from the [Connect overview](/docs/connect/overview) in the meantime. This page describes what the CLI will do so you know what to expect.
</Callout>

The CLI will do two jobs: write the MCP config for Claude Code or Cursor, and export your design tokens to a file on disk. It will run with `npx`, so there will be nothing to install first, and it will need no copied key: signing in picks the project.

## Connect a tool

<Steps>
<Step>
### Sign in

```bash
npx @ui-rules/cli login
```

Your browser will open to pick the project. The CLI holds onto the choice, so you sign in once.
</Step>
<Step>
### Connect your tool, then restart it

For Claude Code:

```bash
npx @ui-rules/cli setup claude
```

For Cursor in this repo:

```bash
npx @ui-rules/cli setup cursor
```

For Cursor across every project:

```bash
npx @ui-rules/cli setup cursor --global
```

Each will merge into an existing config rather than replacing it. The config it writes holds no key: the tool signs in on its own. For Claude Code, the CLI will tell you to run `claude mcp login uirules` and restart Claude Code; for Cursor, to click **Authenticate** next to `uirules` in Cursor's MCP list.

To write the key into the file instead of signing in from the tool, add `--with-key`. The CLI will then warn you if the file is not ignored by git.
</Step>
</Steps>

For any other tool, or to see what the CLI writes, follow that tool's own guide from the [Connect overview](/docs/connect/overview).

## Export your tokens

Your rules stay in the MCP, where they are always fresh. Token values are different: a CSS file is imported by the app itself, so it has to exist on disk. That is what the export will be for.

```bash
npx @ui-rules/cli tokens --out src/styles/tokens.css
```

Omit `--out` and the content will print to stdout instead, so you can pipe it. Pass `--format` for `css` (the default), `tailwind-v4`, `tailwind-v3`, `dtcg`, or `json`.

`tailwind-v3` is the one format that is two documents, because it is two files in your app. With `--out` the stylesheet will go where you asked and the config will land beside it as `tailwind.config.uirules.cjs`, which Tailwind does not load on its own: merge it into your own config. Without `--out` both will print to stdout with a separator between them.

Re-run it whenever the brand's tokens change. Keeping a second copy of the *rules* in the repo would only drift, which is why the command will export tokens and nothing else.

## Related

<Cards>
  <Card title="Connect overview" href="/docs/connect/overview">The endpoint, keys, and every supported tool.</Card>
  <Card title="MCP tools reference" href="/docs/connect/tools-reference">What a connected agent can read and change.</Card>
</Cards>
