How to set up the shadcn/ui MCP Server in Claude
- Run the setup command from the project root using pnpm, or merge the manual example into your project’s .mcp.json.
- Restart Claude Code and open /mcp. Try searching the configured registry for a component you already know.
pnpm dlx shadcn@latest mcp init --client claude{
"mcpServers": {
"shadcn": {
"command": "npx",
"args": [
"shadcn@latest",
"mcp"
]
}
}
}Find the component your project can use
The server reads the registries configured in your project's components.json. Use it to compare available items and inspect their source before installing one. A component from a registry can add files and dependencies, so review the proposed changes before letting Claude apply them.
Compare dialog components
Ask Claude to show which dialog component the configured registries provide, identify its focus management and dismissal behavior, and give the proposed files and dependencies. Open the source in the registry and check that the imports match your project’s component style. After a test install, try closing the dialog with Escape and make sure focus returns to its trigger.
Keep registry access in the project
The standard registry works without additional configuration. Private registries can require their own URL and headers in components.json. Use the publisher’s environment-variable reference for private credentials and keep those values out of the committed configuration.