shadcn-registry-sync-mcp
Automates shadcn/ui registry maintenance by scanning your project, detecting components and dependencies, and generating a production-ready registry.json with a single AI command.
README
shadcn-registry-sync-mcp 🚀
Automate your shadcn/ui registry maintenance with AI-powered precision
✨ Why This Tool?
Tired of manually updating registry.json every time you create a new component?
shadcn-registry-sync-mcp is an intelligent MCP server that automatically scans your project, detects components, analyzes dependencies, and generates a production-ready registry.json — all with a single command to your AI assistant.
🎯 What You Get
| Before | After |
|---|---|
| ❌ Manual registry updates | ✅ One-command sync |
| ❌ Missing dependencies | ✅ Auto-detected deps |
| ❌ Inconsistent metadata | ✅ Smart descriptions |
| ❌ Error-prone copy-paste | ✅ 100% automated |
🚀 Quick Start
1. Install & Build
yarn install
yarn build
2. Configure Your MCP Client
Add to your MCP configuration (e.g., claude_desktop_config.json):
{
"mcpServers": {
"shadcn-registry-sync": {
"command": "node",
"args": ["/path/to/shadcn-registry-sync-mcp/dist/index.js"],
"cwd": "/path/to/shadcn-registry-sync-mcp"
}
}
}
3. Use with Your AI Assistant
Simply tell your AI:
"Sync my shadcn registry"
Or:
"Update registry.json for my project at /path/to/project"
That's it! ✨
🎁 Features
🔍 Intelligent Scanning
Automatically discovers components in:
src/components/*— UI componentssrc/features/*— Feature modules (layouts, components, models)src/hooks/*— Custom React hookssrc/lib/*— Utility librariessrc/types/*— TypeScript definitions
🧠 Smart Dependency Analysis
// Your component
import { Button } from '@/components/button';
import { Slot } from '@radix-ui/react-slot';
// Auto-detected:
// - registryDependencies: ["@shadcn-ui/button"]
// - dependencies: ["@radix-ui/react-slot"]
📝 Auto-Generated Descriptions
The tool analyzes your source code to generate meaningful descriptions:
// DialogDeleteUser.tsx
/**
* Confirmation dialog for deleting users
*/
export function DialogDeleteUser() { ... }
// → description: "Confirmation dialog for deleting users"
Pattern Recognition:
dialog-delete-*→ "Confirmation dialog for deleting *"drawer-configure-*→ "Configuration drawer for *"chart-trend-*→ "Trend line chart visualization"*-models→ "Data models, types, and API service functions"
🎯 shadcn/ui Compatible
Output follows the official shadcn/ui registry schema:
{
"$schema": "https://ui.shadcn.com/schema/registry.json",
"name": "shadcn-ui",
"homepage": "https://ui.shadcn.com",
"items": [
{
"name": "button",
"type": "registry:component",
"title": "Button",
"description": "A reusable button component",
"files": [...],
"dependencies": ["@radix-ui/react-slot"],
"registryDependencies": ["@shadcn-ui/icon"]
}
]
}
💡 Use Cases
For Component Library Maintainers
Keep your registry in sync with zero effort:
Developer: "I just added 5 new components to src/components"
AI: "I'll sync the registry for you."
→ registry.json updated automatically
For Large Projects
Handle complex feature-based architectures:
src/features/
├── auth/
│ ├── components/
│ │ ├── dialog-login/
│ │ └── dialog-otp/
│ ├── layouts/
│ │ └── login-page-layout/
│ └── models/
└── report/
└── components/
└── chart-trend-double-line/
→ All detected and categorized correctly
For Teams
Ensure consistent registry structure across the team:
No more:
- "Who forgot to update the registry?"
- "Why are dependencies missing?"
- "Why does this component break when installed?"
🛠️ Manual Usage
Run standalone without MCP:
# Set project root
export PROJECT_ROOT=/path/to/your/project
# Run sync
node run-local.js
Output:
[run-local] Project root: /path/to/your/project
[run-local] Scanning...
[run-local] Found 42 items
[run-local] Building registry...
[run-local] Written to /path/to/your/project/registry.json
📊 What Gets Synced?
| Type | Directory | Registry Type | Example |
|---|---|---|---|
| Components | src/components/* |
registry:component |
button, card, dialog |
| Blocks | src/features/* |
registry:block |
layouts, multi-file components |
| Hooks | src/hooks/* |
registry:hook |
use-mobile, use-debounce |
| Libraries | src/lib/* |
registry:lib |
utils, axios, storage |
| Types | src/types/*.d.ts |
registry:file |
tanstack-table, zod-schema |
🔧 Configuration
Customize Scan Directories
Edit src/constants.ts:
export const COMPONENT_DIRS = ['src/components', 'src/ui', 'src/shared'];
export const FEATURE_DIR = 'src/features';
export const HOOKS_DIR = 'src/hooks';
export const LIB_DIR = 'src/lib';
export const TYPES_DIR = 'src/types';
Skip Patterns
export const SKIP_FILE_PATTERNS = [
/\.stories\.tsx?$/, // Storybook
/\.test\.tsx?$/, // Tests
/\.spec\.tsx?$/, // Specs
];
export const LIB_SKIP_DIRS = ['storybook', 'docs'];
Dependency Filters
export const FRAMEWORK_DEPS = new Set([
'react',
'react-dom',
'react-router',
// These won't be tracked as dependencies
]);
🏗️ Architecture
For detailed architecture documentation, see ARCHITECTURE.md.
Key Modules:
- scanner.ts — Discovers components in your project
- parser.ts — Analyzes imports and classifies dependencies
- builder.ts — Constructs shadcn-compatible registry
- describer.ts — Generates smart descriptions from source code
🧪 Development
Build
npm run build
Watch Mode
npm run dev
Test Locally
# Point to your project
export PROJECT_ROOT=/path/to/test/project
node run-local.js
# Verify output
cat registry.json | jq '.items | length'
📝 Example Output
After running sync, your registry.json will look like:
{
"$schema": "https://ui.shadcn.com/schema/registry.json",
"name": "shadcn-ui",
"homepage": "https://ui.shadcn.com",
"items": [
{
"name": "utils",
"type": "registry:lib",
"title": "Utils",
"description": "General utility functions including className merging (cn) and common helper methods",
"files": [
{
"type": "registry:lib",
"path": "src/lib/utils.ts"
}
]
},
{
"name": "use-mobile",
"type": "registry:hook",
"title": "useMobile",
"description": "React hook for detecting mobile viewport. Returns a boolean indicating whether the current screen width is below the mobile breakpoint",
"files": [
{
"type": "registry:hook",
"path": "src/hooks/use-mobile.ts"
}
],
"dependencies": ["react"]
},
{
"name": "button",
"type": "registry:component",
"title": "Button",
"description": "A reusable button component built on Radix UI Slot",
"files": [
{
"type": "registry:component",
"path": "src/components/button/index.tsx"
}
],
"dependencies": ["@radix-ui/react-slot", "class-variance-authority"],
"registryDependencies": ["@shadcn-ui/icon"]
}
]
}
🛠️ Development
Setup Development Environment
-
Clone and install:
git clone https://github.com/your-org/shadcn-registry-sync-mcp.git cd shadcn-registry-sync-mcp yarn install -
Build the project:
yarn build -
Run linter:
yarn lint -
Format code:
yarn format
Available Scripts
| Command | Description |
|---|---|
yarn build |
Compile TypeScript to JavaScript |
yarn dev |
Watch mode for development |
yarn lint |
Run ESLint |
yarn lint:fix |
Auto-fix ESLint errors |
yarn format |
Format code with Prettier |
yarn format:check |
Check code formatting |
yarn check |
Run both lint and format check |
yarn commit |
Interactive commit with Commitizen |
Commit Guidelines
This project uses Commitizen for standardized commit messages:
yarn commit
This will launch an interactive prompt that helps you create commits following the Conventional Commits specification.
Commit types:
feat: New featuresfix: Bug fixesdocs: Documentation changesstyle: Code style changes (formatting, etc.)refactor: Code refactoringperf: Performance improvementstest: Adding testsbuild: Build system changesci: CI/CD changeschore: Maintenance tasksrevert: Reverting changes
Pre-commit hooks automatically run linting and formatting on staged files using Husky and lint-staged.
📝 Contributing
We welcome contributions! Please see our Contributing Guide for details on:
- Development setup
- Code standards
- Commit message format
- Pull request process
- Testing guidelines
🤝 Contributing
Contributions are welcome! See our Architecture Guide for understanding the codebase.
Quick Contribution Guide
- Fork the repository
- Create a feature branch:
git checkout -b feature/amazing-feature - Make your changes
- Build and test:
yarn build && node run-local.js - Commit and push
- Open a Pull Request
📄 License
MIT License — feel free to use in your projects!
🙏 Acknowledgments
- shadcn/ui — Amazing component library
- Model Context Protocol — AI integration standard
- Radix UI — Accessible primitives
<div align="center">
Made with ❤️ for the shadcn/ui community
Report Issue · Request Feature · View Architecture
</div>
推荐服务器
Baidu Map
百度地图核心API现已全面兼容MCP协议,是国内首家兼容MCP协议的地图服务商。
Playwright MCP Server
一个模型上下文协议服务器,它使大型语言模型能够通过结构化的可访问性快照与网页进行交互,而无需视觉模型或屏幕截图。
Magic Component Platform (MCP)
一个由人工智能驱动的工具,可以从自然语言描述生成现代化的用户界面组件,并与流行的集成开发环境(IDE)集成,从而简化用户界面开发流程。
Audiense Insights MCP Server
通过模型上下文协议启用与 Audiense Insights 账户的交互,从而促进营销洞察和受众数据的提取和分析,包括人口统计信息、行为和影响者互动。
VeyraX
一个单一的 MCP 工具,连接你所有喜爱的工具:Gmail、日历以及其他 40 多个工具。
graphlit-mcp-server
模型上下文协议 (MCP) 服务器实现了 MCP 客户端与 Graphlit 服务之间的集成。 除了网络爬取之外,还可以将任何内容(从 Slack 到 Gmail 再到播客订阅源)导入到 Graphlit 项目中,然后从 MCP 客户端检索相关内容。
Kagi MCP Server
一个 MCP 服务器,集成了 Kagi 搜索功能和 Claude AI,使 Claude 能够在回答需要最新信息的问题时执行实时网络搜索。
e2b-mcp-server
使用 MCP 通过 e2b 运行代码。
Neon MCP Server
用于与 Neon 管理 API 和数据库交互的 MCP 服务器
Exa MCP Server
模型上下文协议(MCP)服务器允许像 Claude 这样的 AI 助手使用 Exa AI 搜索 API 进行网络搜索。这种设置允许 AI 模型以安全和受控的方式获取实时的网络信息。