Workflows
All 10 MCP tools, resource URIs, design guidelines, and example agent workflows for building UI with AI.
MCP Workflows
Once the UI Lab MCP server is connected, AI agents have access to 10 tools and 4 resource URI types. This page documents each tool, how they chain together in real workflows, and the design system rules that are automatically enforced in every response.
Tools overview
| Tool | Purpose |
|---|---|
search_components | Find components by natural language query |
get_component | Get full component metadata: API, examples, design guidance |
get_semantic_color | Get ONE authoritative color recommendation for a component + intent |
get_theme_setup | Get complete light/dark theme setup with provider code |
search_patterns | Find design patterns by use case |
get_pattern | Get a pattern's full TSX code and design rationale |
search_elements | Find pre-built multi-component UI blocks |
get_element | Get an element's variations and file structure |
search_sections | Find landing page sections |
get_section | Get a section's variations |
Components
search_components
Searches all UI Lab components using natural language. Returns up to 10 results ranked by relevance.
Input:
Returns: Array of component summaries with id, name, description, tags.
Example queries:
"button primary action"→ Button"dropdown select option"→ Select"text input form field"→ Input"modal dialog overlay"→ Modal"data table rows columns"→ Table"toast notification message"→ Toast
get_component
Fetches complete component metadata by ID. Use after search_components to get the full API.
Input:
detail options:
"api"— props + subComponents only. Use when writing code — smallest response, no examples."examples"— description + usage examples only. Use when learning patterns."full"— everything: API, examples, design guidelines (default).
Returns: Component metadata including:
api.props— all props with types, defaults, descriptionsapi.subComponents— compound component slots (e.g.Card.Header,Card.Footer)api.examples— working TSX code examplesdesignGuidelines— mandatory color token rules (only infullmode)
Typical workflow:
Design tokens
get_semantic_color
Returns ONE authoritative color recommendation for a component and intent combination. Does not offer options — it returns the correct choice.
Input:
semantic_intent values: primary, secondary, danger, success, warning, info
Returns:
Call this before generating component code to get the right Tailwind token classes to use.
Theme
get_theme_setup
Returns complete setup instructions and code for integrating the UI Lab theme system with light/dark mode.
Input:
Returns:
setup.provider—ThemeProviderwrapper code for your root layoutsetup.hooks—useTheme,useThemeMode, etc. with signaturessetup.toggleComponent— ready-to-useThemeTogglecomponent codesetup.fouc_prevention— explanation of automatic FOUC prevention (no setup needed)setup.colorBehavior— how shades invert automatically in dark modesetup.integrationSteps— step-by-step instructions
FOUC prevention is automatic. ThemeProvider injects a blocking script into document.head on mount that reads localStorage and applies CSS variables before the page renders. No manual script tag needed.
How dark mode color inversion works:
Shades invert automatically — no dark: prefix needed in Tailwind classes:
| Shade | Dark mode equivalent |
|---|---|
background-500 | ↔ background-500 (stays constant) |
background-600 | ↔ background-900 |
background-700 | ↔ background-800 |
background-900 | ↔ background-600 |
background-950 | ↔ background-500 |
Patterns
Patterns are opinionated, ready-to-use TSX implementations of common UI problems. They use the correct design tokens and component APIs.
search_patterns
Input:
Example queries:
"auth login form"→ auth-form"destructive confirm dialog"→ destructive-confirm"empty state placeholder"→ empty-state"settings form layout"→ settings-form-layout"status list item"→ status-list-item"pricing cards"→ pricing-cards"feature grid"→ feature-grid
Returns: Array of pattern summaries with id, name, description, category, complexity, tags.
get_pattern
Fetches the full pattern including complete TSX code and design notes.
Input:
Returns:
pattern.code— complete working TSX implementationpattern.designNotes— why each token and component choice was madedesignGuidelines— mandatory color rules
Patterns are meant to be copied as-is and adapted. They demonstrate the correct way to combine UI Lab components for common scenarios.
Elements
Elements are pre-built, multi-component UI blocks that solve complete UI problems — chat interfaces, sidebars, tables of contents, AI input areas, etc.
search_elements
Input:
Available elements:
| Category | Elements |
|---|---|
| AI | Chat, AIChatInput, ChainOfThought |
| Documentation | TOC, NextArticle, CopyPage |
| Foundation | Page, Sidebar, Header, Carousel, Timeline, Rating, TreeView |
Example queries:
"chat interface"→ Chat"AI input prompt"→ AIChatInput"sidebar navigation"→ Sidebar"table of contents"→ TOC"reasoning steps"→ ChainOfThought
get_element
Input:
Returns:
element.variations— all available variations with names and descriptionselement.files— file structure for each variationelement.packageId— which UI Lab package the element belongs to
Elements have multiple variations (e.g. Chat has "basic" and "with actions"). Each variation is a self-contained set of files you can copy into your project.
Sections
Sections are full-width landing page blocks ready to drop into marketing pages.
search_sections
Input:
Available sections: Hero, Features, CTA, Pricing, Testimonials
Each has multiple variations:
hero→ simple, with-image, with-videofeatures→ grid, listpricing→ cards, comparisoncta→ centered, splittestimonials→ cards, featured
get_section
Input:
Returns: All variations with complete TSX code for each.
Resources
In addition to tools, the server exposes all content as MCP resources. Agents can enumerate and read resources directly by URI — useful for agents that prefer resource-based access over tool calls.
Resource URI schemes:
| Scheme | Example | Content |
|---|---|---|
component:// | component://button | Full component metadata |
pattern:// | pattern://auth-form | Pattern with TSX code |
element:// | element://chat | Element variations and files |
section:// | section://hero | Section variations |
ListResources returns every component, pattern, element, and section indexed together. ReadResource reads a specific URI.
Design guidelines (always injected)
Every get_component, get_pattern, get_semantic_color, and get_theme_setup response includes a designGuidelines field with the complete set of mandatory color token rules. These are injected automatically so agents always have the constraints in context when generating code.
Color families
These are the only color families allowed. No Tailwind built-in colors, no hex codes.
| Family | Use for |
|---|---|
accent | Primary actions, CTAs, brand elements |
success | Success states, confirmations, approved |
danger | Errors, destructive actions, delete |
warning | Warnings, cautions, pending states |
info | Information, help, neutral messages |
background | Page and card backgrounds (grayscale) |
foreground | Text, borders, labels (grayscale) |
Shade ranges
Shades are strictly bounded per family:
| Family | Min shade | Max shade | Notes |
|---|---|---|---|
background (bg) | 500 | 950 | 500 = lightest, 950 = darkest |
foreground (text/border) | 50 | 400 | 50 = lightest, 400 = darkest |
accent | 50 | 600 | |
success, danger, warning, info | 50 | 600 |
Class format
Common mistakes and corrections
| Wrong | Correct |
|---|---|
bg-white | bg-background-500 |
text-gray-900 | text-foreground-300 |
bg-zinc-100 | bg-background-600 |
shadow-md | (remove — no shadows) |
from-blue-500 to-purple-600 | (remove — no gradients) |
border-red-500 | border-danger-500 |
bg-background-50 | bg-background-500 (min is 500) |
text-foreground-500 | text-foreground-400 (max is 400) |
bg-accent-700 | bg-accent-600 (max is 600) |
Correct examples
Typical agent workflows
Workflow 1: Build a component from scratch
Workflow 2: Find and use a pattern
Workflow 3: Set up theming
Workflow 4: Build a landing page
Workflow 5: Find a pre-built UI block
Next steps
- MCP Installation — connect the server to Claude Desktop or Cursor
- Design System: Colors — the OKLCH color system behind the tokens
- Design System: Tokens — full token reference
- Components — browse the full component library