list_shadcn_components
Retrieve a comprehensive list of all available shadcn/ui components to explore and reference for UI development projects.
Instructions
Get a list of all available shadcn/ui components
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
No arguments | |||
Implementation Reference
- src/index.ts:189-236 (handler)The handler function for 'list_shadcn_components' tool. Scrapes shadcn/ui docs/components page to extract list of components using cheerio, caches the result, and returns as JSON text content.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:108-116 (registration)Registration of the 'list_shadcn_components' tool in the ListToolsRequestSchema handler, including name, description, and empty input schema.{ name: 'list_shadcn_components', description: 'Get a list of all available shadcn/ui components', inputSchema: { type: 'object', properties: {}, required: [], }, },
- src/index.ts:111-115 (schema)Input schema for the 'list_shadcn_components' tool: empty object with no properties or requirements.inputSchema: { type: 'object', properties: {}, required: [], },
- src/index.ts:167-169 (handler)Dispatch case in CallToolRequestSchema handler that routes to the list_shadcn_components implementation.case 'list_shadcn_components': return await this.handleListComponents(); case 'get_component_details':