# Agents
> Use Kokonut UI with Claude Code, Cursor, VS Code or Codex. Connect the shadcn MCP server, add a rules file, and give your agent the docs as Markdown.

Source: https://kokonutui.com/docs/agents

Kokonut UI is a shadcn/ui registry, so any agent that can run the shadcn CLI can install its components. Ask for a component by name, or describe what you need, and the agent finds it, installs it with its dependencies, and edits it in your codebase like any other file.

To have an agent do the whole setup, give it this prompt:

```text
Set up Kokonut UI in this project by following https://kokonutui.com/setup.md
```

If you are an agent setting up Kokonut UI, follow https://kokonutui.com/setup.md. Otherwise, follow the steps below.

## Add the registry

Agents install from the `@kokonutui` namespace, so add it to your `components.json` once. If you don't have one yet, run `shadcn init` first, as shown in [Installation](/docs).

```json title="components.json"
{
  "registries": {
    "@kokonutui": "https://kokonutui.com/r/{name}.json"
  }
}
```

## Connect your editor

The [shadcn MCP server](https://ui.shadcn.com/docs/mcp) lets your agent list, search and install components from any registry in `components.json`. One command sets it up for your editor:

### Claude Code

```bash
npx shadcn@latest mcp init --client claude
```

Or add it by hand to `.mcp.json`:

```json title=".mcp.json"
{
  "mcpServers": {
    "shadcn": {
      "command": "npx",
      "args": ["shadcn@latest", "mcp"]
    }
  }
}
```

Restart Claude Code, then run /mcp to check that shadcn is connected.

### Cursor

```bash
npx shadcn@latest mcp init --client cursor
```

Add to Cursor: cursor://anysphere.cursor-deeplink/mcp/install?name=shadcn&config=eyJjb21tYW5kIjoibnB4IiwiYXJncyI6WyJzaGFkY25AbGF0ZXN0IiwibWNwIl19

Or add it by hand to `.cursor/mcp.json`:

```json title=".cursor/mcp.json"
{
  "mcpServers": {
    "shadcn": {
      "command": "npx",
      "args": ["shadcn@latest", "mcp"]
    }
  }
}
```

Turn the server on in Cursor Settings, under MCP.

### VS Code

```bash
npx shadcn@latest mcp init --client vscode
```

Add to VS Code: vscode:mcp/install?%7B%22name%22%3A%22shadcn%22%2C%22command%22%3A%22npx%22%2C%22args%22%3A%5B%22shadcn%40latest%22%2C%22mcp%22%5D%7D

Or add it by hand to `.vscode/mcp.json`:

```json title=".vscode/mcp.json"
{
  "servers": {
    "shadcn": {
      "command": "npx",
      "args": ["shadcn@latest", "mcp"]
    }
  }
}
```

Open .vscode/mcp.json and click Start next to the shadcn server.

### Codex

```bash
npx shadcn@latest mcp init --client codex
```

Or add it by hand to `~/.codex/config.toml`:

```toml title="~/.codex/config.toml"
[mcp_servers.shadcn]
command = "npx"
args = ["shadcn@latest", "mcp"]
```

Restart Codex. It reads the server from your global config.

Any other client that speaks the Model Context Protocol works too: point it at `npx shadcn@latest mcp`.

## Ask your agent

Restart your editor, then ask in plain language. Each prompt copies.

- "Show me every component in the @kokonutui registry"
- "Add @kokonutui/particle-button to my project"
- "Add an AI chat input with a model picker to the home page"
- "Build a pricing section with @kokonutui components"

The agent installs a component's shadcn/ui primitives (like `button` or `textarea`) and npm packages (like `motion` or `lucide-react`) along with it, exactly as the CLI does.

## Add a rules file

A short rules file tells your agent to check Kokonut UI before building a component from scratch, and to install rather than paste code. Save it in your project under the file name shown for your editor.

### Claude Code: `CLAUDE.md`

```markdown title="CLAUDE.md"
# Kokonut UI

This project installs components from Kokonut UI, a shadcn/ui registry.
The registry is set in components.json as "@kokonutui".

- Before building an animated or interactive component from scratch, check
  Kokonut UI: https://kokonutui.com/llms.txt lists every component with a
  one-line description.
- Install with the shadcn CLI, never by pasting code:
  npx shadcn@latest add @kokonutui/<name>
  It writes components/kokonutui/<name>.tsx and installs its dependencies.
- Installed components are project code. Edit them in place rather than
  wrapping them.
- Any docs page is available as Markdown, with the full source, by adding
  .md to its URL, e.g. https://kokonutui.com/docs/buttons/particle-button.md
```

### Cursor: `.cursor/rules/kokonutui.mdc`

```markdown title=".cursor/rules/kokonutui.mdc"
---
description: Installing and editing Kokonut UI components
alwaysApply: false
---

# Kokonut UI

This project installs components from Kokonut UI, a shadcn/ui registry.
The registry is set in components.json as "@kokonutui".

- Before building an animated or interactive component from scratch, check
  Kokonut UI: https://kokonutui.com/llms.txt lists every component with a
  one-line description.
- Install with the shadcn CLI, never by pasting code:
  npx shadcn@latest add @kokonutui/<name>
  It writes components/kokonutui/<name>.tsx and installs its dependencies.
- Installed components are project code. Edit them in place rather than
  wrapping them.
- Any docs page is available as Markdown, with the full source, by adding
  .md to its URL, e.g. https://kokonutui.com/docs/buttons/particle-button.md
```

### VS Code: `.github/copilot-instructions.md`

```markdown title=".github/copilot-instructions.md"
# Kokonut UI

This project installs components from Kokonut UI, a shadcn/ui registry.
The registry is set in components.json as "@kokonutui".

- Before building an animated or interactive component from scratch, check
  Kokonut UI: https://kokonutui.com/llms.txt lists every component with a
  one-line description.
- Install with the shadcn CLI, never by pasting code:
  npx shadcn@latest add @kokonutui/<name>
  It writes components/kokonutui/<name>.tsx and installs its dependencies.
- Installed components are project code. Edit them in place rather than
  wrapping them.
- Any docs page is available as Markdown, with the full source, by adding
  .md to its URL, e.g. https://kokonutui.com/docs/buttons/particle-button.md
```

### Codex: `AGENTS.md`

```markdown title="AGENTS.md"
# Kokonut UI

This project installs components from Kokonut UI, a shadcn/ui registry.
The registry is set in components.json as "@kokonutui".

- Before building an animated or interactive component from scratch, check
  Kokonut UI: https://kokonutui.com/llms.txt lists every component with a
  one-line description.
- Install with the shadcn CLI, never by pasting code:
  npx shadcn@latest add @kokonutui/<name>
  It writes components/kokonutui/<name>.tsx and installs its dependencies.
- Installed components are project code. Edit them in place rather than
  wrapping them.
- Any docs page is available as Markdown, with the full source, by adding
  .md to its URL, e.g. https://kokonutui.com/docs/buttons/particle-button.md
```

## Docs for agents

Every page on this site is also served as Markdown, so an agent can read the docs without a browser. Each component page includes its install command and full source.

- `https://kokonutui.com/setup.md`: Setup steps written for an agent: registry, MCP server and rules file. The setup prompt points here.
- `https://kokonutui.com/llms.txt`: Index of every docs page, with a one-line description and a link to its Markdown.
- `https://kokonutui.com/llms-full.txt`: Every docs page in one file, component source included. Large; for agents that read it once.
- `https://kokonutui.com/docs/<page>.md`: Any docs page as Markdown, with its install command and full source. The Copy Markdown button on each page copies the same text.
- `https://kokonutui.com/r/registry.json`: The shadcn registry index: every component with its dependencies and files.
- `https://kokonutui.com/r/<name>.json`: One component's registry item, the file the CLI and the MCP server install from.

At the top of every page, **Copy Markdown** copies the page for a chat, and **Open** sends it to ChatGPT, Claude or Cursor.
