Skip to content

Connect 21st.dev to Codex

Community marketplace of React components, templates, shadcn themes and shaders, with a hosted MCP server for agents. Browsing is free; copying more than a few components a day needs a membership.

MCP serverOfficialChecked 2026-11-16

Before you start

  • Codex installed (see its MCP documentation (opens in a new tab)).
  • 21st.dev is available on macOS, Windows, Linux and the web.
  • Get an API key at 21st.dev/mcp and set it as API_KEY_21ST in your environment. Keys from the old Magic console no longer work. AI generation tools only appear when your account has AI access. Each component page also shows its own shadcn CLI command.
  1. Step 1: Add 21st.dev to Codex

    Add it to the config file

    Add this to ~/.codex/config.toml.

    ~/.codex/config.toml
    [mcp_servers.21st-dev]
    url = "https://21st.dev/api/mcp"
    env_http_headers = { "x-api-key" = "API_KEY_21ST" }
    Good to know
    • Codex reads API_KEY_21ST from your environment each time it connects, so the token stays out of the file.
  2. Step 2: Check it's connected

    Terminal
    codex mcp list

    In a Codex session, run /mcp to see connected servers and their tools.

  3. Step 3: Try a first request

    Ask Codex something that only works with 21st.dev connected:

    Say to Codex
    Search 21st.dev for a pricing section that fits this page and show me how to adapt it.

If it doesn't work

  • Codex reads ~/.codex/config.toml. A project .codex/config.toml is only read in projects you have trusted.
  • Codex doesn't expand ~ or environment variables in command. Use a full path in the config file.
  • Servers that need a sign-in: run codex mcp login <name>.