magic-mcp
by: 21st-dev
It's like v0 but in your Cursor/WindSurf/Cline. 21st dev Magic MCP server for working with your frontend like Magic
πOverview
Purpose: The Magic Component Platform (MCP) aims to streamline UI component development for developers by utilizing AI to generate components through natural language descriptions.
Overview: MCP is an innovative AI-driven tool designed to enhance the efficiency of UI development by allowing developers to create modern, visually appealing components quickly and easily. It integrates with multiple popular IDEs, facilitating a seamless design workflow.
Key Features:
-
AI-Powered UI Generation: Create UI components effortlessly by simply describing them using natural language.
-
Multi-IDE Support: Compatible with various IDEs, including Cursor, Windsurf, and Beta support for VSCode with Cline, ensuring a wide range of development environments.
-
Modern Component Library: Offers access to a comprehensive collection of customizable, pre-built components inspired by 21st.dev, enriching the developer's toolkit.
-
Real-time Preview: Allows instant visualization of components as they are created, enhancing the development process.
-
TypeScript Support: Ensures robust, type-safe development practices for greater reliability in coding.
-
SVGL Integration: Provides access to professional brand assets and logos, facilitating enhanced design capabilities.
-
Component Enhancement (Coming Soon): Promises advanced features for improving existing components, including animations, to boost creativity and functionality.
21st.dev Magic AI Agent
Magic Component Platform (MCP) is a powerful AI-driven tool that helps developers create beautiful, modern UI components instantly through natural language descriptions. It integrates seamlessly with popular IDEs and provides a streamlined workflow for UI development.
π Features
- AI-Powered UI Generation: Create UI components by describing them in natural language
- Multi-IDE Support:
- Cursor IDE integration
- Windsurf support
- VSCode support
- VSCode + Cline integration (Beta)
- Modern Component Library: Access to a vast collection of pre-built, customizable components inspired by 21st.dev
- Real-time Preview: Instantly see your components as you create them
- TypeScript Support: Full TypeScript support for type-safe development
- SVGL Integration: Access to a vast collection of professional brand assets and logos
- Component Enhancement: Improve existing components with advanced features and animations (Coming Soon)
π― How It Works
-
Tell Agent What You Need
- In your AI Agent's chat, type
/ui
and describe the component you're looking for - Example:
/ui create a modern navigation bar with responsive design
- In your AI Agent's chat, type
-
Let Magic Create It
- Your IDE prompts you to use Magic
- Magic instantly builds a polished UI component inspired by 21st.dev's library
-
Seamless Integration
- Components are automatically added to your project
- Start using your new UI components right away
- All components are fully customizable
π Getting Started
Prerequisites
- Node.js (Latest LTS version recommended)
- One of the supported IDEs: Cursor, Windsurf, VSCode (with Cline extension)
Installation
-
Generate API Key
- Visit 21st.dev Magic Console
- Generate a new API key
-
Choose Installation Method
Method 1: CLI Installation (Recommended)
One command to install and configure MCP for your IDE:
npx @21st-dev/cli@latest install <client> --api-key <key>
Supported clients: cursor, windsurf, cline, claude
Method 2: Manual Configuration
Add this to your IDE's MCP config file:
{
"mcpServers": {
"@21st-dev/magic": {
"command": "npx",
"args": ["-y", "@21st-dev/magic@latest", "API_KEY=\"your-api-key\""]
}
}
}
Config file locations:
- Cursor:
~/.cursor/mcp.json
- Windsurf:
~/.codeium/windsurf/mcp_config.json
- Cline:
~/.cline/mcp_config.json
- Claude:
~/.claude/mcp_config.json
Method 3: VS Code Installation
Manual VS Code Setup
Add the following JSON block to your User Settings (JSON) file in VS Code (Ctrl + Shift + P
β Preferences: Open User Settings (JSON)
):
{
"mcp": {
"inputs": [
{
"type": "promptString",
"id": "apiKey",
"description": "21st.dev Magic API Key",
"password": true
}
],
"servers": {
"@21st-dev/magic": {
"command": "npx",
"args": ["-y", "@21st-dev/magic@latest"],
"env": {
"API_KEY": "${input:apiKey}"
}
}
}
}
}
Optionally, add it to .vscode/mcp.json
in your workspace:
{
"inputs": [
{
"type": "promptString",
"id": "apiKey",
"description": "21st.dev Magic API Key",
"password": true
}
],
"servers": {
"@21st-dev/magic": {
"command": "npx",
"args": ["-y", "@21st-dev/magic@latest"],
"env": {
"API_KEY": "${input:apiKey}"
}
}
}
}
β FAQ
How does Magic AI Agent handle my codebase?
Magic AI Agent only writes or modifies files related to the components it generates. It follows your project's code style and structure, integrating seamlessly with your existing codebase without affecting other parts of your application.
Can I customize the generated components?
Yes! All generated components are fully editable and come with well-structured code. You can modify styling, functionality, and behavior like any other React component.
What happens if I run out of generations?
If you exceed your monthly generation limit, you'll be prompted to upgrade your plan to continue generating components. Existing components remain fully functional.
How soon do new components get added to 21st.dev's library?
Authors can publish components to 21st.dev anytime, giving Magic Agent immediate access to new components and design patterns from the community.
Is there a limit to component complexity?
Magic AI Agent can handle components from simple buttons to complex interactive forms. For best results, break down very complex UIs into smaller, manageable components.
π οΈ Development
Project Structure
mcp/
βββ app/
β βββ components/ # Core UI components
βββ types/ # TypeScript type definitions
βββ lib/ # Utility functions
βββ public/ # Static assets
Key Components
IdeInstructions
: Setup instructions for different IDEsApiKeySection
: API key management interfaceWelcomeOnboarding
: Onboarding flow for new users
π€ Contributing
We welcome contributions! Please join our Discord community and provide feedback to help improve Magic Agent. The source code is available on GitHub.
π₯ Community & Support
- Discord Community β Join our active community
- Twitter β Follow us for updates
β οΈ Beta Notice
Magic Agent is currently in beta. All features are free during this period. We appreciate your feedback and patience as we improve the platform.
π License
MIT License
π Acknowledgments
- Thanks to our beta testers and community members
- Special thanks to the Cursor, Windsurf, and Cline teams for their collaboration
- Integration with 21st.dev for component inspiration
- SVGL for logo and brand asset integration
For more information, join our Discord community or visit 21st.dev/magic.