/ Directory / Playground / 21st.dev Magic MCP
● Official 21st-dev ⚡ Instant

21st.dev Magic MCP

by 21st-dev · 21st-dev/magic-mcp

Generate beautiful React components inline — like v0, but inside your editor.

Magic MCP is 21st.dev's component generator: ask in plain English, get a production-quality React + Tailwind component returned inline. Works in Cursor, Claude Code, Windsurf — anywhere MCP runs.

Why use it

Key features

Live Demo

What it looks like in practice

magic-mcp.replay ▶ ready
0/0

Install

Pick your client

~/Library/Application Support/Claude/claude_desktop_config.json  · Windows: %APPDATA%\Claude\claude_desktop_config.json
{
  "mcpServers": {
    "magic-mcp": {
      "command": "npx",
      "args": [
        "-y",
        "@21st-dev/magic@latest"
      ]
    }
  }
}

Open Claude Desktop → Settings → Developer → Edit Config. Restart after saving.

~/.cursor/mcp.json · .cursor/mcp.json
{
  "mcpServers": {
    "magic-mcp": {
      "command": "npx",
      "args": [
        "-y",
        "@21st-dev/magic@latest"
      ]
    }
  }
}

Cursor uses the same mcpServers schema as Claude Desktop. Project config wins over global.

VS Code → Cline → MCP Servers → Edit
{
  "mcpServers": {
    "magic-mcp": {
      "command": "npx",
      "args": [
        "-y",
        "@21st-dev/magic@latest"
      ]
    }
  }
}

Click the MCP Servers icon in the Cline sidebar, then "Edit Configuration".

~/.codeium/windsurf/mcp_config.json
{
  "mcpServers": {
    "magic-mcp": {
      "command": "npx",
      "args": [
        "-y",
        "@21st-dev/magic@latest"
      ]
    }
  }
}

Same shape as Claude Desktop. Restart Windsurf to pick up changes.

~/.continue/config.json
{
  "mcpServers": [
    {
      "name": "magic-mcp",
      "command": "npx",
      "args": [
        "-y",
        "@21st-dev/magic@latest"
      ]
    }
  ]
}

Continue uses an array of server objects rather than a map.

~/.config/zed/settings.json
{
  "context_servers": {
    "magic-mcp": {
      "command": {
        "path": "npx",
        "args": [
          "-y",
          "@21st-dev/magic@latest"
        ]
      }
    }
  }
}

Add to context_servers. Zed hot-reloads on save.

claude mcp add magic-mcp -- npx -y @21st-dev/magic@latest

One-liner. Verify with claude mcp list. Remove with claude mcp remove.

Use Cases

Real-world ways to use 21st.dev Magic MCP

Generate a polished landing-page hero in under a minute

👤 Frontend engineers shipping fast ⏱ ~15 min intermediate

When to use: You need a hero section right now and don't want to start from a blank file.

Prerequisites
  • Server/skill installed and authenticated — See repo README
Flow
  1. Search for inspiration
    Search 21st for hero sections that mix gradient + product screenshot.✓ Copied
    → 5–10 starter components
  2. Generate the final one
    Create a Hero component: dark gradient bg, headline 'Ship faster.' subhead 'AI for serious teams.' a primary CTA + secondary CTA, social proof row.✓ Copied
    → A complete tsx file using shadcn primitives

Outcome: A real production-shape component in one prompt.

Pitfalls
  • Generated components assume shadcn primitives are installed — Generated components assume shadcn primitives are installed — run npx shadcn add button card first.
Combine with: filesystem · flyonui-mcp

Combinations

Pair with other MCPs for X10 leverage

magic-mcp + filesystem

Pair with filesystem for complementary capabilities

Use this server together with filesystem to complete a multi-step task.✓ Copied
magic-mcp + flyonui-mcp

Pair with flyonui-mcp for complementary capabilities

Use this server together with flyonui-mcp to complete a multi-step task.✓ Copied

Tools

What this MCP exposes

ToolInputsWhen to callCost
create_component description, framework Need a new UI component 21st credits
refine_component component_code, instruction Tweak an existing component 21st credits
search_components query Find a pre-made starting point 1 API call

Cost & Limits

What this costs to run

API quota
See provider docs for rate limits
Tokens per call
Varies by tool
Monetary
See repo README for pricing details
Tip
Cache tool results and avoid repeated identical calls.

Security

Permissions, secrets, blast radius

Credential storage: Use environment variables; never commit secrets
Data egress: Tool calls go to the provider's API as documented

Troubleshooting

Common errors and fixes

API key invalid

Get a key at 21st.dev/settings/api and set TWENTY_FIRST_API_KEY.

Verify: search_components returns results
component uses missing shadcn import

Run npx shadcn add <component> for each unresolved import.

Verify: Vite/Next builds cleanly

Alternatives

21st.dev Magic MCP vs others

AlternativeWhen to use it insteadTradeoff
v0.devYou prefer the v0 web UIOutside your editor; different style

More

Resources

📖 Read the official README on GitHub

🐙 Browse open issues

🔍 Browse all 400+ MCP servers and Skills