shadcn MCP Server
Provides tools to list and fetch shadcn/ui components and blocks, enabling AI assistants to retrieve real-time component source code, metadata, and implementation examples directly from the official shadcn/ui repository.
Click on "Install 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 MCP ServerShow me the button component source code"
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.
shadcn/ui MCP Server
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.
β‘ Quick Install
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-serverThen 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:

Related MCP server: shadcn-ui MCP Server
π― What is 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.
Key Benefits
β Always Up-to-Date: Fetches components directly from the official shadcn/ui repository
β Complete Implementation: Get full source code, dependencies, and usage examples
β AI-Powered Development: Let AI assistants help you implement components correctly
β Time-Saving: No more manual copying from docs or searching for examples
π How It Works
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π Getting Started with Developing
Prerequisites
Node.js β₯ 22.0.0
pnpm (recommended) or npm
Cursor IDE (for AI integration)
Recommended: GitHub Personal Access Token (for higher rate limits)
1. Installation
# 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 build2. Cursor Configuration
Option A: Automatic Setup (Recommended)
# Run the setup script
node scripts/test-cursor.jsThis script will:
Generate the correct Cursor configuration
Create a wrapper script for your system
Provide step-by-step instructions
Option B: Manual Configuration
Find your Cursor settings:
macOS:
~/Library/Application Support/Cursor/User/globalStorage/cursor-settings.jsonWindows:
%APPDATA%\Cursor\User\globalStorage\cursor-settings.jsonLinux:
~/.config/Cursor/User/globalStorage/cursor-settings.json
Add 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"
}
}
}
}Restart Cursor completely (quit and reopen)
3. Verify Installation
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!
π§ͺ Testing & Development
Local Testing
# Run unit tests
pnpm test
# Test MCP server integration
pnpm run test:mcp
# Manual testing (interactive)
pnpm run test:manualDevelopment Mode
# Development with hot reload
pnpm run dev
# Watch tests
pnpm run test:watch
# Clean build artifacts
pnpm run cleanπ οΈ Available Tools
Tool | Description | Example Usage |
| List all available shadcn/ui components | "What shadcn components are available?" |
| Get source code and metadata for a specific component | "Show me the button component" |
| List all available shadcn/ui blocks | "What shadcn blocks can I use?" |
| Get a complete shadcn/ui block implementation | "Get the dashboard-01 block" |
π‘ Usage Examples
Basic Component Usage
User: "Show me how to create a button with different variants"
Claude with MCP: Will fetch the latest button component and provide:
Complete source code
All available variants (default, destructive, outline, secondary, ghost, link)
Size options (sm, default, lg, icon)
Usage examples with proper imports
Accessibility features
Advanced Block Implementation
User: "I need a complete dashboard layout"
Claude with MCP: Will fetch dashboard blocks and provide:
Full implementation code
Required dependencies
Component breakdown
Styling and layout structure
Real-time Component Discovery
User: "What new components were added to shadcn recently?"
Claude with MCP: Will fetch the current component list and highlight:
All available components
Brief descriptions
Categorization
π§ Configuration Options
Environment Variables
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=developmentGitHub Token Setup (Optional but Recommended)
Go to GitHub Settings > Developer settings > Personal access tokens
Generate a new token (classic)
No special permissions needed - public repository access is sufficient
Add the token to your environment variables
Benefits of using a token:
Higher rate limits (5,000 requests/hour vs 60/hour)
More reliable for heavy usage
Better performance
π¦ Deployment Options
Option 1: NPX (Recommended) π
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:
β Always up-to-date
β No global installation
β Works immediately
β No build step required
Option 2: Global npm Installation
# Install once, use everywhere
npm install -g @magnusrodseth/shadcn-mcp-server
# Use in Cursor config:
{
"mcpServers": {
"shadcn": {
"command": "@magnusrodseth/shadcn-mcp-server"
}
}
}Option 3: Local Development
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"]Option 4: Direct Git Installation
npm install -g git+https://github.com/yourusername/shadcn-mcp-server.gitπ― Architecture Overview
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 testingKey Components
MCP Server: Handles JSON-RPC communication with Cursor/Claude
Shadcn Service: Fetches components and blocks from GitHub API
Type Safety: Full TypeScript support for all operations
Error Handling: Graceful degradation and informative error messages
Caching: Smart caching to reduce API calls and improve performance
π Troubleshooting
Common Issues
"MCP server not found"
Verify the absolute path in your Cursor configuration
Ensure the project is built (
pnpm run build)Check that Node.js is in your system PATH
"Rate limit exceeded"
Add a GitHub token to your environment variables
The server will automatically use the token for authenticated requests
"Component not found"
Check component name spelling (use
list_componentsfirst)Some components may have different names than expected
"Cursor not recognizing MCP server"
Restart Cursor completely (quit and reopen)
Verify JSON syntax in your Cursor configuration
Check the MCP server logs for errors
Debug Mode
Enable detailed logging:
DEBUG=true node dist/index.jsOr set in your Cursor configuration:
{
"mcpServers": {
"shadcn": {
"command": "node",
"args": ["/path/to/dist/index.js"],
"env": {
"DEBUG": "true"
}
}
}
}π€ Contributing
Fork the repository
Create a feature branch (
git checkout -b feature/amazing-feature)Make your changes
Add tests (
pnpm test)Run the full test suite (
pnpm run test:mcp)Commit your changes (
git commit -m 'Add amazing feature')Push to the branch (
git push origin feature/amazing-feature)Open a Pull Request
Made with β€οΈ for the shadcn/ui and AI development community
If this project helps you build better UIs faster, consider giving it a β!
Maintenance
Resources
Unclaimed servers have limited discoverability.
Looking for Admin?
If you are the server author, to access and configure the admin panel.
Related MCP Servers
- AlicenseAqualityDmaintenanceHelps AI assistants access shadcn/ui component documentation and examples through a TypeScript-based MCP server that provides reference information for component details, usage examples, and search capabilities.487960MIT
- AlicenseAqualityDmaintenanceProvides reference information for shadcn/ui components through a Model Context Protocol server that helps AI assistants access component documentation and examples.4879MIT
- Alicense-qualityDmaintenanceEnables AI assistants to discover, install, and generate code examples for shadcn/ui components, providing installation commands and usage examples for 37+ React UI components.MIT
- Alicense-qualityAmaintenanceProvides real-time access to shadcn-svelte component documentation and developer utilities using web scraping.58MIT
Related MCP Connectors
Connect AI assistants to your GitHub-hosted Obsidian vault to seamlessly access, search, and analyβ¦
Provide your AI coding tools with token-efficient access to up-to-date technical documentation forβ¦
Provides cloud browser automation capabilities using Stagehand and Browserbase, enabling LLMs to iβ¦
Latest Blog Posts
- Who's Calling? MCP Hosts Are an Identity Blind Spot (And the Spec Knows It)By Om-Shree-0709 on .mcpAgent IdentityOAuth 2.1
- Your AI Chatbot Just Exposed Your CEO's Salary to an InternBy Om-Shree-0709 on .Agent IdentityMCP SecurityOAuth Delegation
- Why MCP Servers Need Execution Sandboxing (And Why Your Current Stack Isn't Enough)By Om-Shree-0709 on .Agentic AiPrompt InjectionWebAssembly
MCP directory API
We provide all the information about MCP servers via our MCP API.
curl -X GET 'https://glama.ai/api/mcp/v1/servers/magnusrodseth/shadcn-mcp-server'
If you have feedback or need assistance with the MCP directory API, please join our Discord server