loading…
Search for a command to run...
loading…
Provides AI assistants with direct access to shadcn/ui components and blocks, enabling real-time fetching of component source code, documentation, and implement
Provides AI assistants with direct access to shadcn/ui components and blocks, enabling real-time fetching of component source code, documentation, and implementation examples.
A Model Context Protocol (MCP) server that provides AI assistants with direct access to shadcn/ui components and blocks. This server enables AI assistants like Claude (via Cursor) to fetch real-time component source code, documentation, and implementation examples.
Get started instantly without any setup:
# Run directly with npx (no installation required)
npx @magnusrodseth/shadcn-mcp-server
# Or install globally
npm install -g @magnusrodseth/shadcn-mcp-server
Then add to your Cursor configuration:
{
"mcpServers": {
"shadcn": {
"command": "npx",
"args": ["@magnusrodseth/shadcn-mcp-server"]
}
}
}
Next, restart the MCP tool and your Cursor settings should look something like this:

The Shadcn MCP Server bridges the gap between AI assistants and the shadcn/ui component library. Instead of relying on potentially outdated training data, AI assistants can now fetch the latest component implementations directly from the shadcn/ui repository.
sequenceDiagram
participant User as 👤 User
participant Cursor as 🖥️ Cursor/AI Assistant
participant MCP as 🔧 MCP Server
participant GitHub as 📦 shadcn/ui Repository
User->>Cursor: "Show me button component"
Cursor->>MCP: JSON-RPC Request (get_component)
MCP->>GitHub: Fetch component data via API
GitHub-->>MCP: Component source code & metadata
MCP-->>Cursor: Structured component response
Cursor->>Cursor: AI processes & formats
Cursor-->>User: Formatted component with examples
Note over MCP: Available Tools:<br/>• list_components<br/>• get_component<br/>• list_blocks<br/>• get_block
# Clone the repository
git clone https://github.com/yourusername/shadcn-mcp-server.git
cd shadcn-mcp-server
# Install dependencies
pnpm install
# Build the project
pnpm run build
# Run the setup script
node scripts/test-cursor.js
This script will:
Find your Cursor settings:
~/Library/Application Support/Cursor/User/globalStorage/cursor-settings.json%APPDATA%\Cursor\User\globalStorage\cursor-settings.json~/.config/Cursor/User/globalStorage/cursor-settings.jsonAdd the MCP server configuration:
{
"mcpServers": {
"shadcn": {
"command": "node",
"args": ["/absolute/path/to/shadcn-mcp-server/dist/index.js"],
"env": {
"GITHUB_TOKEN": "your_github_token_here"
}
}
}
}
Open Cursor and try these commands with Claude:
"List all available shadcn components"
"Show me the button component source code"
"Get the dashboard-01 block implementation"
"What shadcn blocks are available?"
If configured correctly, Claude will fetch real-time data from the shadcn/ui repository!
# Run unit tests
pnpm test
# Test MCP server integration
pnpm run test:mcp
# Manual testing (interactive)
pnpm run test:manual
# Development with hot reload
pnpm run dev
# Watch tests
pnpm run test:watch
# Clean build artifacts
pnpm run clean
| Tool | Description | Example Usage |
|---|---|---|
list_components |
List all available shadcn/ui components | "What shadcn components are available?" |
get_component |
Get source code and metadata for a specific component | "Show me the button component" |
list_blocks |
List all available shadcn/ui blocks | "What shadcn blocks can I use?" |
get_block |
Get a complete shadcn/ui block implementation | "Get the dashboard-01 block" |
User: "Show me how to create a button with different variants"
Claude with MCP: Will fetch the latest button component and provide:
User: "I need a complete dashboard layout"
Claude with MCP: Will fetch dashboard blocks and provide:
User: "What new components were added to shadcn recently?"
Claude with MCP: Will fetch the current component list and highlight:
Create a .env file in the project root:
# Optional: GitHub token for higher rate limits
GITHUB_TOKEN=ghp_your_token_here
# Optional: Enable debug logging
DEBUG=true
# Optional: Set environment
NODE_ENV=development
Benefits of using a token:
No installation required - always uses the latest version:
# No setup needed, just add to Cursor config:
{
"mcpServers": {
"shadcn": {
"command": "npx",
"args": ["@magnusrodseth/shadcn-mcp-server"],
"env": {
"GITHUB_TOKEN": "your_token_here"
}
}
}
}
Benefits:
# Install once, use everywhere
npm install -g @magnusrodseth/shadcn-mcp-server
# Use in Cursor config:
{
"mcpServers": {
"shadcn": {
"command": "@magnusrodseth/shadcn-mcp-server"
}
}
}
Perfect for contributing or customization:
git clone https://github.com/yourusername/shadcn-mcp-server.git
cd shadcn-mcp-server
pnpm install && pnpm run build
# Use absolute path in Cursor config:
"command": "node",
"args": ["/path/to/shadcn-mcp-server/dist/index.js"]
npm install -g git+https://github.com/yourusername/shadcn-mcp-server.git
shadcn-mcp-server/
├── index.ts # Main MCP server setup
├── services/
│ └── shadcn-service.ts # Core component fetching logic
├── types/
│ └── shadcn.ts # TypeScript definitions
├── utils/
│ └── logger.ts # Logging configuration
└── scripts/
├── test-cursor.js # Cursor setup automation
└── test-mcp.js # MCP protocol testing
pnpm run build)list_components first)Enable detailed logging:
DEBUG=true node dist/index.js
Or set in your Cursor configuration:
{
"mcpServers": {
"shadcn": {
"command": "node",
"args": ["/path/to/dist/index.js"],
"env": {
"DEBUG": "true"
}
}
}
}
git checkout -b feature/amazing-feature)pnpm test)pnpm run test:mcp)git commit -m 'Add amazing feature')git push origin feature/amazing-feature)Made with ❤️ for the shadcn/ui and AI development community
If this project helps you build better UIs faster, consider giving it a ⭐!
Выполни в терминале:
claude mcp add shadcn-mcp-server -- npx Безопасность
Низкий рискАвтоматическая эвристика по публичным данным — не гарантия безопасности.