shadcn-registry-mcp
Provides tools for AI coding assistants to list, search, add, and remove shadcn/ui components directly from the official registry, with full dependency resolution and project-aware file placement.
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@shadcn-registry-mcp add a sidebar component to my project"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
Your AI shouldn't need a terminal.
shadcn-registry-mcp is a secure MCP server that gives AI coding assistants (Claude, Cursor, Windsurf, and more) direct access to the shadcn/ui registry, fetching, installing, and wiring up components without a single context switch.
What it does
You talk to your AI. Your AI talks to this server. The server handles everything else.
No terminal. No broken deps. No copy-paste.
Related MCP server: Shadcn Registry manager
Why this exists
AI-generated UI tends to be generic. When your AI guesses at component structure instead of reading from the actual registry, you get inconsistent code that fights your design system.
Public MCP registries are a security risk. The MCP ecosystem is actively targeted by supply-chain attacks, malicious servers that disguise themselves as developer tools to exfiltrate SSH keys, tokens, and environment variables.
This server solves both:
Accurate installs — components come directly from the official
ui.shadcn.comregistry, with the exact file structure, dependency tree, and CSS variables shadcn intends. No guessing.Conversational flow — ask for a data table, a sidebar, or an entire form kit. The server resolves transitive deps, writes all files, and runs your package manager. You stay in the conversation.
Codebase-safe — the server reads your
components.jsonto understand your exact project layout before writing a single file. It integrates with your structure, not against it.Security-hardened — network egress is locked to
ui.shadcn.comonly. Path traversal is blocked. Package installs useexecFile(), never shell concatenation. Your environment stays yours.
Who is this for
Frontend and full-stack developers who use shadcn/ui and want their AI assistant to actually install components correctly, with full dependency resolution, proper file placement, and zero security compromises.
If you've ever had an AI tell you to "run npx shadcn@latest add button" mid-conversation, this is for you.
Quick Start
Prerequisites
Node.js 18+ · check with
node --versionA shadcn/ui project · run
npx shadcn@latest initif not already set up
Step 1 — Add to your AI client
Open your config file:
macOS:
~/Library/Application Support/Claude/claude_desktop_config.jsonWindows:
%APPDATA%\Claude\claude_desktop_config.json
Add the shadcn entry under mcpServers:
{
"mcpServers": {
"shadcn": {
"command": "npx",
"args": ["-y", "shadcn-registry-mcp"]
}
}
}Quit and relaunch Claude Desktop after saving.
For the current project only:
claude mcp add shadcn -- npx -y shadcn-registry-mcpFor all projects (recommended):
claude mcp add shadcn --scope global -- npx -y shadcn-registry-mcpConfirm it connected:
claude mcp list
# shadcn npx -y shadcn-registry-mcp connected ✓If the status shows
failed, npx may have a stale cache. Fix:claude mcp remove shadcnthen re-add withnpx -y shadcn-registry-mcp@latest.
Edit .cursor/mcp.json in your project root (create it if it doesn't exist):
{
"mcpServers": {
"shadcn": {
"command": "npx",
"args": ["-y", "shadcn-registry-mcp"]
}
}
}Restart Cursor after saving.
Edit ~/.codeium/windsurf/mcp_config.json:
{
"mcpServers": {
"shadcn": {
"command": "npx",
"args": ["-y", "shadcn-registry-mcp"]
}
}
}Restart Windsurf after saving.
Download shadcn-registry-mcp.mcpb from the latest release and open it — no terminal, no config editing. Works with any client that supports the .mcpb format.
Step 2 — Verify it's working
Ask your AI:
"List my installed shadcn components"
The MCP server will respond directly. If the AI runs npx shadcn@latest in a terminal instead, the server isn't connected — see Troubleshooting below.
Troubleshooting
failed to connect in claude mcp list
npx cached a "not found" result from before the package was installed. Fix:
claude mcp remove shadcn
claude mcp add shadcn --scope global -- npx -y shadcn-registry-mcp@latestcomponents.json not found
The server needs a shadcn-initialized project. Run npx shadcn@latest init in your project root first.
AI uses the terminal instead of the MCP
Be explicit: "Use the add_component tool to install [name]". Some agents default to the CLI if the prompt is ambiguous.
Server disappears after restarting Claude Code
You added it at project scope. Re-add with --scope global to make it persistent.
Tools
Eight tools are exposed to your AI assistant:
Tool | What it does | Writes |
| Framework, package manager, component dirs, shadcn config | — |
| All available components, filterable by category | — |
| Predefined groups for bulk installs | — |
| Find by name or keyword, ranked by relevance | — |
| Files, deps, CSS vars, install status in your project | — |
| Install components or groups with full dep resolution; supports | ✓ |
| Clean uninstall — deletes component files | ✓ |
| What's already in your project | — |
// Preview before writing anything
add_component({ names: ["sidebar", "button"], dryRun: true })
// Install an entire group at once
add_component({ group: "form" }) // input, textarea, select, checkbox, label, form…Groups: form · layout · navigation · overlay · data · feedback · typography
Security
The MCP ecosystem has a supply-chain problem. Malicious servers disguise themselves as developer tools to steal credentials, SSH keys, and environment secrets. This server is built with that threat model in mind:
Control | What it prevents |
Network egress locked to | Registry data or tool inputs cannot trigger requests to attacker-controlled domains |
Path traversal prevention | Registry-supplied paths are validated and resolved against the project root, no |
No shell injection |
|
No stdout pollution | All logging goes to |
Minimal filesystem scope | Reads only |
Zod input validation | Every tool input is schema-validated before any code runs |
Compatibility
Works with Next.js (App + Pages Router), Vite, and plain React. Auto-detects npm, pnpm, yarn, and bun from your lockfile.
Client | Status |
Claude Desktop | ✅ |
Claude Code | ✅ |
Cursor | ✅ |
Windsurf | ✅ |
Any MCP-compatible client | ✅ |
Custom Registries
Point to an internal design system via components.json:
{ "registryUrl": "https://registry.company.com/r" }Or via env var (useful in CI):
{ "env": { "SHADCN_REGISTRY_URL": "https://registry.company.com/r" } }Custom registry is checked first; the official shadcn registry is the fallback, internal and standard components work side by side.
Architecture
src/
├── index.ts Entry point — stdio transport, process lifecycle
├── server.ts McpServer — all 8 tools registered with Zod schemas
├── types.ts Typed interfaces + error classes (SecurityError, CircularDepError…)
│
├── tools/ Thin handlers — validate input, compose modules, format output
│ ├── add-component.ts Installs by name list or group · "did you mean?" on typos
│ ├── remove-component.ts Uninstalls by name · path-validated deletion
│ ├── detect-project.ts
│ ├── get-component-info.ts
│ ├── list-components.ts
│ ├── list-installed.ts
│ └── search-components.ts
│
├── registry/
│ ├── client.ts HTTPS-only fetch · host whitelist · 5-min cache · 2× retry
│ ├── resolver.ts Recursive dep tree · cycle detection · Levenshtein suggestions
│ └── groups.ts 7 predefined groups
│
├── project/
│ ├── analyzer.ts Walks up to components.json · framework + pkg manager detection
│ └── scanner.ts Checks installed components by scanning configured directories
│
└── writer/
├── file-writer.ts Path-validated writes · dry-run support
├── file-remover.ts Path-validated deletion
├── css-writer.ts Idempotent CSS variable merging
└── pkg-installer.ts execFile-based installs · per-package fallback
tests/
├── registry/client.test.ts Fetch, caching, security, custom registry
├── project/analyzer.test.ts Framework + pkg manager detection
├── writer/file-writer.test.ts Path validation and write logic
├── writer/file-remover.test.ts Path traversal security + deletion
└── e2e/
├── add-component.test.ts Full pipeline: dry-run, install, skip, transitive deps
├── remove-component.test.ts Delete, no-op, partial, multi-component
└── detect-project.test.ts Framework detection, alias resolution, missing configDevelopment
git clone https://github.com/Rachidhssin/shadcn-registry-mcp
npm install
npm run dev # Run with tsx — no build step needed
npm run build # Compile TypeScript → dist/
npm test # Run 42 tests (unit + E2E)
npm run test:watch # Watch mode
npm run pack:bundle # Build + create shadcn-registry-mcp.mcpb bundleContributing
Contributions are welcome and appreciated. Here's how to get involved:
Star the repo — if this saves you time, a star helps others find it and keeps the project going.
Report issues — found a bug or a component that doesn't install correctly? Open an issue.
Submit a PR — fork → branch → write tests → open a PR. Both
npm testandnpm run buildmust pass cleanly.Suggest features — have an idea for a new tool or integration? Start a discussion in the issues tab.
Security note: All security properties (network egress locking, path validation, shell safety) must be preserved in every PR. New network destinations, filesystem paths, or shell invocations require explicit justification in the PR description.
If this project helped you, consider giving it a ⭐ it means a lot.
MIT · Built with the MCP TypeScript SDK · Powered by the shadcn/ui registry
Available Tools
8 toolsadd_componentADestructiveIdempotent
Install one or more shadcn/ui components into the current project. Automatically resolves and installs all dependencies. Use dryRun=true to preview what would be installed without making changes.
Inputs: name, group, names, dryRun.
detect_projectARead-onlyIdempotent
Detect the current project configuration: framework, package manager, component paths, and shadcn setup
Inputs: no named parameters.
get_component_infoARead-onlyIdempotent
Get detailed information about a shadcn/ui component including dependencies, files, and whether it is already installed in the current project
Inputs: name (required).
list_componentsARead-onlyIdempotent
List all available shadcn/ui components from the official registry
Inputs: category.
list_groupsARead-onlyIdempotent
List all available component groups for bulk installation (e.g. "form", "overlay", "navigation")
Inputs: no named parameters.
list_installedARead-onlyIdempotent
List all shadcn/ui components that are currently installed in the project
Inputs: no named parameters.
remove_componentADestructive
Remove one or more installed shadcn/ui components from the project by deleting their files
Inputs: names (required).
search_componentsARead-onlyIdempotent
Search for shadcn/ui components by name or description
Inputs: query (required).
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 8 tools
Each tool targets a clearly distinct operation: discovery, search, detailed info, add, remove, installed listing, groups, and project detection. There is no meaningful overlap that would confuse an agent.
All tool names follow a consistent verb_noun snake_case pattern such as list_components, add_component, and detect_project. The names are predictable and readable.
With 8 tools, the server is well-scoped for managing shadcn/ui registry components and project integration. Each tool serves a necessary function without redundancy.
The surface covers discovery, inspection, installation, removal, installed tracking, grouping, and project detection. The only notable gap is an explicit update/upgrade operation for already installed components.
Maintenance
Related MCP Connectors
MCP server that lets your AI assistant build and deploy apps, hosting each one at a live URL.
Zero-log MCP server with 49 tools for AI guardrails, secret scanning, MCP linting & EU compliance.
491MCP server connecting AI agents to 100+ apps (Gmail, Slack, Notion, GitHub) via one-click OAuth.
Driflyte MCP server which lets AI assistants query topic-specific knowledge from web and GitHub.
Related MCP Servers
- AlicenseCqualityDmaintenanceA Model Control Protocol server that allows users to discover, install, and manage Shadcn UI components and blocks through natural language interactions in compatible AI tools.6304 npm27MIT
- AlicenseNot gradedqualityDmaintenanceMCP server for Shadcn UI, enabling automated, remote, or containerized project management via local or remote registries3 npm2MIT
- AlicenseAqualityDmaintenanceAn MCP server that enables AI assistants to search, discover, and install Aceternity UI components programmatically.5170 npm26MIT
- AlicenseNot gradedqualityDmaintenanceThis MCP server provides tools to install and manage shadcn/ui components directly from AI coding agents.2MIT