
Storybook Mcp Integration
- 88 installs
- 213 repo stars
- Updated August 4, 2026
- yonatangross/orchestkit
Helps with ai & agent building tasks.
About
storybook-mcp-integration is a Claude Code skill for ai & agent building. It helps solo builders move faster with AI-assisted coding.
- storybook-mcp-integration
- AI & Agent Building
- AI-coding skill
Storybook Mcp Integration by the numbers
- 88 all-time installs (skills.sh)
- +1 installs in the week ending Jul 28, 2026 (Skillselion tracking)
- Ranked #4,935 of 16,546 AI & Agent Building skills by installs in the Skillselion catalog
- Data as of Aug 5, 2026 (Skillselion catalog sync)
npx skills add https://github.com/yonatangross/orchestkit --skill storybook-mcp-integrationAdd your badge
Show developers this skill is listed on Skillselion. Paste this into your README.
| Installs | 88 |
|---|---|
| repo stars | ★ 213 |
| Last updated | August 4, 2026 |
| Repository | yonatangross/orchestkit ↗ |
What it does
Helps with ai & agent building tasks.
Files
Storybook MCP Integration
Use the Storybook MCP server (@storybook/addon-mcp) to give agents awareness of a project's actual component library — props, stories, tests, and live previews.
When to Use
- Component generation — check existing Storybook components before creating new ones
- Component testing — run story tests + a11y audits via MCP instead of CLI
- Visual verification — embed story previews in chat for user confirmation
- Component auditing — inventory components with full metadata via MCP
Quick Reference — 6 Tools, 3 Toolsets
| Toolset | Tool | Purpose | Key Inputs |
|---|---|---|---|
| dev | get-storybook-story-instructions | Guidance on writing stories + interaction tests | none |
| dev | preview-stories | Returns preview URLs for stories (embeddable) | stories[]: {storyId} or {absoluteStoryPath, exportName} |
| docs | list-all-documentation | Full component + docs manifest index | none |
| docs | get-documentation | Props, first 3 stories, story index, docs | id (required), storybookId (optional) |
| docs | get-documentation-for-story | Full story source + component docs | componentId, storyName (required) |
| testing | run-story-tests | Run component + a11y tests, pass/fail + violations | stories[] (optional), a11y boolean (default true) |
Prerequisites
# Storybook 10.3+ with Vite builder (no webpack)
npx storybook@latest upgrade
# Install the addon (current: @storybook/addon-mcp@0.6.0, Apr 2026)
npx storybook add @storybook/addon-mcp
# Enable docs toolset (required for component discovery)
# In .storybook/main.ts:
# componentsManifest: true
# NOTE: the old `experimentalComponentsManifest` flag was renamed in
# Storybook 10.3; it is now `componentsManifest` and default-on. Any
# code still passing the `experimental` prefix will warn-then-ignore.
# For Chromatic remote setups, use the standalone package instead of
# the addon (same tool surface, no local Storybook required):
# npm i -D @storybook/mcp
# npx storybook-mcp --registry https://chromatic.storybook.cloud
# Enable testing toolset (requires addon-vitest)
# npx storybook add @storybook/addon-vitest
# Register with Claude Code
npx mcp-add --type http --url "http://localhost:6006/mcp" --scope projectDetection Pattern
Before using Storybook MCP tools, check availability:
# Probe for storybook-mcp tools
ToolSearch(query="+storybook list-all-documentation")
# If tools found → Storybook MCP is available
# If not found → fallback to filesystem-based component discoveryRule Details
Load rules on demand with Read("${CLAUDE_SKILL_DIR}/rules/<file>"):
| Rule | Impact | Description |
|---|---|---|
component-discovery | HIGH | Use list-all-documentation + get-documentation before generating new components |
story-preview-verification | HIGH | Embed preview-stories URLs for visual confirmation |
mcp-test-runner | CRITICAL | Run run-story-tests with a11y:true after component generation |
Toolset Selection
Filter toolsets via X-MCP-Toolsets header to reduce agent context:
| Agent Role | Toolsets | Rationale |
|---|---|---|
| component-curator | docs | Inventory + props only, no testing |
| frontend-ui-developer | dev,docs,testing | Full access for gen → verify loop |
| design-system-architect | docs | Component metadata for governance |
Chromatic Remote Publishing
For teams using Chromatic, the docs toolset is publishable remotely:
- Published at
https://<chromatic-storybook-url>/mcp - Only docs toolset available remotely (dev + testing need local Storybook)
- Useful for cross-team design system discovery without running Storybook locally
Graceful Degradation
| Storybook MCP | Fallback | Behavior |
|---|---|---|
| Available | — | Use MCP tools for component discovery, testing, previews |
| Unavailable | Filesystem | Glob("**/components/**/*.tsx") + Grep for component inventory |
| Unavailable | 21st.dev | Search public registry via 21st-dev-magic MCP |
| Unavailable | Manual | Claude multimodal analysis of screenshots |
Related Skills
storybook-testing— CSF3 patterns, Vitest integration, Chromatic TurboSnapcomponent-search— 21st.dev registry search (external components)design-to-code— Full mockup-to-component pipeline (uses this skill in Stage 2)ui-components— shadcn/ui + Radix component patterns
Rule Categories
Component Discovery (HIGH)
- component-discovery — Check existing Storybook components before generating new ones
Visual Verification (HIGH)
- story-preview-verification — Embed story previews for visual confirmation
Testing (CRITICAL)
- mcp-test-runner — Run story tests + a11y audits via MCP after generation
Component Discovery via Storybook MCP
Before generating a new component, check the project's Storybook for existing components that match.
Pattern: Storybook-First Matching
# Step 1: Get full component inventory
inventory = list-all-documentation()
# Returns: component IDs, doc IDs, story counts
# Step 2: Search for matching component
for component in inventory.components:
if component.name matches target_description:
details = get-documentation(id=component.id)
# Returns: props schema, first 3 stories, story index, additional docs
# Step 3: Decision
if match_found:
# Reuse existing component — adapt props, skip generation
return existing_component
else:
# No local match — fall back to 21st.dev or generate from scratch
search_21st_dev(description)Incorrect
// BAD: Generating a new Button component without checking Storybook
// The project may already have a fully-tested Button with variants
const Button = ({ label, onClick }) => (
<button onClick={onClick}>{label}</button>
);Correct
# GOOD: Check Storybook first
inventory = list-all-documentation()
# Found: Button component with 12 stories, 8 variants
details = get-documentation(id="button")
# Props: variant (primary|secondary|ghost), size (sm|md|lg), disabled, loading
# → Reuse existing Button, no generation neededWhen to Skip
- Project has no Storybook MCP configured
- Building a component explicitly marked as "new" by the user
- The existing component is fundamentally incompatible with requirements
MCP Test Runner
Use run-story-tests to verify components pass both functional and accessibility tests after generation.
Pattern: Generate → Test → Self-Heal
# Step 1: Generate component + story
Write("src/components/Modal/Modal.tsx", component_code)
Write("src/components/Modal/Modal.stories.tsx", story_code)
# Step 2: Run tests via MCP (with a11y enabled)
results = run-story-tests(
stories=[{ "storyId": "modal--default" }, { "storyId": "modal--open" }],
a11y=True # default: true
)
# Step 3: Handle results
if results.all_passed:
# Success — component is verified
preview-stories(stories=[...]) # Show user the result
else:
# Self-heal: read violations, fix, retry
for failure in results.failures:
if failure.type == "a11y":
# Fix accessibility violation (e.g., missing aria-label)
fix_a11y_violation(failure.violation)
elif failure.type == "interaction":
# Fix interaction test failure
fix_interaction(failure.error)
# Retry (max 3 attempts)
results = run-story-tests(stories=[...], a11y=True)Incorrect
# BAD: Generate component without any verification
Write("src/components/Modal/Modal.tsx", component_code)
# "Done! I've created the Modal component."
# (No tests run, no a11y check, no visual preview)Correct
# GOOD: Full verification loop
Write("src/components/Modal/Modal.tsx", component_code)
Write("src/components/Modal/Modal.stories.tsx", story_code)
results = run-story-tests(a11y=True) # Omit stories[] to run ALL tests
# Results: 12 passed, 1 failed (a11y: missing aria-label on close button)
# Fix the violation
Edit("src/components/Modal/Modal.tsx",
old_string='<button onClick={onClose}>',
new_string='<button onClick={onClose} aria-label="Close modal">')
# Re-run the failing test
results = run-story-tests(
stories=[{ "storyId": "modal--open" }],
a11y=True
)
# Results: 1 passed
# Show preview
preview-stories(stories=[{ "storyId": "modal--default" }])
# "Modal component verified: all tests pass, a11y clean. Preview: [URL]"Run All vs Specific Stories
# Run ALL tests (useful for full verification):
run-story-tests(a11y=True)
# Run specific stories (useful for targeted re-test after fix):
run-story-tests(
stories=[{ "storyId": "modal--open" }],
a11y=True
)Self-Healing Limits
- Max 3 retry attempts per component
- If still failing after 3 attempts, report failures to user with details
- Never suppress test failures — always surface them
Story Preview Verification
After generating or modifying a component, use preview-stories to embed a live preview in the chat for visual confirmation.
Pattern: Generate → Preview → Confirm
# Step 1: Write the story file (CSF3 format)
Write("src/components/Card/Card.stories.tsx", story_content)
# Step 2: Get preview URLs from Storybook MCP
previews = preview-stories(stories=[
{ "storyId": "card--default" },
{ "storyId": "card--with-image" },
{ "storyId": "card--loading" }
])
# Returns: preview URLs for each story
# Step 3: Include preview URLs in response
# Agent MUST include the URLs in its response for the user to see themIncorrect
# BAD: Generate component and tell user "it should work"
Write("src/components/Card/Card.tsx", component_code)
# "I've created the Card component. It should render correctly."Correct
# GOOD: Generate component, write story, show preview
Write("src/components/Card/Card.tsx", component_code)
Write("src/components/Card/Card.stories.tsx", story_code)
previews = preview-stories(stories=[
{ "absoluteStoryPath": "src/components/Card/Card.stories.tsx", "exportName": "Default" }
])
# "Here's the Card component. Preview: [embedded story URL]
# Does this match what you expected?"Alternative: Story ID vs File Path
Two ways to reference stories:
# By story ID (if you know it):
preview-stories(stories=[{ "storyId": "card--default" }])
# By file path + export (if just created):
preview-stories(stories=[{
"absoluteStoryPath": "src/components/Card/Card.stories.tsx",
"exportName": "Default"
}])When to Preview
- After generating a new component with stories
- After modifying an existing component's visual appearance
- When the user asks "what does it look like?"
- Before marking a design-to-code task as complete
{
"skill": "storybook-mcp-integration",
"version": "1.0.0",
"testCases": [
{
"id": "sbmcp-trigger-component-generation",
"description": "Triggers when generating a React component in a project with Storybook",
"input": "Generate a Card component for our design system",
"expected_behavior": "Should check Storybook MCP for existing Card components before generating",
"tags": ["trigger", "component-discovery"]
},
{
"id": "sbmcp-trigger-component-audit",
"description": "Triggers when auditing component library",
"input": "Audit our component library for unused or outdated components",
"expected_behavior": "Should use list-all-documentation to get full component inventory",
"tags": ["trigger", "component-discovery"]
},
{
"id": "sbmcp-trigger-test-verification",
"description": "Triggers when verifying component after generation",
"input": "Verify the Modal component passes all tests",
"expected_behavior": "Should use run-story-tests with a11y:true",
"tags": ["trigger", "testing"]
},
{
"id": "sbmcp-trigger-visual-preview",
"description": "Triggers when user asks to see component",
"input": "Show me what the Button component looks like",
"expected_behavior": "Should use preview-stories to embed live preview",
"tags": ["trigger", "preview"]
},
{
"id": "sbmcp-anti-trigger-no-storybook",
"description": "Should NOT trigger for projects without Storybook",
"input": "Generate a Card component",
"expected_behavior": "Should fall back to filesystem-based discovery when Storybook MCP unavailable",
"tags": ["anti-trigger", "graceful-degradation"]
},
{
"id": "sbmcp-anti-trigger-backend",
"description": "Should NOT trigger for backend-only tasks",
"input": "Create a REST API endpoint for user authentication",
"expected_behavior": "Should not attempt Storybook MCP tools for backend tasks",
"tags": ["anti-trigger"]
},
{
"id": "sbmcp-rule-discovery-before-gen",
"description": "Component discovery must happen before generation",
"input": "I need a data table component with sorting and filtering",
"expected_behavior": "Should call list-all-documentation then get-documentation before writing new component code",
"tags": ["rule", "component-discovery"]
},
{
"id": "sbmcp-rule-self-heal",
"description": "Self-healing on test failure",
"input": "The Modal component I just generated fails a11y tests",
"expected_behavior": "Should read violations from run-story-tests, fix the issues, and re-run tests (max 3 retries)",
"tags": ["rule", "testing", "self-healing"]
}
]
}