Analyzes external CSS files to extract design tokens, variables, and style information from Storybook assets.
Detects React components when analyzing component dependencies and relationships within Storybook components.
Extracts component information from Storybook design systems, including HTML, styles, component metadata, props documentation, theme information, and relationships between components.
MCP Design System Extractor
A Model Context Protocol (MCP) server that extracts component information from Storybook design systems. This server connects to a running Storybook instance and extracts HTML, styles, and component metadata directly from the Storybook iframe.
Features
- 🔍 List Components: Get all available components from your Storybook
- 📄 Extract HTML: Get the rendered HTML of any component variant with dynamic JavaScript support
- 🔎 Search Components: Find components by name, title, or category
- 🎛️ Component Props: Get component props/API documentation including types and defaults
- 🔗 Component Dependencies: Analyze which components are used within other components
- 📐 Layout Components: Get all layout components (Grid, Container, Stack, etc.) with examples
- 🎨 Theme Information: Extract design system theme (colors, spacing, typography, breakpoints)
- 🎯 Search by Purpose: Find components by their purpose (form inputs, navigation, feedback)
- 🧩 Composition Examples: Get examples of how components are combined together
- 📝 External CSS Analysis: Fetch and analyze CSS files to extract design tokens and variables
Installation
Quick Setup
Use the interactive setup script to configure Claude Desktop:
This will:
- Build the project if needed
- Let you choose your Storybook URL (local or custom)
- Test the connection
- Configure Claude Desktop automatically
Manual Configuration
Alternatively, set the Storybook URL via environment variable:
Default: http://localhost:6006
Usage
With Claude Desktop
Recommended: Use the setup script:
Manual: Add to your Claude Desktop configuration:
With Claude Code
For development with Claude Code, add to your .claude_code_config.json
in the project root:
Or for production build:
Then restart Claude Code to load the MCP server. You can verify it's working by using any of the design system tools in your Claude Code session.
Development
Available Tools
Core Tools
- list_components
- Lists all available components from the Storybook instance
- Returns components with their names, categories, and associated stories
- Use
category: "all"
or omit category parameter to list all components - Filter by specific category path (e.g., "Components/Buttons", "Layout")
- Supports pagination with
page
andpageSize
parameters (default: 50 per page)
- get_component_html
- Extracts HTML from a specific component story in Storybook
- Requires story ID format: "component-name--story-name" (e.g., "button--primary")
- Use list_components or get_component_variants first to find valid story IDs
- Optional CSS style extraction for understanding component styling
- Supports dynamic JavaScript-rendered content
- get_component_variants
- Gets all story variants/states for a specific component
- Returns all stories (variants) for a component with their IDs, names, and parameters
- Component name must match exactly as shown in list_components (case-sensitive)
- search_components
- Search components by name, title, or category using case-insensitive partial matching
- Name is component name only (e.g., "Button")
- Title is full story path (e.g., "Components/Forms/Button")
- Category is the grouping (e.g., "Components/Forms")
- Use
query: "*"
to list all components - Search in specific fields: "name", "title", "category", or "all" (default)
- Supports pagination with
page
andpageSize
parameters (default: 50 per page)
Component Analysis Tools
- get_component_props
- Extracts component props/API documentation from Storybook's argTypes configuration
- Includes prop names, types, default values, required status, and control options
- Requires story ID format: "component-name--story-name"
- get_component_dependencies
- Analyzes rendered HTML to find which other components a given component internally uses
- Detects React components, web components, and CSS class patterns
- Helps understand component relationships and composition
- Requires story ID format: "component-name--story-name"
Design System Tools
- get_layout_components
- Gets all layout components (Grid, Container, Stack, Box) with usage examples
- Optional HTML examples for each layout component
- Useful for understanding page structure and composition patterns
- get_theme_info
- Gets design system theme information (colors, spacing, typography, breakpoints)
- Extracts CSS custom properties/variables from the design system
- Categorizes tokens by type for better organization
- Optional parameter to include all CSS custom properties found
Discovery Tools
- get_component_by_purpose
- Search for components by their purpose or function
- Available purposes: "form inputs" (input fields, selects, checkboxes), "navigation" (menus, breadcrumbs, tabs), "feedback" (alerts, toasts, modals), "data display" (tables, cards, lists), "layout" (grids, containers, dividers), "buttons" (all button types), "progress" (loaders, spinners), "media" (images, videos, carousels)
- Flexible pattern matching for finding components by use case
- Supports pagination with
page
andpageSize
parameters (default: 50 per page)
- get_component_composition_examples
- Gets examples of how components are combined together in real-world patterns and layouts
- Returns HTML examples showing the component used with other components in forms, cards, layouts, or complex UI patterns
- Helps understand how components work together in practice
- Optional limit parameter to control number of examples returned
- get_external_css ⚠️ TOKEN-OPTIMIZED
- DEFAULT: Returns ONLY design tokens + file stats (avoids token limits)
- Does NOT return CSS content by default (prevents 25K token limit errors)
- Extracts & categorizes tokens: colors, spacing, typography, shadows, breakpoints
- Use
includeFullCSS: true
only when you specifically need CSS content - Security-protected: only accepts URLs from the same domain as your Storybook
- Perfect for design token extraction without hitting response size limits
Example Usage
AI Assistant Usage Tips
When using with Claude or other AI assistants:
- Start with discovery: Use
list_components
withcategory: "all"
orsearch_components
withquery: "*"
to see all available components - Get story IDs: Use
get_component_variants
to find exact story IDs needed for other tools - Use exact IDs: Story IDs must be in format "component-name--story-name" (e.g., "button--primary")
- Explore by purpose: Use
get_component_by_purpose
to find components by their function - Debug issues: Tools now include debug information when no results are found
How It Works
The server connects to Storybook using these endpoints:
/index.json
or/stories.json
- Component metadata/iframe.html?id=component--story
- Rendered components
Key features:
- Dynamic Content Support: Uses happy-dom to execute JavaScript and render dynamic content
- Smart Caching: Caches responses for 5 minutes to improve performance
- Retry Logic: Automatically retries failed requests up to 3 times
- Timeout Protection: 10-second timeout on all network requests
- Better Error Messages: Provides helpful suggestions when connections fail
It extracts:
- Component HTML structure (including dynamically rendered content)
- CSS classes and inline styles
- Component props and API documentation
- Component dependencies and relationships
- Design system tokens and theme information
- External CSS files and design tokens from Storybook assets
Troubleshooting
Common Issues
Empty results from list_components or search_components:
- Ensure your Storybook is running and accessible at the configured URL
- Check that
STORYBOOK_URL
environment variable is set correctly - Try accessing
/index.json
or/stories.json
directly in your browser - Verify your Storybook has stories configured and published
- Check the debug information returned in the tool response
"Found 0 components" with category filtering:
- Use
category: "all"
or omit the category parameter to see all components first - Check available categories from the initial
list_components
call - Category names are case-sensitive and must match exactly
Wildcard search not working:
- Use
query: "*"
(with quotes) to list all components in search_components - Ensure the query parameter is provided as a string
Component HTML extraction fails:
- Ensure you're using the exact story ID format: "component-name--story-name"
- Use
get_component_variants
first to find valid story IDs - Check that the story exists and is published in Storybook
Connection issues:
- Verify Storybook is running (typically on port 6006)
- Check CORS configuration in your Storybook
- Ensure network connectivity to the Storybook URL
- Try a different URL format (with/without trailing slash)
Requirements
- Node.js 18+
- Running Storybook instance
- Network access to Storybook URL
Development
License
MIT
hybrid server
The server is able to function both locally and remotely, depending on the configuration or use case.
Tools
Server that enables AI assistants to interact with Storybook design systems. Extract component HTML, analyze styles, and help with design system adoption and refactoring.
- Features
- Installation
- Quick Setup
- Manual Configuration
- Usage
- Available Tools
- Example Usage
- How It Works
- Troubleshooting
- Requirements
- Development
- License
Related Resources
Related MCP Servers
- -securityAlicense-qualityA server that allows AI assistants to access, view, run, and manage Hex projects through a standardized interface.Last updated -PythonAGPL 3.0
- -securityAlicense-qualityA server that enables AI assistants to understand and interact with Unity projects in real-time, providing access to scene hierarchy, project settings, and the ability to execute code directly in the Unity Editor.Last updated -40MIT License
- AsecurityAlicenseAqualityA TypeScript server that enhances AI assistants' capabilities when working with Starwind UI components, providing tools for project initialization, component installation, documentation access, and more.Last updated -619TypeScriptMIT License
- AsecurityAlicenseAqualityA Model Context Protocol server that integrates with Storybook to help AI tools query UI components and retrieve usage examples from static Storybook files.Last updated -2JavaScriptMIT License