The Sugarcoat MCP (Model Context Protocol) server enables AI assistants to interact with the component library in real-time. This provides a richer experience than static documentation, allowing AI assistants to search, browse, and retrieve component information dynamically.
What is MCP?#
The Model Context Protocol↗ is an open standard that enables AI assistants to securely connect to external data sources and tools. Sugarcoat's MCP server exposes the component registry as a set of tools that AI assistants can use.
Installation#
Claude Code#
This creates a .mcp.json file in your project root:
After creating the config, restart Claude Code to activate the server.
Cursor#
This creates .cursor/mcp.json:
Restart Cursor to activate.
VS Code#
This creates .vscode/mcp.json:
Restart VS Code to activate.
Manual Configuration#
You can also manually add Sugarcoat to your MCP configuration. The server is started with:
Or if you have @sugarcoat/cli installed:
Available Tools#
The MCP server provides six tools for AI assistants:
list_components#
List all available Sugarcoat UI components with optional filtering.
Parameters:
category(optional): Filter by category (e.g., "forms", "layout", "feedback")limit(optional): Maximum number of components to return (default: 50)offset(optional): Number of components to skip for pagination
Example prompt: "List all form components in Sugarcoat"
search_components#
Search components by name, description, or tags using fuzzy matching.
Parameters:
query(required): Search query stringlimit(optional): Maximum number of results (default: 10)
Example prompt: "Search for modal-related components"
view_component#
Get detailed information about a specific component including props and source code.
Parameters:
name(required): Component name (e.g., "button", "card", "dialog")
Example prompt: "Show me the Button component details"
get_examples#
Get usage examples for a specific component.
Parameters:
name(required): Component name
Example prompt: "Show me examples of how to use the Card component"
get_add_command#
Get the CLI command to add components to a project.
Parameters:
components(required): Array of component names
Example prompt: "How do I install the button and card components?"
get_design_tokens#
Get design system tokens including colors, spacing, and typography.
Parameters:
type(optional): Token type - "colors", "spacing", "typography", or "all" (default: "all")
Example prompt: "What colors are available in the Sugarcoat design system?"
Usage Examples#
Once configured, you can ask your AI assistant questions like:
Finding Components#
"What components does Sugarcoat have for forms?"
The AI will use list_components with category: "forms" to show available form components.
Getting Component Details#
"Show me how to use the Dialog component"
The AI will use view_component and get_examples to retrieve the Dialog component's props, source code, and usage examples.
Installation Help#
"I need to add a button, card, and dialog to my project"
The AI will use get_add_command to generate:
Design System Reference#
"What's the primary color palette?"
The AI will use get_design_tokens with type: "colors" to show the color scales.
Troubleshooting#
Server Not Starting#
If the MCP server fails to start:
- Ensure you have Node.js 18+ installed
- Check that
@sugarcoat/mcpis accessible via npx - Verify the config file is in the correct location
- Restart your AI assistant
Tools Not Appearing#
If the Sugarcoat tools don't appear in your AI assistant:
- Check that the MCP config file exists and is valid JSON
- Restart the AI assistant completely (not just reload)
- Check the AI assistant's MCP server logs for errors
Network Issues#
The MCP server fetches component data from https://registry.sugarcoat.dev. If you're behind a firewall or proxy, ensure this URL is accessible.
Running Standalone#
You can run the MCP server standalone for testing:
The server communicates over stdio, so you'll need an MCP client to interact with it.