Capítulo 97 de 108
The shadcn MCP server lets AI assistants (Claude Code, Cursor, VS Code/Copilot, Codex, OpenCode) browse, search and install items from any shadcn-compatible registry using natural language, instead of manual CLI commands.
shadcn CLI.npx shadcn@latest mcp init --client <name>: One-command setup per client (claude, cursor, vscode, codex, opencode); Codex still requires manual edits to ~/.codex/config.toml since the CLI can't write it..mcp.json: Project-level config file (Claude Code) registering the shadcn MCP server: {"mcpServers": {"shadcn": {"command": "npx", "args": ["shadcn@latest", "mcp"]}}}.components.json#registries: Where custom/private registries are configured so the MCP server (and CLI) can reach them, with optional headers for auth.Accept/User-Agent: the CLI sends User-Agent: shadcn and Accept: application/vnd.shadcn.v1+json, application/json;q=0.9, letting a registry serve HTML to browsers and JSON to the MCP/CLI from the same URL.{
"mcpServers": {
"shadcn": { "command": "npx", "args": ["shadcn@latest", "mcp"] }
}
}
{
"registries": {
"@acme": "https://acme.com/r/{name}.json"
}
}
| Client | Setup command | Notes |
|---|---|---|
| Claude Code | mcp init --client claude | debug via /mcp |
| Cursor | mcp init --client cursor | enable in Cursor Settings |
| VS Code | mcp init --client vscode | Start button in .vscode/mcp.json |
| Codex | mcp init --client codex | must manually edit ~/.codex/config.toml |
| OpenCode | mcp init --client opencode | restart after |
~/.codex/config.toml; add the [mcp_servers.shadcn] block by hand.REGISTRY_TOKEN/API_KEY aren't set in .env.local.components.json#registries.shadcn is installed → check registry network access; for "No tools or prompts", clear npx cache (npx clear-npx-cache).@namespace syntax used in MCP prompts to target specific registries.