~/guides/MAGIC.md

Guides / AI tools

21st MCP (formerly Magic MCP): stop Claude Code's pages looking AI-made, set up in two steps

21st MCP lets Claude Code pick one of 21st.dev's 12,000+ React components and write it into your project. Key, one-line install, plugin, prompts, free limits.

Pages made by Claude Code often look AI-made at first glance. 21st MCP (formerly Magic MCP) has it use ready-made components built by people on 21st.dev instead: once it is installed, say "add a pricing table with 21st" and it searches, picks one and writes it into your project. This is the full version of the MAGIC reel: the before / after first, then how to get an API key, install it in Claude Code with one command (or the plugin), prompts you can copy, and what to watch out for: the free limit, paid AI generation, the rename and licences.

01The result first: one pricing table, Claude's default vs a 21st component

Top: Claude's default white three-card pricing table. Bottom: the black pricing section component from 21st.dev
Top: Claude's default (one sentence, no design direction). Bottom: a real 21st.dev component by Gujjeti Mokshith.

Ask Claude Code for a web page and you can often tell AI made it: white background, three rounded cards, a purple "Most Popular" in the middle. 21st MCP (formerly Magic MCP) works differently: it lets Claude Code pick a human-made component from 21st.dev's 12,000+ React + Tailwind components and write it into your project.

When you are done, you will have:

  1. A 21st API key (a free account can create one).
  2. 21st installed in Claude Code with one command, or with the official plugin instead.
  3. No commands to memorise: tell Claude Code in a normal sentence, "add a pricing table with 21st", and it searches, picks a component and writes it into your project.
  4. Prompts you can copy; replace the [ ] parts with your page and component.
  5. An honest warning: a free account gets only 2 components a day, generating with AI costs money, and you have to check each component's licence yourself.

02Step 1: Create a 21st account and an API key

Top of 21st.dev/mcp: Use 21st in your agent, Search 12,000+ components, and an API key button
21st.dev/mcp: the "API key" button on the right is where you create a key.
  1. Open 21st.dev/mcp.
  2. Log in at the top right; if you have no account, click "Get 21st free" to create a free one.
  3. Click "API key" on the page, create a new key and copy it.
  4. Once you are logged in, the install commands on that page include your key, so you can copy them as they are.
The 21st-dev/magic-mcp README on GitHub: Magic MCP → 21st MCP, and Old Magic API keys were reset
The official README: Magic MCP is now 21st MCP, and every old Magic API key was reset.

03Step 2: Install it in Claude Code with one command (or the plugin)

The Claude tab on 21st.dev/mcp: Register the server, check with claude mcp list, and the two plugin lines
21st.dev/mcp, Claude → Claude Code tab: 01 register, 03 check, 04 plugin.

Paste this line in your terminal (not in the Claude Code chat) and replace the [ ] part, brackets included, with your API key:

Install in Claude Code (terminal)
claude mcp add --transport http 21st https://21st.dev/api/mcp --header "x-api-key: [paste your API key]"
  1. Paste it and press Enter. By default it is installed for the project folder you are in.
  2. To use it in every project, add --scope user after 21st (as in Claude Code's official docs).
  3. Run claude mcp list; when 21st shows as Connected, it worked.
  4. Type claude in your project folder and start.
Check the install (terminal)
claude mcp list

The other way is the official plugin: it installs the 21st server and the 21st skills together. Type these two lines inside Claude Code:

Install with the plugin (inside Claude Code)
/plugin marketplace add 21st-dev/claude-code-plugin
/plugin install 21st@21st

04Step 3: Ask in a normal sentence, no /ui

21st's Claude Code demo: one prompt, three search results, get_component, pricing.tsx written, build passes
21st's own demo: one sentence → search → pick a component → write pricing.tsx → build passes.

Magic MCP used to need /ui; not any more. The official advice is to use plain language and ask the agent to search 21st for components. Mention "21st" in the sentence and Claude Code knows to use it. These are the ones I use most:

Add a new component (replace the [ ] parts)
Use 21st to add a [component, for example a pricing table] to [page, for example the home page app/page.tsx], in a [style, for example dark and minimal, matching the site's current colours] style.
Just search first: list 3 candidates, their authors and how they differ, and wait for me to pick one before installing.
Replace a section that looks AI-made
Use 21st to find a [component, for example an FAQ accordion] to replace the current version in [file, for example components/faq.tsx].
Keep my existing text, and use the project's current colours and fonts.
Fill it with your content after installing
Replace the content of the [component name] you just installed from 21st with mine: [plan names, prices, the key points of each plan].
Then run [npm run build] and tell me only when there are no errors.

Behind the scenes it does this (the flow in 21st's own demo):

  1. search: looks up components on 21st from your description. Search is free and unlimited.
  2. get_component: fetches the code of the component you picked. This is what the free account's 2 a day counts.
  3. Writes the component into a file (components/ui/pricing.tsx in the demo), installs the packages it needs and swaps hard-coded colours for your project's settings.
  4. Runs the type check and build, and tells you which page it is on when they pass.

05Good to know

21st.dev/pricing: Builder $6 a month (yearly), Builder + AI $15 a month (yearly), Team $7.50 per seat a month
21st.dev/pricing (yearly prices): Builder says "Free: 2 a day"; AI generation needs Builder + AI.
  1. Free account: unlimited search; 2 component-code retrievals a day, counted across the website, the MCP and the CLI together (copies and installs both count).
  2. Builder: $6 a month billed yearly, $8 a month billed quarterly. Unlimited component installs, but no AI credits.
  3. Generating components from scratch with AI (the generate tool) needs Builder + AI: from $15 a month for 500 credits (yearly; $20 quarterly), $30 for 1,000 and $60 for 2,000 (yearly). Without AI on the account, Claude Code doesn't even see the generation tools.
  4. Magic MCP is now called 21st MCP and all old Magic API keys were reset, so create a new one. The /ui and /21 commands in older tutorials are gone; just use normal sentences.
  5. Component licences: 21st's terms say Marketplace code belongs to its authors (and 21st Labs); the terms give no general licence, and you may not resell or republish it without permission. Open-source components keep their original licence and need visible credit to the author. Before using one in a commercial project, check the licence on the component page and from its author; the component page I used here doesn't state a clear licence, so ask the author first.
  6. Your API key is your account's quota; keep it out of public repos and screenshots.
  7. Prices and the daily limit were checked on the official pages on 5 Nov 2026 and may change; 21st.dev/pricing is the reference.
  8. You found this page by typing MAGIC in the link in bio; there are no DMs.

Sources

Related guides