21st.dev Magic AI Agent
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., "@21st.dev Magic AI AgentCreate a responsive navbar with logo and menu items"
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.
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)
Related MCP server: Magic Component Platform
π― How It Works
Tell Agent What You Need
In your AI Agent's chat, just type
/uiand describe the component you're looking forExample:
/ui create a modern navigation bar with responsive design
Let Magic Create It
Your IDE prompts you to use Magic
Magic instantly builds a polished UI component
Components are 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
If you prefer manual setup, 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.jsonWindsurf:
~/.codeium/windsurf/mcp_config.jsonCline:
~/.cline/mcp_config.jsonClaude:
~/.claude/mcp_config.json
Method 3: VS Code Installation
For one-click installation, click one of the install buttons below:
Manual VS Code Setup
First, check the install buttons above for one-click installation. For manual setup:
Add the following JSON block to your User Settings (JSON) file in VS Code. You can do this by pressing Ctrl + Shift + P and typing 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, you can add it to a file called .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, and integrates 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 the styling, functionality, and behavior just like any other React component in your codebase.
What happens if I run out of generations?
If you exceed your monthly generation limit, you'll be prompted to upgrade your plan. You can upgrade at any time to continue generating components. Your existing components will remain fully functional.
How soon do new components get added to 21st.dev's library?
Authors can publish components to 21st.dev at any time, and Magic Agent will have immediate access to them. This means you'll always have access to the latest components and design patterns from the community.
Is there a limit to component complexity?
Magic AI Agent can handle components of varying complexity, from simple buttons to complex interactive forms. However, for best results, we recommend breaking 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 assetsKey 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 continue to 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.
Available Tools
4 tools21st_magic_component_builderA
"Use this tool when the user requests a new UI componentβe.g., mentions /ui, /21 /21st, or asks for a button, input, dialog, table, form, banner, card, or other React component. This tool ONLY returns the text snippet for that UI component. After calling this tool, you must edit or add files to integrate the snippet into the codebase."
| Name | Required | Description | Default |
|---|---|---|---|
| message | Yes | Full users message | |
| searchQuery | Yes | Generate a search query for 21st.dev (library for searching UI components) to find a UI component that matches the user's message. Must be a two-four words max or phrase | |
| standaloneRequestQuery | Yes | You need to formulate what component user wants to create, based on his message, possbile chat histroy and a place where he makes the request.Extract additional context about what should be done to create a ui component/page based on the user's message, search query, and conversation history, files. Don't halucinate and be on point. | |
| absolutePathToCurrentFile | Yes | Absolute path to the current file to which we want to apply changes | |
| absolutePathToProjectDirectory | Yes | Absolute path to the project root directory |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
With no annotations, the description appropriately carries the behavioral burden. It clearly discloses that the tool only returns a snippet and does not modify files, and it sets the post-call expectation to edit/add files. This is key behavioral context, though it omits details like failure modes or rate limits.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is three sentences, each serving a distinct purpose: when to use, what it returns, and the required follow-up. It is front-loaded with the trigger conditions and contains no fluff or redundant information.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
The description adequately covers the tool's purpose, output scope, and the agent's next steps, which is sufficient for selecting and invoking it. It could be improved by explicitly contrasting with sibling tools or describing the snippet's format, but the provided context satisfies the core requirements.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Schema description coverage is 100% (all five parameters have detailed descriptions). The tool description itself adds no parameter-specific meaning, but the baseline of 3 is sufficient because the schema already documents each parameter thoroughly, including concise search query constraints and extraction instructions.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description clearly states the tool's function: it returns a text snippet for a requested UI component. It provides specific trigger examples (e.g., '/ui', button, dialog) and explicitly notes the tool 'ONLY returns the text snippet', distinguishing it from sibling tools that likely handle inspiration or refinement.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The description gives explicit when-to-use guidance with concrete examples of user requests. It also implies exclusions via 'ONLY returns the text snippet' and instructs that file integration must happen afterward. However, it does not explicitly name alternatives or state when not to use this tool.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
21st_magic_component_inspirationA
"Use this tool when the user wants to see component, get inspiration, or /21st fetch data and previews from 21st.dev. This tool returns the JSON data of matching components without generating new code. This tool ONLY returns the text snippet for that UI component. After calling this tool, you must edit or add files to integrate the snippet into the codebase."
| Name | Required | Description | Default |
|---|---|---|---|
| message | Yes | Full users message | |
| searchQuery | Yes | Search query for 21st.dev (library for searching UI components) to find a UI component that matches the user's message. Must be a two-four words max or phrase |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
With no annotations, the description carries the full burden for behavioral disclosure. It states the tool only returns a text snippet, does not generate code, and requires manual integration afterward. However, it is internally inconsistent about 'previews' vs 'only returns the text snippet', and it does not mention no-match behavior, authentication, or data source limitations.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is reasonably compact but contains redundancy: 'returns the JSON data' vs 'ONLY returns the text snippet' overlap, and the phrase 'or /21st fetch data' is awkward. The final sentence about post-call integration is valuable. Overall, it could be tightened without losing substance.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
Given the lack of an output schema and annotations, the description covers the tool's purpose, return type, and required follow-up action. It misses a cleaner distinction between 'data/previews' and 'text snippet' and does not mention alternative tools by name, but it is still sufficiently complete for an agent to select and use the tool correctly.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
The input schema already provides 100% coverage with clear descriptions for both parameters. The description does not add additional parameter-level semantics beyond what the schema provides, so the baseline score of 3 applies.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description clearly identifies the tool as a retrieval/inspiration tool for 21st.dev components, explicitly stating it returns JSON/text snippet data and does not generate code. This distinguishes it from sibling tools like the builder, which likely generates components.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
The first sentence gives explicit triggers ('when the user wants to see component, get inspiration, or /21st fetch data'), and the phrase 'without generating new code' provides an exclusion for code-generation use cases. However, it does not name alternative sibling tools explicitly, so it stops short of a full when-not/alternative matrix.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
21st_magic_component_refinerA
"Use this tool when the user requests to re-design/refine/improve current UI component with /ui or /21 commands, or when context is about improving, or refining UI for a React component or molecule (NOT for big pages). This tool improves UI of components and returns redesigned version of the component and instructions on how to implement it."
| Name | Required | Description | Default |
|---|---|---|---|
| context | Yes | Extract the specific UI elements and aspects that need improvement based on user messages, code, and conversation history. Identify exactly which components (buttons, forms, modals, etc.) the user is referring to and what aspects (styling, layout, responsiveness, etc.) they want to enhance. Do not include generic improvements - focus only on what the user explicitly mentions or what can be reasonably inferred from the available context. If nothing specific is mentioned or you cannot determine what needs improvement, return an empty string. | |
| userMessage | Yes | Full user's message about UI refinement | |
| absolutePathToRefiningFile | Yes | Absolute path to the file that needs to be refined |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
With no annotations provided, the description carries the full burden of behavioral disclosure. It does mention that the tool returns a redesigned version and implementation instructions, which gives some output behavior. However, it does not disclose whether the tool modifies the file (write), requires specific permissions, or has any side effects. This ambiguity could mislead the agent about the tool's mutability.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is two sentences, front-loaded with an explicit usage directive, and every sentence earns its place. It is concise without redundancy, efficiently conveying purpose, usage, and output.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
The description covers the tool's purpose, when to use it, and what it returns (redesigned version + instructions), which is essential for a tool with no output schema. It leverages the schema's rich parameter descriptions. However, the lack of side-effect transparency and absence of annotations leave a small gap in complete understanding of the tool's behavior.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Schema description coverage is 100%, and each parameter has a detailed description, especially 'context' which explains what to extract and what to do if nothing specific is mentioned. Since the schema fully documents parameters, the description adds no extra semantics, but the schema already provides sufficient meaning.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description states a specific verb+resource: 'improves UI of components and returns redesigned version of the component and instructions on how to implement it.' It distinguishes from siblings by specifying it is for refining existing components (not building) and excludes big pages, which aligns with the tool name and differentiates it from 21st_magic_component_builder.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
It clearly says when to use: when the user requests to re-design/refine/improve a current UI component with /ui or /21 commands, or when context is about improving/refining a React component/molecule. It also excludes big pages. However, it does not explicitly name alternatives (e.g., 'use builder for new components'), so it lacks full explicit alternative guidance.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
logo_searchA
Search and return logos in specified format (JSX, TSX, SVG). Supports single and multiple logo searches with category filtering. Can return logos in different themes (light/dark) if available.
When to use this tool:
When user types "/logo" command (e.g., "/logo GitHub")
When user asks to add a company logo that's not in the local project
Example queries:
Single company: ["discord"]
Multiple companies: ["discord", "github", "slack"]
Specific brand: ["microsoft office"]
Command style: "/logo GitHub" -> ["github"]
Request style: "Add Discord logo to the project" -> ["discord"]
Format options:
TSX: Returns TypeScript React component
JSX: Returns JavaScript React component
SVG: Returns raw SVG markup
Each result includes:
Component name (e.g., DiscordIcon)
Component code
Import instructions
| Name | Required | Description | Default |
|---|---|---|---|
| format | Yes | Output format | |
| queries | Yes | List of company names to search for logos |
TDQS
Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?
With no annotations, the description carries the full burden of behavioral disclosure. It explains return formats, themes, and result contents, but lacks information on error behavior, what happens if a logo isn't found, or any side effects. The mention of 'category filtering' is vague and not backed by schema parameters, adding confusion.
Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.
Is the description appropriately sized, front-loaded, and free of redundancy?
The description is well-organized with clear sections for usage triggers, examples, format options, and result contents. Every sentence adds value, and the structure makes it easy to scan. No unnecessary filler.
Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.
Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?
For a 2-parameter search tool, the description covers purpose, usage, parameters, and results thoroughly. However, it omits error handling, any rate limits, and the meaning of 'category filtering' is not explained or reflected in the schema, leaving a minor gap in completeness.
Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.
Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?
Although schema coverage is 100%, the description adds substantial meaning: format options are explicitly defined (TSX/JSX/SVG with explanations), and queries are illustrated with multiple example styles (single, multiple, brand-specific, command-style, request-style). This goes well beyond the basic schema descriptions and greatly aids correct usage.
Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.
Does the description clearly state what the tool does and how it differs from similar tools?
The description clearly states the tool's purpose: search and return logos in specified formats. It distinguishes itself from sibling component tools by focusing specifically on logo retrieval with format options, multiple search support, and category filtering.
Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.
Does the description explain when to use this tool, when not to, or what alternatives exist?
Provides explicit when-to-use triggers (e.g., '/logo' command, adding a company logo not in the local project) and example query styles. However, it does not mention when not to use the tool or direct alternatives, so it falls short of a perfect 5.
Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections. Dates show when Glama detected each change.
4 tool updates
v0.1.1-beta.1- First observed
21st_magic_component_builder - First observed
21st_magic_component_inspiration - First observed
21st_magic_component_refiner - First observed
logo_search
TDQS
The three 21st_magic_component tools have distinct purposes (build, inspire, refine), but the inspiration tool's description contains contradictory text about returning a text snippet, which could confuse agents into thinking it overlaps with the builder. Logo search is clearly separate, but the overlap between builder and inspiration creates some ambiguity.
Three tools follow a consistent 21st_magic_component_ prefix pattern, while logo_search deviates entirely, resulting in a mixed naming convention. All names are snake_case and readable, but the lack of a unified prefix makes the set feel somewhat inconsistent.
Four tools is a well-scoped size for a UI component agent, covering creation, refinement, inspiration, and logo lookup without unnecessary bloat. This fits comfortably within the typical 3-15 tool range and each tool has a clear role.
The tool surface covers the essential lifecycle for UI component work: create new components, refine existing ones, find inspiration, and search logos. Minor gaps exist, such as no explicit component analysis or listing tool, but agents can work around these without major failures.
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 Connectors
UI design from prompts, screenshots, and URLs for AI coding agents and theme tokens.
Build and manage your design system with AI: tokens, themes, components, icons, Figma and code.
AI-powered design and management for Webflow Sites
Build, deploy, and sell AI agents for local-service businesses - from your IDE.
Related MCP Servers
- AlicenseBqualityBmaintenanceAn AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.416,5965,759ISC
- FlicenseBqualityDmaintenanceAI-driven tool that helps developers create beautiful UI components instantly through natural language descriptions, integrating with popular IDEs like Cursor, Windsurf, and VSCode.32-
- AlicenseBqualityCmaintenanceAn AI-powered Tailwind builder that helps developers create, inspire, and refactor UI components directly within their IDE, supporting popular frameworks like React, Next.js, Vue, and Svelte.66432MIT
- AlicenseBqualityDmaintenanceEnables developers to generate beautiful, modern UI components through natural language descriptions. Integrates with popular IDEs to instantly create and customize React components inspired by 21st.dev's component library.418ISC
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/vparsatwar-git/magic-mcp'
If you have feedback or need assistance with the MCP directory API, please join our Discord server