guide

Magic MCP Turns Claude Code Into a UI Designer

Claude Code's default output is gray boxes and Arial. No animations, no hover states, nothing. Magic MCP fixes that — one command, and you're getting gradient text, glow cards, and Framer Motion out of the box.

Claude Code terminal running a /ui command with Magic MCP generating an animated React hero section with gradient text and floating shapes

Magic MCP Turns Claude Code Into a UI Designer

The UI Claude Code produces without help is bad. Not "needs polish" bad — genuinely depressing. Gray background, system font, a button that looks like it was styled in 2009. You can write it a perfect prompt and still get something you'd be embarrassed to screenshot.

Magic MCP is the fix. One command in terminal, one restart, and suddenly /ui gives you animated gradient text, glassmorphism cards, floating geometric shapes — the kind of stuff that used to mean three hours in Figma and another two translating it into code.

I ran it on a side project late on a Wednesday night, purely because I was too tired to write CSS. By the time I went to bed, I had a hero section, a pricing table, and a feature grid. All styled. All animated. All actually good.


What Magic MCP Is

It's a plugin — technically an MCP server — that plugs into Claude Code (and Cursor, Windsurf, or VSCode). What it does is connect your editor to a library of designer-built React components.

You describe what you want in plain text. Magic opens a browser, shows you several design variations, you pick one, and the code lands in your project. Not a snippet you paste. An actual file, with imports, Tailwind classes, Framer Motion animations, the works.

Without Magic: gray box, Arial, button with no hover state.
With Magic: animated shapes, gradient headings, glow borders on card hover, 3D tilt effects.

That's the whole pitch. It delivers.


Installation in 3 Steps

Step 1 — Get Your API Key

Go to 21st.dev/mcp. Sign in with Google or GitHub. The page immediately shows you a ready-made terminal command with your API key already baked in. No digging through a settings panel.

Step 2 — Run the Install Command

For Claude Code:

claude mcp add magic --scope user --env API_KEY="your-key-here"

For Cursor:

npx @21st-dev/cli@latest install cursor --api-key YOUR_KEY

For Windsurf:

npx @21st-dev/cli@latest install windsurf --api-key YOUR_KEY

Restart your editor. That's genuinely all there is to it — no config files to edit, no JSON to wrangle.

Step 3 — Type /ui

/ui make a hero section with animated gradient text and floating shapes

Magic opens a browser tab with design options. You pick one. The component appears in your project. Done.


What You Can Actually Build With It

Generation is the core use case. Describe a component in natural language, get working React code. The more specific you are, the better the output — more on that below.

Variations — it doesn't give you one option. It shows you several interpretations of your prompt and you pick the one closest to what you had in mind. Saves the back-and-forth of iterating on a single output.

Improvement — you can point it at an existing component file and ask it to upgrade the design. Useful when you've got something that works but looks rough.

Icons and logos/logo [brand] pulls SVG logos from SVGL, a massive library of branded icons. Way faster than hunting through icon packs.

The commands are simple:

CommandWhat it does/ui [description]Generate a new component/ui improve [file]Redesign an existing component/logo [brand]Find an SVG logo


Prompts That Actually Work

Vague prompts produce vague results. "Make a nice hero" will get you something generic. Specificity is everything here.

These prompts produced solid output:

/ui dark hero section with floating geometric shapes, 
gradient text from orange to amber, animated fade-up on load
/ui 3 feature cards with glow border on hover, 
glassmorphism effect, icons and short descriptions
/ui sticky navbar with blur background on scroll, 
logo left, nav links right, CTA button, dark theme
/ui pricing table 3 columns, middle column highlighted, 
dark theme with gradient accents on the recommended plan

The pattern: style name (glassmorphism, brutalism, minimalist) + specific effect (glow on hover, blur on scroll) + color direction (orange to amber, not just "warm tones"). Give it those three things and the output is consistently usable.

One thing that caught me off guard — if you don't specify dark or light, it sometimes picks for you and picks wrong. Just always state the theme.


The Community Library Is the Hidden Value

best Claude Code plugins and tools

Everyone focuses on the generation feature. The community library at 21st.dev/community/components is actually more useful, and most people skip it.

It's hundreds of components built by designers. Not AI-generated components — actual design work. Animated navigation bars, complex pricing tables, card grids with real visual hierarchy.

Here's the workflow I landed on:

  1. Browse 21st.dev/community/components until you find something close to what you need

  2. Copy the prompt that's shown alongside it

  3. Paste that prompt into Claude Code with /ui

  4. Magic recreates it in your project

  5. Ask it to adjust — swap colors, change copy, add or remove sections

You're not limited to what Magic can imagine from scratch. You're starting from a human designer's component and asking Magic to adapt it. The results are noticeably better than pure generation.

(The component I spent the most time on was a pricing table with an animated gradient border on the recommended plan. Found it in community, had it running locally in about four minutes.)


Does It Get Better With Design Skills?

Yes, and this is where it gets interesting.

Magic gives you components. But components without a consistent design system look like you grabbed a bunch of random pieces from the internet — because you did.

Combining Magic with a design skill like [INTERNAL LINK: UI-UX Pro Max Claude Code skill] changes that. The skill sets rules — typography scale, color palette, spacing system, animation easing — and Magic generates components inside those rules. Instead of random pieces, you get a coherent UI.

The practical difference: without a design skill, you might get one card with an orange accent, another with blue, and a third with gray. With a design skill active, everything derives from the same token set. It feels like a product, not a prototype.

Worth setting up if you're building something you'll actually ship.


When It Breaks (And It Does Break)

Magic is in beta. It mostly works, but here are the failure modes I hit:

Magic doesn't respond at all. Run claude mcp list — check that "magic" appears. If it doesn't, re-run the install command. If it does appear but still doesn't respond, restart Claude Code completely, not just reload the window.

Dependency errors after generation. Magic assumes these are installed:

npm install framer-motion lucide-react clsx tailwind-merge class-variance-authority @radix-ui/react-slot

Run that before you assume anything is broken with Magic itself.

Component renders blank. Three things to check in order: Is "use client" the first line of the file? Is Tailwind configured in the project? Is your Tailwind version v3 or higher? Magic generates v4-compatible syntax that v3 can't parse. That last one killed an hour of my evening before I figured it out.

API key fails. Go back to 21st.dev/mcp and log in before copying the key. If your session had expired when you grabbed it, the key is bad. Happens more often than it should.


The Bottom Line

Magic MCP is one of those tools where the setup takes four minutes and then you quietly wonder why you spent years writing CSS by hand. The /ui command isn't magic in a hand-wavy sense — it's just a fast path from "I need a component" to "I have a component," with the design already done.

The community library is what makes it worth keeping around long-term. Pure generation has limits. Starting from real design work and asking an AI to adapt it is a different workflow entirely.

Install it. Run one prompt. See what you get.

Frequently Asked Questions

How do I install Magic MCP in Claude Code?
Sign in at 21st.dev/mcp, copy the command shown on the page, and run it in your terminal: claude mcp add magic --scope user --env API_KEY="your-key". Restart Claude Code. That's it — /ui is ready.
What does the /ui command actually do in Magic MCP?
It takes a text description, opens a browser with several design variations, and lets you pick one — the selected component gets written into your project as a React file with Tailwind and Framer Motion. No manual copy-paste.
Magic MCP is not responding — how do I fix it?
Run claude mcp list to check if it's registered. If not, re-run the install command. If it shows but still doesn't respond, copy a fresh API key from 21st.dev/mcp — keys can go stale if the session expired before you grabbed it.
Can I use Magic MCP with Cursor or Windsurf?
Yes. For Cursor: npx @21st-dev/cli@latest install cursor --api-key YOUR_KEY. For Windsurf: npx @21st-dev/cli@latest install windsurf --api-key YOUR_KEY. Same components, same community library.
Why is my Magic MCP component not rendering correctly?
Three usual suspects: missing "use client" at the top of the file, Tailwind not configured in the project, or a version mismatch — Magic generates Tailwind v4 syntax, which breaks on v3 setups. Check all three before anything else.

Share this article

Roman Knox

Want more like this?

Join Knox community — templates, live sessions, and a network of builders.

Join the Builders

Comments

0/2,000

Loading comments...

Roman Knox
Roman Knox

Published April 1, 2026

Building businesses with automation and AI. Sharing workflows, templates, and real strategies that work.

Related content