21st.dev Magic AI Agent

by @21st-dev

21st.dev Magic AI Agent MCP Server

21st.dev Magic AI Agent turns natural-language requests into customizable UI components inside supported coding tools. It combines component-library inspiration, previews, TypeScript support, and brand assets for interface development.

Server facts

21st.dev Magic AI Agent MCP Server

GitHub stars

6,089

Last commit

Sep 9, 2026

Runtime

node

License

—

Tech

Runtime
nodeTypeScript
Transports
stdio
Remote access
No

Activity

GitHub stars
6,089
Last commit
Data as of

Tags

  • Brand Assets
  • Ide Integration
  • React
  • Typescript
  • Ui Generation

Overview

21st.dev Magic AI Agent focuses on building interface components from conversational requests. A developer uses the /ui instruction in an AI agent chat, describes the desired component, and lets the editor invoke Magic. The resulting component is added to the project and remains editable. The README describes inspiration from the 21st.dev component collection, real-time previews, TypeScript support, and access to logos and brand assets through SVGL. It also says the agent limits changes to files associated with generated components and follows the surrounding project's style and organization. The intended workflow is component creation within an existing development environment, not a replacement for the rest of the application.

Setup requires Node.js and a supported editor or client, plus an API key created in the Magic console. The README provides CLI installation guidance and manual npx configurations for MCP clients. Cursor, Windsurf, VS Code, and Cline appear among the supported development environments, with Cline integration marked beta. The document also labels Magic itself beta and marks enhancement of existing components with advanced features and animations as forthcoming. Generated components can be customized, and the FAQ advises splitting especially complex interfaces into smaller pieces. Monthly generation limits are mentioned, although exact allowances are not stated. Named MCP tool identifiers are not supplied in this input.

Install & configure

Requirements

  • Node.js, with the latest LTS recommended
  • A supported IDE or MCP client
  • An API key from the Magic console
Documented launch / install command
npx -y @21st-dev/magic@latest

This follows the README's manual VS Code server configuration. Other supported clients also have installation instructions. Named MCP tools are not stated in the README.

Config file · macOS: ~/Library/Application Support/Claude/claude_desktop_config.json

Windows: %APPDATA%\Claude\claude_desktop_config.json

Use Settings → Developer → Edit Config when available. Do not assume a Linux configuration path; check the client documentation for your platform. Remote servers use the app’s connector flow when supported, not the local stdio file shown here. Merge this example with existing settings; do not overwrite unrelated servers.

Claude Desktop configuration
{
  "mcpServers": {
    "magic-mcp": {
      "command": "npx",
      "args": [
        "-y",
        "@21st-dev/magic@latest"
      ],
      "env": {
        "API_KEY": "<your 21st.dev Magic API key>"
      }
    }
  }
}

Read the Claude Desktop setup guide

Config file · Project: .cursor/mcp.json

User: ~/.cursor/mcp.json

The project path is relative to the workspace root. The tilde denotes your user home directory. Use Cursor’s MCP settings to confirm which configuration and scope your installed version is reading. Merge this example with existing settings; do not overwrite unrelated servers.

Cursor configuration
{
  "mcpServers": {
    "magic-mcp": {
      "command": "npx",
      "args": [
        "-y",
        "@21st-dev/magic@latest"
      ],
      "env": {
        "API_KEY": "<your 21st.dev Magic API key>"
      }
    }
  }
}

Read the Cursor setup guide

Config file · Workspace: .vscode/mcp.json

For user scope, use the “MCP: Open User Configuration” command if available. Do not guess a user configuration path across operating systems, profiles, containers, or remote workspaces; check the client documentation. Merge this example with existing settings; do not overwrite unrelated servers.

VS Code configuration
{
  "servers": {
    "magic-mcp": {
      "type": "stdio",
      "command": "npx",
      "args": [
        "-y",
        "@21st-dev/magic@latest"
      ],
      "env": {
        "API_KEY": "<your 21st.dev Magic API key>"
      }
    }
  }
}

Read the VS Code setup guide

Config file · macOS/Linux: ~/.codeium/windsurf/mcp_config.json

Windows: %USERPROFILE%\.codeium\windsurf\mcp_config.json

Open the MCP configuration through Windsurf’s settings when possible to confirm the active file. Paths can differ in managed or future releases; check the client documentation if this location is not present. Merge this example with existing settings; do not overwrite unrelated servers.

Windsurf configuration
{
  "mcpServers": {
    "magic-mcp": {
      "command": "npx",
      "args": [
        "-y",
        "@21st-dev/magic@latest"
      ],
      "env": {
        "API_KEY": "<your 21st.dev Magic API key>"
      }
    }
  }
}

Read the Windsurf setup guide

Config file · Project scope: .mcp.json at the repository root

The project file uses mcpServers. For user scope, use claude mcp add --scope user rather than assuming .mcp.json in your home directory is the user configuration. Check the client documentation for managed settings and storage details. Merge this example with existing settings; do not overwrite unrelated servers.

Claude Code configuration
{
  "mcpServers": {
    "magic-mcp": {
      "type": "stdio",
      "command": "npx",
      "args": [
        "-y",
        "@21st-dev/magic@latest"
      ],
      "env": {
        "API_KEY": "<your 21st.dev Magic API key>"
      }
    }
  }
}

Read the Claude Code setup guide

Examples are translated from the published configuration. Supply your own credentials and verify requirements in the upstream README. Remote connectors are shown only where a supported configuration format is known.

Use cases

  • Generate a UI component from a description in an editor chat.
  • Customize generated React component styling and behavior.
  • Preview a component while iterating on its design.
  • Use SVGL logos and brand assets in interface work.

Strengths

  • Creates editable components directly in a project.
  • Provides TypeScript support and real-time previews.
  • Integrates component inspiration and brand asset access.

Limitations

  • Requires an API key and a supported development environment.
  • The README labels the product beta and some enhancement features as coming soon.
  • Generation limits are mentioned without exact allowances.

21st.dev Magic AI Agent setup notes

  • Check API_KEY in the 21st.dev Magic AI Agent configuration if startup or authentication fails.
  • 21st.dev Magic AI Agent's stdio example needs a client that launches local processes.
  • 21st.dev Magic AI Agent has no recorded license; confirm reuse terms in its repository.

Frequently asked questions

The documented workflow uses /ui followed by a component description in the agent chat, then invokes Magic through the editor.

Related MCP servers