MCP
Let Claude Code, Cursor, VS Code or Codex search and install components for you.
Set upStart here
The shadcn MCP server gives your agent tools to list, search, view and install items from the registries in your components.json. Once @nextui is set up, it works with nextui too. The quickest way is to pick your client when npm create nextui asks, or pass it up front:
$pnpm create nextui --client claude
Swap claude for cursor, vscode or codex. Already set up @nextui (with the command above or by hand)? Add only the server:
$pnpm dlx shadcn@latest mcp init --client claude
Then restart your client so it picks up the server. In Claude Code, /mcp should list shadcn as connected.
Try it
Ask in plain words and name @nextui so the agent looks in the right registry:
- "Show me the @nextui blocks for a pricing section"
- "Add the @nextui chat-input to the chat page"
- "Build a landing page from @nextui hero, features and pricing blocks"
The agent searches the catalog, reads the item and runs shadcn add for you, so files land in the same places as a manual install.
Keys and copies
The server reads NEXTUI_TOKEN from .env.local and sends it the same way the CLI does. Listing and searching are free. Each time the agent opens or installs an item, it fetches that item with your key, which counts as a copy. A free account gets 3 every 24 hours, and Builder removes the limit.
💡 If the agent reports "unauthorized", the key is missing or revoked: run npm create nextui again or check API keys.
Configure by handOptional
mcp init writes one of these files. Add it yourself if you prefer, then restart the client:
1{2"mcpServers": {3"shadcn": {4"command": "npx",5"args": [6"shadcn@latest",7"mcp"8]9}10}11}
Run the client from the project folder, so the server finds components.json and .env.local.