Jump to content

Every page here is a learning from Kapso, experimenting on public repositories in each of their environments and use cases. Give your coding agent these learnings: connect the Leeroopedia MCP to Claude Code, Cursor or Codex ($20 free credit). Powered by Leeroo · founders@leeroo.com

Principle:21st dev Magic mcp Component Installation

From Leeroopedia
Knowledge Sources
Domains UI_Components, Build_Tooling
Last Updated 2026-10-19 16:40 GMT

Overview

A retrieval pattern that fetches a chosen catalog component's full source and writes it into the host project, using either a registry CLI or direct file writes.

Description

Component installation is the act of fetching the complete, installable form of a chosen component (source, metadata, file list, install instructions) and placing it into the host project. It addresses the limitation of copy-paste snippets, which omit dependencies, file layout, and wiring. A good install step returns not just code but the instructions for how to place it — either a registry `add` command (which writes files to the configured folder and wires the `cn` helper / Tailwind tokens) or a list of files to write directly. Free tiers may rate-limit installs (e.g. 2/day) and may gate paid components until unlock.

Usage

Use this principle after a catalog search has identified a component and a choice has been made. It is the "retrieve and install" step of the install workflow. The form of install (registry add vs. direct writes) is dictated by the retrieval result's instructions, not chosen by the caller.

Theoretical Basis

The core operation is a two-stage retrieve-then-write:

# Abstract algorithm description (NOT real implementation)
result = fetch_component(installId)        # full source + metadata + install instructions
if result.instructs_registry_add:
    registry_add(result.registry_url)      # CLI writes + wires files into the project
else:
    write_files(result.files, project_dir) # write returned files directly

The caller follows the result's instructions; the mechanism (registry CLI or direct writes) is an implementation detail of the catalog.

Practical Guide

  • Pass the exact `installId` from the search result; do not construct one.
  • Follow the result's `installInstructions` — use `shadcn registry add` when instructed, otherwise write the returned files.
  • Respect free-tier install limits; paid components return code only after unlock.
  • After install, wire the component into the page and adapt tokens/props — see Principle:21st_dev_Magic_mcp_Component_Integration.

Related Pages

Implemented By

Notes

Page Connections

Double-click a node to navigate. Hold to expand connections.
Principle
Implementation
Heuristic
Environment