Skip to main content
Glama
ymadd
by ymadd

list_shadcn_components

Retrieve a comprehensive list of all available shadcn/ui components, providing quick access to component details and usage examples for streamlined development.

Instructions

Get a list of all available shadcn/ui components

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault

No arguments

Implementation Reference

  • The core handler function implementing the 'list_shadcn_components' tool logic. Scrapes https://ui.shadcn.com/docs/components using axios and cheerio to extract component names and URLs, caches the list, and returns it as JSON text.
    private async handleListComponents() { try { if (!this.componentsListCache) { // Fetch the list of components const response = await this.axiosInstance.get(`${this.SHADCN_DOCS_URL}/docs/components`); const $ = cheerio.load(response.data); const components: ComponentInfo[] = []; // Extract component links $("a").each((_, element) => { const link = $(element); const url = link.attr("href"); if (url && url.startsWith("/docs/components/")) { const name = url.split("/").pop() || ""; components.push({ name, description: "", // Will be populated when fetching details url: `${this.SHADCN_DOCS_URL}${url}`, }); } }); this.componentsListCache = components; } return { content: [ { type: "text", text: JSON.stringify(this.componentsListCache, null, 2), }, ], }; } catch (error) { if (axios.isAxiosError(error)) { throw new McpError( ErrorCode.InternalError, `Failed to fetch shadcn/ui components: ${error.message}` ); } throw error; } }
  • src/index.ts:105-113 (registration)
    Registers the tool in the ListToolsRequestSchema response with name, description, and input schema (no input parameters required).
    { name: "list_shadcn_components", description: "Get a list of all available shadcn/ui components", inputSchema: { type: "object", properties: {}, required: [], }, },
  • Input schema definition for the tool: an empty object with no properties or required fields.
    inputSchema: { type: "object", properties: {}, required: [], },
  • src/index.ts:161-162 (registration)
    Dispatches tool calls matching 'list_shadcn_components' to the handler function in the CallToolRequestSchema handler.
    case "list_shadcn_components": return await this.handleListComponents();

Other Tools

Related Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/ymadd/shadcn-ui-mcp-server'

If you have feedback or need assistance with the MCP directory API, please join our Discord server