Magic MCP by 21st.dev lets Claude generate polished, production-ready UI components from natural language, returning React and Tailwind code you can drop straight into a project.
by 21st.dev · submitted by glorydavid03023·added 2026-06-03·5,129 source repo stars·
Generates UI code that is inserted into your project; review the output before committing or shipping it., Makes outbound network requests to the 21st.dev Magic service to produce components.
Privacy notes
The component descriptions and prompts you provide are sent to the 21st.dev Magic service to generate code, so avoid embedding secrets in them., The Magic API key is a credential; store it securely and do not commit it to source control.
Author
21st.dev
Submitted by
glorydavid03023
Claim status
unclaimed
Last verified
2026-06-03
Decision playbook
Review trust signals before you adopt
Signals are present but mixed. Use the checklist below to confirm the source and operational safety for your environment.
Compare context
Selected
0
Current score
78
Baseline
—
Delta
No baseline selected
No major trust-signal divergence detected in the current selection.
Source and provenance checks
Complete
Confirm ownership and provenance before trusting install instructions.
Source link availableRequired
Open the canonical repository and verify ownership.
Done
Source provenance statusRequired
Marked as source-backed.
Done
Metadata reviewed
Registry metadata indicates a reviewed listing.
Done
Safety and privacy checks
Complete
Validate risk disclosures before installation or API wiring.
Safety notes presentRequired
Review the listed safety guidance before running commands.
Done
Privacy notes presentRequired
Review data handling notes before connecting accounts or secrets.
Done
Trust level risk gateRequired
Trust level does not block evaluation.
Done
Package and install checks
Needs review
Check package metadata and artifact integrity signals.
Install payload available
Install or copy payload is available for review.
Done
Package verification flag
No package verification flag provided.
Pending
Checksum metadata
No checksum provided for downloaded artifact.
Pending
Compare-driven decision checks
Needs review
Use compare context to validate trade-offs before adoption.
Compare tray has multiple entries
Add at least one more entry to compare trust differences.
2 safety and 2 privacy notes across 3 risk areas. Review closely: credentials & tokens, network access.
3 areas
SafetyGeneralGenerates UI code that is inserted into your project; review the output before committing or shipping it.
SafetyNetwork accessMakes outbound network requests to the 21st.dev Magic service to produce components.
PrivacyCredentials & tokensThe component descriptions and prompts you provide are sent to the 21st.dev Magic service to generate code, so avoid embedding secrets in them.
PrivacyCredentials & tokensThe Magic API key is a credential; store it securely and do not commit it to source control.
Safety notes
Generates UI code that is inserted into your project; review the output before committing or shipping it.
Makes outbound network requests to the 21st.dev Magic service to produce components.
Privacy notes
The component descriptions and prompts you provide are sent to the 21st.dev Magic service to generate code, so avoid embedding secrets in them.
The Magic API key is a credential; store it securely and do not commit it to source control.
Prerequisites
Node.js 18+ and npx available (verify with: npx --version)
A 21st.dev Magic API key (create one at https://21st.dev/magic/console)
Claude Code or Claude Desktop with MCP support
Internet access so the server can reach the 21st.dev Magic service
Magic turns natural-language descriptions into polished UI components without leaving your editor. Ask for a pricing table, a sign-in form, or a navigation bar, and the server returns modern React and Tailwind code ready to paste into a project. It is aimed at speeding up frontend work: instead of hand-writing boilerplate markup and styles, you describe the component you want and refine the generated result. The server exposes generation as an MCP tool, so Claude can call it as part of a normal coding conversation.
Features
Generate production-ready UI components from plain-language descriptions.
Returns React and Tailwind code you can drop directly into a project.
Covers common building blocks like buttons, forms, cards, and layouts.
Keeps you in the editor rather than copying snippets from a separate site.
Runs as a standard stdio MCP server that installs into Claude Code and Claude Desktop with one command.
Maintained by 21st.dev as the official Magic integration.
Use Cases
Scaffold a new component quickly instead of writing boilerplate by hand.
Produce a first-draft layout to iterate on with Claude.
Generate consistent Tailwind markup for repetitive UI elements.
Prototype a page section during early frontend development.
Hand Claude a design description and get usable code back in the same conversation.
Installation
Claude Code
Make sure Node.js 18+ is installed (verify with npx --version).
Add the Magic server to the mcpServers section using the configuration below, with API_KEY set from your environment or replaced by your key in the env object.
Restart Claude Desktop and confirm the server appears.
Describe what you want and let Magic produce the code.
"Create a responsive pricing section with three tiers using React and Tailwind."
Build a form
Ask for a specific input layout.
"Generate a sign-in form with email and password fields, a remember-me checkbox, and a submit button."
Iterate on a result
Refine the generated component in the same conversation.
"Take that card component and add a hover state and a small badge in the top-right corner."
Security
Magic generates code that is inserted into your project. Always review the output before committing or shipping it, just as you would review any generated code.
The server makes outbound requests to the 21st.dev Magic service; the prompts and component descriptions you provide are sent there to generate results.
The Magic API key is a credential. Keep it out of source control and shared configs, and rotate it if it may have been exposed.
Avoid placing secrets or private data in component descriptions, since they are transmitted to the service.
Troubleshooting
Authentication or invalid API key errors
Confirm the API key from https://21st.dev/magic/console is correct and active, and that it is set via --env API_KEY=... or the configuration env object. Regenerate the key if needed.
npx cannot resolve the package
Verify Node.js 18+ and npx are installed (npx --version). Networks that block the npm registry will prevent npx -y @21st-dev/magic@latest from resolving.
Generation requests fail or time out
Check internet access to the 21st.dev Magic service. Transient rate limiting can also cause failures; retry after a short wait and review your plan limits.
Server not listed in Claude Code
Re-run the claude mcp add magic ... command, then claude mcp list. Confirm the API_KEY environment value was included and that the server was added to the scope (project versus user) you are running in.
Show that Magic MCP Server for Claude is listed on HeyClaude. Paste this Markdown into your README — it renders the badge and links back to this page.
[](https://heyclau.de/entry/mcp/magic-mcp-server)
How it compares
Magic MCP Server for Claude side by side with 3 alternatives on trust, install, platform support, and disclosed safety notes — all from reviewed registry metadata.
1 trust signal differ across this comparison (Submitter).
Magic MCP by 21st.dev lets Claude generate polished, production-ready UI components from natural language, returning React and Tailwind code you can drop straight into a project.
Browse and install Magic UI animated React components from Claude — search the library by name or keyword, retrieve full installation details for any entry, and get guided setup instructions — with the official Magic UI MCP server.
Storybook MCP addon that lets Claude and other MCP clients inspect component documentation, generate stories, preview UI states, and run Storybook tests against a local Storybook project.
✓Generates UI code that is inserted into your project; review the output before committing or shipping it.
Makes outbound network requests to the 21st.dev Magic service to produce components.
✓The server is read-only — it queries the Magic UI registry but does not install files into your project automatically.
Installation of components into your project is guided by Claude based on retrieved specs — you apply the changes.
✓shadcn/ui MCP Server retrieves component source, demos, blocks, metadata, dependencies, and repository structures from upstream component repositories.
Generated component suggestions can add UI dependencies, copy code, or change frontend architecture when acted on by an agent.
Review copied component code, dependency additions, styling choices, accessibility behavior, and framework-specific assumptions before committing changes.
SSE and Docker deployment modes need normal network, CORS, and host binding review before multi-client or production use.
✓Storybook's MCP server and AI manifests are preview capabilities, and Storybook states that the API may change in future releases.
The MCP server can guide an agent to generate components, write stories, preview states, and run tests. Review generated UI, stories, tests, and source changes before committing or shipping them.
Storybook docs and stories are project-controlled input. Treat component docs, story text, examples, and addon output as untrusted context that can contain stale guidance or prompt-injection-like instructions.
`run-story-tests` can execute interaction tests and browser-based component code. Do not run untrusted stories or tests with secrets, production credentials, or privileged browser sessions available.
The default MCP endpoint is local to the Storybook dev server. Do not expose the local Storybook MCP endpoint or equivalent Storybook preview URLs to networks or tunnels unless access control and data exposure have been reviewed.
When multiple Storybooks or MCP servers are configured, use descriptive server names so the model does not confuse design systems, toolsets, or component libraries.
Privacy notes
✓The component descriptions and prompts you provide are sent to the 21st.dev Magic service to generate code, so avoid embedding secrets in them.
The Magic API key is a credential; store it securely and do not commit it to source control.
✓Registry queries and component names are sent to the Magic UI registry API. No personal data or project content is sent externally.
✓Component names, framework choices, GitHub API tokens, prompts, tool arguments, and generated UI code may be visible to the MCP client and model provider.
UI prompts can reveal unreleased product workflows, internal design systems, customer-facing screens, or implementation plans.
Treat GitHub personal access tokens as secrets and avoid pasting them into prompts, logs, screenshots, or shared configuration snippets.
✓Storybook MCP tool results can expose component names, props, examples, docs, stories, design-system conventions, theme tokens, UI states, test results, accessibility findings, and story preview links.
Storybook stories and previews can contain mock customer data, screenshots, private workflows, unreleased product UI, internal brand details, or business logic visible through component examples.
Test output, accessibility reports, browser console logs, agent transcripts, screenshots, and generated summaries can retain Storybook content outside the normal repository and design-system access controls.
Composed Storybooks can aggregate documentation and stories from multiple component libraries, so verify which composed sources are exposed before connecting an agent.
Keep secrets, real user records, internal API tokens, and production credentials out of stories, play functions, test fixtures, and local Storybook environments used by AI agents.
Prerequisites
Node.js 18+ and npx available (verify with: npx --version)
A 21st.dev Magic API key (create one at https://21st.dev/magic/console)
Claude Code or Claude Desktop with MCP support
Internet access so the server can reach the 21st.dev Magic service
Node.js with `npx` available.
A React project using Tailwind CSS (Magic UI components are Tailwind-based).
An MCP client such as Claude Code or Claude Desktop.
Node.js and npx available to the MCP client runtime.
Optional GitHub personal access token for higher GitHub API rate limits.
A selected framework target such as React, Svelte, Vue, or React Native.
A project where copied component code and dependencies can be reviewed before use.
React Storybook project, because Storybook documents the MCP server and manifests as preview AI capabilities currently limited to React projects.
Node.js package manager access for installing `@storybook/addon-mcp`.
Running Storybook dev server, with the local MCP endpoint captured as `STORYBOOK_LOCAL_MCP_URL`.
MCP-compatible agent or editor that can connect to local HTTP MCP servers, such as Claude Code, Gemini CLI, OpenAI Codex, VS Code Copilot, or another compatible client.
Install
claude mcp add magic --env API_KEY=your-api-key -- npx -y @21st-dev/magic@latest