Implementation:21st dev Magic mcp shadcn registry add
| Knowledge Sources | |
|---|---|
| Domains | UI_Components, Build_Tooling |
| Last Updated | 2026-10-19 16:40 GMT |
Overview
Concrete external tool for installing a catalog component into a project via the shadcn registry add CLI, used when a `get_component` result instructs registry install.
Description
The shadcn registry add CLI command installs a component from a registry into the local project, writing files to the configured component folder and wiring the `cn` helper / Tailwind tokens. 21st.dev catalog components are shadcn-compatible, so a `get_component` result may instruct the agent to run `npx shadcn@latest add <registry-url>` (or the project's equivalent) rather than writing files manually.
This is an External Tool Doc: the CLI belongs to the user's project tooling, not to this repo or the 21st MCP server. The 21st MCP returns install instructions; the agent runs them in the host project.
Usage
Call `shadcn registry add` when a get_component result's `installInstructions` tell you to. If the result instead returns files directly, write those files to the project instead.
Code Reference
Source Location
- Tool: shadcn CLI
- Docs: skills/21st-ui/SKILL.md:L24
- Driven by: Implementation:21st_dev_Magic_mcp_get_component result's `installInstructions`
Signature
# Install a component from a registry URL or specifier.
npx shadcn@latest add <registry-url-or-specifier>
# e.g. for a 21st.dev registry component:
npx shadcn@latest add "https://21st.dev/r/<component>.json"
Import
# Not imported. Run in the host project directory. Requires the project
# to be set up for shadcn (Tailwind config, cn helper, components.json).
I/O Contract
Inputs
| Name | Type | Required | Description |
|---|---|---|---|
| registry-url-or-specifier | string | Yes | The registry URL/specifier from `get_component`'s install instructions |
| project setup | files | Yes | Project must have shadcn config (Tailwind, `cn`, `components.json`) |
Outputs
| Name | Type | Description |
|---|---|---|
| files | source files | Component files written into the project's component folder |
Usage Examples
Install per get_component instructions
# After get_component returns a registry-add instruction:
npx shadcn@latest add "https://21st.dev/r/pricing-table.json"
# Then import the component in the page and adapt tokens/props.
Related Pages
Implements Principle
- Principle:21st_dev_Magic_mcp_Component_Installation
- Principle:21st_dev_Magic_mcp_Component_Integration
Requires Environment
Notes
- Only used when `get_component`'s result instructs registry add; otherwise write the returned files directly.
- After install, wire the component into the page and adapt tokens/props — see Principle:21st_dev_Magic_mcp_Component_Integration.