Exposes UI component registries following the shadcn/ui format, allowing AI assistants to browse components, retrieve implementation code, and access documentation for UI libraries.
Click on "Install Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@MCP Server Starter Templatelist all available button components and their implementation details"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
MCP Server Starter Template
A comprehensive starter template for building Model Context Protocol (MCP) servers, specifically designed for UI libraries and component registries. This template provides a robust foundation for creating MCP servers that can fetch, categorize, and provide component information to AI assistants like Claude.
π Real world example?
Check out the stackzero-labs/mcp which uses this template to expose its UI components and blocks to AI models. You can also checkout the UI referenced project stackzero/ui
π Features
Ready-to-use MCP server with TypeScript support
Component registry integration for UI libraries
Categorized component organization with flexible category system
Zod schema validation for type safety
Development tools including hot reload and inspector
Example implementation using a real project URL for demonstration
Extensible architecture for custom component types and categories
π Prerequisites
Node.js 18 or higher
pnpm (recommended) or npm
Basic understanding of TypeScript and MCP
π€ Intended Use Cases
This template is specifically designed for libraries following the registry format (like shadcn/ui), making it ideal for:
UI component libraries
Design systems
Component registries that need to be accessible via AI assistants
Tools, utilities, and frameworks that require a structured way to expose UI components to AI models
Read more about components registries like shadcn/ui here Component Registries.
With some customizations however, it can be adapted for other types of MCP servers as well.
π οΈ Installation
Clone or download this template:
Install dependencies:
Build the project:
βοΈ Configuration
1. Update Project Configuration
Edit src/lib/config.ts to point to your own component registry:
Note: This template currently uses https://ui.stackzero.co as a demonstration URL. You must replace this with your actual project URL for production use.
2. Define Component Categories
Customize src/lib/categories.ts to match your component structure:
3. Update Server Metadata
Modify src/server.ts to customize your server information:
πββοΈ Development
Start Development Server
Build for Production
Inspect MCP Server
This opens the MCP Inspector to test your server tools interactively.
π Available Tools
The MCP server provides the following tools:
getUIComponents
Returns a comprehensive list of all UI components from your registry.
Category-specific Tools
Dynamic tools are created for each category defined in componentCategories:
getButtons- Get all button componentsgetForms- Get all form componentsetc.
Each category tool provides:
Component implementation details
Usage examples
Installation instructions
Related components
ποΈ Project Structure
π§ Customization
Adding New Component Types
Update schemas in
src/utils/schemas.ts:
Add API functions in
src/utils/api.ts:
Register new tools in
src/server.ts:
Extending Categories
Simply add new categories to src/lib/categories.ts:
The server will automatically create tools for new categories.
Why categories?
Categories help organize components logically, making it easier for AI assistants to find and suggest relevant components based. Also, some models and IDE have a limit on the number of tools they can handle, so categorizing helps to keep the number of tools manageable.
π Registry Format
Your component registry should follow this structure:
Registry File (registry.json)
Component Details (/r/{component-name}.json)
π Deployment
As a Local MCP Server
Build the project:
Configure in your MCP client (e.g., Claude Desktop):
As an NPM Package
You can also publish this template as an NPM package for easy installation in other projects.
Update
package.jsonwith your detailsBuild and publish:
π€ Contributing
See CONTRIBUTING.md for details on how to contribute to this project.
π License
This project is licensed under the MIT License - see the LICENSE file for details.
π€ Contact
Marcello - @mnove
π Acknowledgments
Built with Model Context Protocol SDK
Inspired by the need for better AI-component integration
Thanks to the MCP community for their contributions
β οΈ Important: Remember to replace https://ui.stackzero.co with your actual project URL before using this template in production!