Skip to main content
Glama

21st.dev Magic AI Agent

MCP Banner

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:

  • 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: 21st.dev Magic AI Agent

🎯 How It Works

  1. Tell Agent What You Need

    • In your AI Agent's chat, just type /ui and describe the component you're looking for

    • Example: /ui create a modern navigation bar with responsive design

  2. 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

  3. 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

  1. Generate API Key

    • Visit your Magic dashboard

    • Navigate to the API section

    • Generate a new API key

  2. IDE Setup

Cursor IDE

npx -y @smithery/cli@latest run @21st-dev/magic-mcp --config "{\"TWENTY_FIRST_API_KEY\":\"your-api-key\"}"

Windsurf

Add to ~/.codeium/windsurf/mcp_config.json:

{
  "mcpServers": {
    "magic": {
      "command": "npx",
      "args": [
        "-y",
        "@smithery/cli@latest",
        "install",
        "@21st-dev/magic-mcp",
        "--client",
        "windsurf"
      ],
      "env": {
        "TWENTY_FIRST_API_KEY": "your-api-key"
      }
    }
  }
}

VSCode + Cline (Beta)

Add to Cline's MCP configuration:

{
  "mcpServers": {
    "magic": {
      "command": "npx",
      "args": [
        "-y",
        "@smithery/cli@latest",
        "install",
        "@21st-dev/magic-mcp",
        "--client",
        "cline"
      ],
      "env": {
        "TWENTY_FIRST_API_KEY": "your-api-key"
      }
    }
  }
}

❓ 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 assets

Key Components

  • IdeInstructions: Setup instructions for different IDEs

  • ApiKeySection: API key management interface

  • WelcomeOnboarding: 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

⚠️ 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

3 tools
21st_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."

ParametersJSON Schema
NameRequiredDescriptionDefault
messageYesFull users message
searchQueryYesGenerate 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

TDQS

A4.1/5.0
Behavior3/5

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 explains that the tool returns text snippets and requires manual integration afterward, which is useful context. However, it doesn't disclose important behavioral traits like whether this is a read-only operation, if it makes external API calls, potential rate limits, or error handling for invalid requests.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness5/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is extremely concise and well-structured with only three sentences, each serving a distinct purpose: trigger conditions, tool limitation, and required follow-up actions. There's zero wasted text, and the most important information (when to use the tool) is front-loaded.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given no annotations and no output schema, the description provides adequate context for a simple tool but has gaps. It explains the tool's purpose and usage well but doesn't describe what the output looks like (format, structure, or content of returned snippets) or address potential limitations or error conditions that would help an agent use it correctly.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

With 100% schema description coverage, the baseline is 3. The description doesn't add any parameter-specific information beyond what's already in the schema (message and searchQuery parameters are fully documented in the schema). No additional syntax, format, or usage details for parameters are provided in the description.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states the tool's purpose: 'returns the text snippet for that UI component' when users request new UI components. It specifies the exact trigger conditions (mentions of /ui, /21, /21st, or specific component types) and distinguishes it from sibling tools by focusing on returning component snippets rather than inspiration or logo searches.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines5/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides explicit usage guidelines: 'Use this tool when the user requests a new UI component' with specific trigger examples, and distinguishes it from alternatives by stating 'This tool ONLY returns the text snippet' and requiring follow-up actions. It clearly defines when to use this tool versus other approaches.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

21st_magic_component_inspirationC

"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."

ParametersJSON Schema
NameRequiredDescriptionDefault
messageYesFull users message
searchQueryYesSearch 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

C2.9/5.0
Behavior3/5

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 states the tool returns JSON data without generating new code and only returns text snippets, which clarifies its read-only nature and output format. However, it doesn't address potential limitations like rate limits, authentication needs, or error handling, leaving gaps in behavioral understanding for a tool with no annotation coverage.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness4/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is relatively concise with three sentences that convey key information: when to use the tool, what it returns, and a post-call action. However, the first sentence is somewhat redundant ('see component, get inspiration, or /21st fetch data'), and the structure could be more front-loaded by immediately stating the core purpose. Overall, it's efficient but not perfectly streamlined.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness3/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given no annotations, no output schema, and 2 parameters with full schema coverage, the description provides basic context: it specifies the tool's purpose, output format (JSON data/text snippets), and a required post-call action. However, it lacks details on error cases, response structure, or integration examples, making it incomplete for a tool that fetches external data without structured output documentation.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters3/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

The input schema has 100% description coverage, providing clear details for both parameters ('message' and 'searchQuery'). The description adds no additional parameter semantics beyond what the schema already documents, such as explaining how these parameters interact or their impact on results. This meets the baseline score of 3, as the schema adequately covers parameter information.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose3/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description states the tool fetches data and previews from 21st.dev and returns JSON data of matching components, which clarifies its purpose. However, it doesn't clearly differentiate from sibling tools like '21st_magic_component_builder' or 'logo_search', leaving ambiguity about when to use each. The phrase 'see component, get inspiration, or /21st fetch data' is somewhat vague rather than specific.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines2/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

The description provides minimal guidance: 'Use this tool when the user wants to see component, get inspiration, or /21st fetch data and previews from 21st.dev.' It doesn't specify when to use this tool versus alternatives like '21st_magic_component_builder' or 'logo_search', nor does it mention any exclusions or prerequisites. This lack of comparative context limits its effectiveness in guiding tool selection.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

TDQS

B3.1/5.0
Disambiguation2/5

The first two tools have significant overlap in purpose and confusing descriptions. Both '21st_magic_component_builder' and '21st_magic_component_inspiration' claim to return UI component snippets and require integration into the codebase, making it unclear when to use one versus the other. The third tool 'logo_search' is clearly distinct for logo handling, but the ambiguity between the first two tools is problematic.

Naming Consistency2/5

The naming is inconsistent with mixed conventions. The first two tools use a verbose '21st_magic_component_' prefix with different suffixes ('builder' vs 'inspiration'), while the third tool uses a simple 'logo_search' with underscore. There's no consistent verb_noun pattern, and the styles vary significantly across the set.

Tool Count3/5

With only 3 tools, the count feels thin for a 'Magic Component Platform' that seems to handle UI components and logos. While 3 tools isn't inherently wrong, it suggests limited scope or incomplete coverage for what the server name implies. It's borderline but leans toward under-scoped.

Completeness2/5

For a component platform, there are significant gaps. The tools cover component building/inspiration and logo search, but lack essential operations like updating existing components, deleting components, managing component libraries, or handling component state/props systematically. The surface feels incomplete for proper component lifecycle management.

Maintenance

ActivityInactive
ResponsivenessSyncing

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

Related MCP Servers

Latest Blog Posts

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/oyasimi1209/magic-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server