MCP
Connect AI assistants to the SUI registry.
Use the official shadcn MCP server to browse the SUI registry from your AI assistant. The server runs locally over stdio and reads the consuming application's components.json. SUI supplies registry JSON files; the registry URL is an HTTP data source, not an MCP endpoint.
For API guidance and complete usage examples, provide the assistant with LLMs documentation. MCP queries and inspects installable source. Its get_add_command_for_items tool returns a CLI command; the assistant then runs the command in your application to install the files.
GitHub CLI installs also work without the namespace: npx shadcn@latest add draco-china/sui/button. The MCP examples below retain the optional @sui configuration for registry discovery.
Configure the application
Prepare the consuming application using Installation. Merge this registry entry into its existing components.json, preserving the application's aliases and CSS configuration:
{
"registries": {
"@sui": "https://raw.githubusercontent.com/draco-china/sui/main/registry/r/{name}.json"
}
}The catalog is https://raw.githubusercontent.com/draco-china/sui/main/registry/r/registry.json. CLI and MCP share this configuration.
Open the consuming application in your MCP client and start the server from the directory containing its components.json. In a monorepo, use the application directory rather than a root directory without that file. The same configuration works with the CLI.
Configure the client
Run this from the consuming application, then restart or enable the server. --client takes claude, cursor, vscode, codex or opencode. For Claude Code, Cursor, VS Code and OpenCode it writes the project's client configuration; for Codex it prints the block to add yourself. Either way it also adds shadcn to the application's dev dependencies:
pnpm dlx shadcn@latest mcp init --client claudeThe configuration launches the official server, which talks to the client over stdin/stdout:
pnpm dlx shadcn@latest mcpTo write a configuration by hand, merge the client's entry below into the project's existing file. The examples launch the server with npx, as the shadcn CLI writes them; to use another package manager, swap the command and its arguments:
| Package manager | command | args |
|---|---|---|
| pnpm | "pnpm" | ["dlx", "shadcn@latest", "mcp"] |
| npm | "npx" | ["shadcn@latest", "mcp"] |
| yarn | "yarn" | ["dlx", "shadcn@latest", "mcp"] |
| bun | "bunx" | ["--bun", "shadcn@latest", "mcp"] |
The client process must find that command in its PATH.
Claude Code
Use the project's .mcp.json:
{
"mcpServers": {
"shadcn": {
"command": "npx",
"args": ["shadcn@latest", "mcp"]
}
}
}Restart Claude Code and use /mcp to check the connection.
Cursor
Use the project's .cursor/mcp.json:
{
"mcpServers": {
"shadcn": {
"command": "npx",
"args": ["shadcn@latest", "mcp"]
}
}
}Enable the shadcn server in Cursor's MCP settings and check that its tools are listed.
VS Code
For GitHub Copilot, use the project's .vscode/mcp.json. VS Code uses the servers key:
{
"servers": {
"shadcn": {
"command": "npx",
"args": ["shadcn@latest", "mcp"]
}
}
}Open the file and start the server through VS Code's MCP controls. The client file locations and keys follow the official shadcn configuration guide.
Codex
mcp init --client codex writes no file; add this block yourself, to the project's .codex/config.toml or to ~/.codex/config.toml for every project. In a monorepo, add cwd with the application's absolute directory so the server reads its components.json:
[mcp_servers.shadcn]
command = "npx"
args = ["shadcn@latest", "mcp"]Codex loads project configuration for trusted projects. Open or restart the project after editing and verify that the server's tools are available. See the official OpenAI documentation for project configuration and MCP settings.
OpenCode
Use the project's opencode.json:
{
"$schema": "https://opencode.ai/config.json",
"mcp": {
"shadcn": {
"type": "local",
"command": ["npx", "shadcn@latest", "mcp"],
"enabled": true
}
}
}Restart OpenCode and check that the server's tools are listed.
Browse, inspect, and install
Ask the assistant to use the @sui namespace explicitly:
Search @sui for table components, inspect @sui/data-table and its dependencies, then install it in this application and adapt the documentation example to my aliases.
The server exposes these tools for the workflow:
| Tool | Purpose |
|---|---|
get_project_registries | Confirm that the application has configured @sui. |
list_items_in_registries | List entries in @sui. |
search_items_in_registries | Search names and descriptions in @sui. |
view_items_in_registries | Inspect an item's manifest and file contents. |
get_add_command_for_items | Return the CLI command for the selected items. |
For example, search with registries: ["@sui"] and query: "table", then inspect items: ["@sui/data-table"]. After obtaining the add command, the assistant runs it from the consuming application directory. The equivalent command is:
pnpm dlx shadcn@latest add @sui/data-tableReview the installed files, styles, and dependencies. See CLI for previewing changes and Compatibility for runtime requirements.
SUI's catalog contains installable components, blocks, layouts, viewers, chat, charts, styles, and helpers, without separate demo or example entries. Use LLMs documentation for complete examples and API guidance rather than expecting MCP's example search to return @sui/*-demo items.
Troubleshooting
| Symptom | Check |
|---|---|
| GitHub registry returns 404 | Check the configured URL, access to the repository, and whether the requested item exists. |
Unknown registry or missing @sui | Check the namespace in the consuming application's components.json, then call get_project_registries. |
| Server reads a different project | Check its working directory. It must point to the consuming application containing components.json; restart after changing it. |
| The server command is not found | Ensure the client process can find npx (or the pnpm, yarn or bunx you configured) in PATH, or use the executable's absolute path in its server configuration. |
| Tools appear but installation does not happen | get_add_command_for_items returns a command. The assistant still needs to execute it in the application. |
To isolate registry problems, run these commands from the same application directory as MCP:
pnpm dlx shadcn@latest search @sui -q button
pnpm dlx shadcn@latest view @sui/buttonSee Registry for configuration and item contents, and CLI for installation and updates.