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

Implementation:21st dev Magic mcp get component

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

Overview

Concrete tool for retrieving full code and metadata for a 21st.dev catalog component, provided by the 21st MCP server (reached through the proxy).

Description

The get_component tool fetches the full source, file list, and install instructions for a single catalog component identified by its `installId` (obtained from Implementation:21st_dev_Magic_mcp_search). It is hosted server-side at `https://21st.dev/api/mcp`; this repo only forwarded calls to it opaquely over the proxy. The result tells the agent how to install — shadcn-style `registry add` CLI command, or returned files to write directly.

This is an External Tool Doc: the signature below is reconstructed from `skills/21st-ui/SKILL.md` and `README.md`, not from in-repo source, because the tool implementation lives on the server.

Usage

Call `get_component` after `search` has produced a candidate and the user (or agent) has picked one. Free-tier accounts can install up to 2 components per day; paid components return their code only after unlock.

Code Reference

Source Location

Signature

// JSON-RPC tool call, proxied to https://21st.dev/api/mcp
get_component(installId: string): {
  code: string;        // component source
  metadata: object;    // component metadata
  files: Array<{       // file list for direct writes (when not registry add)
    path: string;
    content: string;
  }>;
  installInstructions: string;  // shadcn registry add command or write-files guidance
};

Import

// Not imported. Call as an MCP tool through the 21st MCP server:
//   { "jsonrpc": "2.0", "id": <n>, "method": "tools/call",
//     "params": { "name": "get_component",
//                 "arguments": { "installId": "..." } } }

I/O Contract

Inputs

Name Type Required Description
installId string Yes Install id from a prior `search` result

Outputs

Name Type Description
code string Full component source
metadata object Component metadata (name, tier, dependencies, ...)
files Array Files to write directly when not using registry add
installInstructions string How to install: shadcn registry add command or write-files guidance

Usage Examples

Fetch a component by install id

{
  "jsonrpc": "2.0",
  "id": 2,
  "method": "tools/call",
  "params": {
    "name": "get_component",
    "arguments": { "installId": "pricing-table-001" }
  }
}

Related Pages

Implements Principle

Requires Environment

Uses Heuristic

Notes

Page Connections

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