Principle:21st dev Magic mcp Catalog Search
| Knowledge Sources | |
|---|---|
| Domains | Search, UI_Components |
| Last Updated | 2026-10-19 16:40 GMT |
Overview
A retrieval pattern that queries a curated component marketplace with a short natural-language phrase to surface production-ready UI candidates.
Description
Catalog search is the act of querying a managed marketplace of pre-built, production-ready components by intent rather than by exact identifier. It addresses the limitation of writing UI from scratch — which is slow, error-prone, and misses responsive/dark-mode/dependency hardening that shipped components already carry. A good catalog search takes a short natural-language phrase ("pricing table", "animated hero"), ranks results by relevance, and returns enough metadata (name, description, preview, install id) for an agent or human to pick a match. It is the default starting point for adding UI: prefer real, hardened components over hand-rolled code.
Usage
Use this principle when the user wants to add a UI element and you want to prefer existing, maintained components over writing one from scratch. It is the first step of any component-install workflow and is available even on free tiers (search is unrestricted; install may be rate-limited).
Theoretical Basis
The core operation is a ranked retrieval over a component index:
# Abstract algorithm description (NOT real implementation)
results = rank(catalog, query) # rank by relevance to the natural-language query
return top_n(results, n) # return name, description, preview, installId
The query is natural language, not a structured filter; the ranking is the marketplace's responsibility. The caller then applies its own constraints (stack, style) to select among the top results.
Practical Guide
- Query with a short, intent-focused phrase (e.g. "pricing table", "animated hero", "dashboard KPI cards").
- Review name, description, and preview for each result before picking.
- If the choice is not obvious, show the user the top 1–3 candidates.
- Carry the chosen `installId` forward to the retrieval step (`get_component`).
Related Pages
Implemented By
Notes
- Companion principle: Principle:21st_dev_Magic_mcp_Component_Installation consumes the search result.