Skip to content

21st.dev Magic MCP and API

21st.dev Magic generates interface components from text descriptions. An agent can generate interface components from text descriptions. Add your API_KEY when you install the 21st.dev Magic MCP server in Longwave.

Add to Longwave

Install elsewhere

Install 21st.dev Magic

Choose a harness. These instructions connect to the hosted MCP endpoint shown on this page.

Claude Code

Run this in your terminal. It adds a user-scoped server; use --scope project instead if it should apply only to the current project.

terminal
claude mcp add --scope user --transport http --header 'x-api-key: env:API_KEY_21ST' magic https://21st.dev/api/mcp

Replace each YOUR_… value with the required secret before running the command.

access
Your key

Use 21st.dev Magic on Longwave

  1. Download Longwave or open app.longwave.run.
  2. Add your API_KEY when you install the 21st.dev Magic MCP server in Longwave.
  3. Ask for the result in any thread, for example: “Generate a component for a signup form”. The agent picks the 21st.dev Magic function and calls it.

Use cases

Questions people ask

What does 21st.dev Magic generate?

Magic generates interface components from a text description. The result is component code for use in an application. 21st.dev Magic documentation

Is Magic the same as the 21st.dev component library?

Magic provides component generation. The 21st.dev website also provides a collection of interface components for browsing and reuse. 21st.dev Magic documentation

How do I add the 21st.dev Magic MCP server to Claude Code?

Run claude mcp add --transport http magic https://21st.dev/api/mcp in a terminal. Add your API_KEY when you install the 21st.dev Magic MCP server in Longwave.

Who publishes the 21st.dev Magic MCP server?

21st.dev publishes the 21st.dev Magic MCP server that Longwave installs. Source code

Use 21st.dev Magic in Longwave

Call 21st.dev Magic from any agent thread, on your machine or in the cloud.

Add to Longwave