Capítulo 103 de 108

MCP Server (Registry)

Core Idea

Registry-operator side of MCP support: the shadcn MCP server works with any shadcn-compatible registry automatically, as long as a valid registry.json (or registry) file exists at the registry root.

Key Concepts

  • Root registry index requirement: For a registry at https://acme.com/r/[name].json, the MCP server expects https://acme.com/r/registry.json (or registry with no extension) — a valid JSON file conforming to the registry schema.
  • No special MCP-only config: Consumers just add the registry under components.json#registries and run shadcn mcp init --client <name>; the same schema and CLI mechanics as normal add/view/search apply.

Code Examples

{
  "registries": { "@acme": "https://acme.com/r/{name}.json" }
}
  • O que demonstra: pré-requisito do consumidor pra habilitar prompts do MCP contra um registry customizado.

Reference Tables

ClientSetup
Claude Codeconfigure registries, run mcp init --client claude, restart, debug via /mcp
Cursorconfigure registries, run mcp init --client cursor, enable in Settings
VS Codeconfigure registries, run mcp init --client vscode, click Start
Codexconfigure registries, manually edit ~/.codex/config.toml
OpenCodeconfigure registries, run mcp init --client opencode, restart

Best Practices

  • Clear descriptions: concise title/description help AI assistants pick the right item.
  • Accurate dependencies: lets MCP auto-install npm packages correctly.
  • Explicit registryDependencies: signals relationships between items so MCP composes correctly (e.g. building a landing page from hero + features + testimonials).
  • Consistent kebab-case naming: across the whole registry.

Key Takeaways

  1. There is no MCP-specific schema — any registry valid per /docs/registry/registry-json automatically works with MCP.
  2. The single hard requirement is having the registry index reachable at the registry root (registry.json/registry).
  3. Prompt quality for AI assistants (browsing, composing multi-item builds) depends directly on how well title/description/dependencies/registryDependencies are filled in.

Connects To

  • mcp (ch097): consumer-facing setup instructions this page complements.
  • registry-json (ch107): the schema the root index file must satisfy.