21st.dev "Magic" MCP server – AI-powered UI-component generator that plugs into Cursor, Windsurf, VSCode/Cline etc.
https://github.com/21st-dev/magic-mcpStop context-switching to generate UI components. Magic MCP brings AI-powered component generation directly into Cursor, Windsurf, and VSCode/Cline, turning natural language descriptions into production-ready React components without leaving your editor.
You're deep in a coding flow when you need a new UI component. Your options suck: manually code it (slow), copy-paste from somewhere (inconsistent), or tab over to v0/Bolt (breaks your flow). Magic MCP eliminates this friction by embedding component generation directly in your IDE's AI chat.
Type /ui create a responsive pricing table with toggle
and get a complete, styled component inserted into your project. No browser tabs, no copy-paste, no flow interruption.
Direct File Integration: Components get written directly to your project with proper imports, following your existing code patterns. No manual integration steps.
Context Awareness: Unlike standalone tools, Magic MCP understands your project structure and can reference your existing components and styling patterns.
IDE-Native Experience: Works through your AI assistant's natural chat interface. If you're already using Cursor Composer or Windsurf Chat, this slots in seamlessly.
21st.dev Component Library: Access to a curated collection of modern components instead of generic AI outputs. Think Shadcn-level quality with more variety.
Rapid Prototyping: Building a dashboard? /ui create a stats card with icon, metric, and trend indicator
gets you a polished card component in seconds.
Design System Expansion: Need variations on existing patterns? Magic MCP can generate components that match your established design language.
Complex Forms: /ui create a multi-step form with validation and progress bar
produces a complete form implementation with proper state management.
Landing Page Components: Hero sections, feature grids, testimonial cards - all generated with modern design patterns and responsive layouts.
npx @21st-dev/cli@latest install cursor --api-key <your-key>
That's it. Your AI assistant now has /ui
commands available.
For manual setup, add this to your MCP config:
{
"mcpServers": {
"@21st-dev/magic": {
"command": "npx",
"args": ["-y", "@21st-dev/magic@latest", "API_KEY=\"your-api-key\""]
}
}
}
Magic MCP works through the Model Context Protocol, the same standard that powers your IDE's AI features. When you use /ui
commands, your AI assistant:
The generated components use modern practices: TypeScript by default, responsive design, accessibility considerations, and clean, maintainable code structure.
Unlike generic AI component generation, Magic MCP outputs follow established patterns:
Components come fully styled and functional, but remain completely customizable. Modify the generated code just like any other component in your codebase.
The 2.5k GitHub stars and active community suggest this isn't just another AI experiment - it's a tool developers are actually using to ship faster.
Ready to stop breaking your coding flow for UI generation? Try Magic MCP and keep your momentum going while building better interfaces.