Set up from the command line (soon)
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 in the meantime. This page describes what the CLI will do so you know what to expect.
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
Sign in
$ pnpm dlx @ui-rules/cli login
Your browser will open to pick the project. The CLI holds onto the choice, so you sign in once.
Connect your tool, then restart it
For Claude Code:
$ pnpm dlx @ui-rules/cli setup claude
For Cursor in this repo:
$ pnpm dlx @ui-rules/cli setup cursor
For Cursor across every project:
$ pnpm dlx @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.
For any other tool, or to see what the CLI writes, follow that tool's own guide from the 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.
$ pnpm dlx @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.
