MCP server for Storybook design systems — extract component HTML, styles and metadata.
The MCP server io.github.freema/mcp-design-system-extractor is designed for Storybook design systems. It extracts component HTML, styles, and metadata, producing output derived from Storybook component documentation for downstream use by tools and developer workflows.
🛠️ Key Features
Extracts component HTML
Extracts component styles
Extracts component metadata
Focused on Storybook design systems
🚀 Use Cases
Capture Storybook component details for analysis or reuse
Generate component documentation artifacts from a Storybook design system
Pull together HTML, styling, and metadata for further processing
⚡ Developer Benefits
Centralizes extraction of HTML + styles + metadata from Storybook
Supports tooling that needs consistent component-level outputs
⚠️ Limitations
Scope is limited to Storybook design systems and extraction of the stated artifacts (HTML, styles, metadata)
A Model Context Protocol (MCP) server that extracts component information from Storybook design systems. Connects to Storybook instances and extracts HTML, styles, and component metadata.
Demo
Installation
Using Claude CLI (Recommended)
bash
claude mcp add design-system npx mcp-design-system-extractor@latest \
--env STORYBOOK_URL=http://localhost:6006
git clone https://github.com/freema/mcp-design-system-extractor.git
cd mcp-design-system-extractor
npm install && npm run build
npm run setup # Interactive setup for Claude Desktop
Key Dependencies
Puppeteer: Uses headless Chrome for dynamic JavaScript component rendering
Chrome/Chromium: Required for Puppeteer (automatically handled in Docker)
Use includeFullCSS: true only when you need full CSS content
Security-protected: only accepts URLs from same domain as Storybook
Job Management Tools
job_status
Check status of an async job
Returns: status, result (when completed), error (when failed)
Poll this after calling get_component_html in async mode
job_cancel
Cancel a queued or running job
Returns whether cancellation was successful
job_list
List all jobs with their status
Filter by status: "all" (default), "active" (queued/running), "completed"
Returns job list + queue statistics
Example Usage
typescript
// List all components (compact mode recommended)awaitlist_components({ compact: true });
// Search for componentsawaitsearch_components({ query: "button", searchIn: "name" });
// Find components by purposeawaitsearch_components({ purpose: "form inputs" });
// Get variants for a componentawaitget_component_html({
componentId: "button",
variantsOnly: true
});
// Returns: { variants: ["primary", "secondary", "disabled"] }// Get HTML (async mode - default)awaitget_component_html({ componentId: "button--primary" });
// Returns: { job_id: "job_xxx", status: "queued" }// Poll for resultawaitjob_status({ job_id: "job_xxx" });
// Returns: { status: "completed", result: { html: "...", classes: [...] } }// Get HTML (sync mode)awaitget_component_html({
componentId: "button--primary",
async: false,
timeout: 30000
});
// Returns: { html: "...", classes: [...] }// Get HTML with stylesawaitget_component_html({
componentId: "button--primary",
async: false,
includeStyles: true
});
// Check all running jobsawaitjob_list({ status: "active" });
// Extract theme infoawaitget_theme_info({ includeAll: false });
// Get design tokens from CSSawaitget_external_css({
cssUrl: "https://my-storybook.com/assets/main.css"
});
AI Assistant Usage Tips
Start with discovery: Use list_components with compact: true
Get variants first: Use get_component_html with variantsOnly: true
Use async for HTML: Default async mode prevents timeouts on large components
Poll job_status: Check job completion before reading results
Search by purpose: Use search_components with purpose parameter
Example Prompts
Once connected, you can use natural language prompts with Claude:
MCP Servers Connected
Component Discovery:
code
Show me all available button components in the design system
Building New Features:
code
I need to create a user profile card. Find relevant components
from the design system and show me their HTML structure.
Design System Analysis:
code
Extract the color palette and typography tokens from the design system.
I want to ensure my new component matches the existing styles.
Component Migration:
code
Get the HTML and styles for the "alert" component. I need to
recreate it in a different framework while keeping the same look.
Multi-Tool Workflow:
code
First list all form-related components, then get the HTML for
the input and select components. I'm building a registration form.
How It Works
Connects to Storybook via /index.json and /iframe.html endpoints. Uses Puppeteer with headless Chrome for dynamic JavaScript rendering. Long-running operations use an in-memory job queue with max 2 concurrent jobs and 1-hour TTL for completed jobs.
Troubleshooting
Ensure Storybook is running and STORYBOOK_URL is correct
Use list_components first to see available components
For large components, use async mode (default) and poll job_status
Check /index.json endpoint directly in browser
SSL certificate errors: Set NODE_TLS_REJECT_UNAUTHORIZED=0 for self-signed certificates
Running Storybook instance (see below for supported versions)
Supported Storybook versions
Storybook 7, 8, 9 and 10. The server reads the story index from
/index.json, falling back to /stories.json, and renders stories through
/iframe.html?id=<storyId> — endpoints that have been stable across all four
major versions.
Storybook 6 and earlier are not supported: they predate /index.json and use
a different story-id scheme.
Both a dev server (npm run storybook) and a built static Storybook served
over HTTP will work.
Development
See DEVELOPMENT.md for detailed development instructions.