Storybook MCP
Help agents automatically write and test stories for your UI components
Storybook MCP Addon
This Storybook addon runs an MCP (Model Context Protocol) server to help develop UI components more efficiently.
It enables a workflow where for each UI component created, the agent will automatically generate and link to example stories. These stories let you visually verify the new UI in each of its key states, and provide documentation and component tests.
The server currently exposes two tools: one to provide UI development instructions to the agent, and the other to retrieve story URLs directly from your runnng Storybook.
[!IMPORTANT] This addon currently only supports Vite-based Storybook setups, such as
@storybook/react-vite
,@storybook/nextjs-vite
, and@storybook/sveltekit
.
Getting Started
Installation and Setup
Use Storybook's CLI to automatically install and configure the addon:
npx storybook add @storybook/addon-mcp
This command will install the addon and add it to your Storybook configuration automatically.
Start your Storybook development server:
npm run storybook
The MCP server will be available at <your_storybook_dev_server_origin>/mcp
when Storybook is running.
Configuring Your Agent
[!NOTE] This addon is primarily tested with Claude Code. While it should work with other MCP clients, Claude Code is our main target for compatibility and testing.
Claude Code Setup
To use this addon with Claude Code, use the built-in MCP configuration command:
-
Add the MCP server: Run the following command in your terminal:
claude mcp add storybook-mcp --transport http http://localhost:6006/mcp --scope project
-
Start Storybook: Make sure your Storybook development server is running:
npm run storybook
-
Connect Claude Code: Claude Code should automatically detect and connect to the MCP server when it's running. You can verify the connection by asking Claude to use Storybook-related tools.
-
Configure Agent Behavior (Optional but Recommended): Add the following system or project prompt to ensure your agent uses the Storybook tools when appropriate:
Before doing any UI, frontend or React development, ALWAYS call the storybook MCP server to get further instructions.
Other MCP Clients
This addon should work with any MCP-compatible client that supports the tool
capability and the streamable-http
transport. Here are setup guides for other popular clients:
For clients not listed above, consult their documentation for MCP server configuration. The server configuration typically requires:
- Server Type:
http
- URL:
http://localhost:6006/mcp
(adjust port if your Storybook runs on a different port) - ⚠️ Make sure your Storybook development server is running before your agent tries to connect.
Usage
This addon provides two main MCP tools that your agent can use. The goal is that the agent uses these tools automatically when doing UI development, but agents are unreliable and unpredictable, so sometimes you might need to explicitly tell it to use the tools.
1. UI Building Instructions (get_ui_building_instructions
)
Provides agents with standardized instructions for UI component development within your project. This tool returns guidelines for:
- Writing Storybook stories using CSF3 format
- Component development best practices
- Story linking requirements
The instructions ensure agents follow your project's conventions when creating or modifying UI components and their corresponding stories.
2. Get Story URLs (get_story_urls
)
Allows agents to retrieve direct URLs to specific stories in your Storybook. The agent can request URLs for multiple stories by providing:
absoluteStoryPath
: Absolute path to the story fileexportName
: The export name of the storyexplicitStoryName
: Optional explicit story name
Example agent usage:
Prompt: I need to see the primary variant of the Button component
Agent calls tool, gets response:
http://localhost:6006/?path=/story/example-button--primary
Contributing
We welcome contributions to improve Storybook's agent integration, within or outside of this addon! Here's how you can help:
-
Ideas and feature requests: If you have ideas for what else we could do to improve the Storybook experience when using agents, please start a discussion in this repository.
-
Report Issues: If you find bugs, please open an issue on our GitHub repository, but keep in mind that this is currently highly experimental, explorative and probably filled with bugs.
-
Development Setup:
# Clone the repository git clone https://github.com/storybookjs/addon-mcp.git cd addon-mcp # Install dependencies pnpm install # Start development pnpm start
-
Testing: Run the MCP inspector to test the server functionality (requires that the Storybook dev server is running):
pnpm run inspect
Related Servers
Sensei MCP
Expert guidance for Dojo and Cairo development on Starknet, specializing in the Dojo ECS framework for building onchain worlds.
BaseMcpServer
A minimal, containerized base for building MCP servers with the Python SDK, featuring a standardized Docker image and local development setup.
Creatify
MCP Server that exposes Creatify AI API capabilities for AI video generation, including avatar videos, URL-to-video conversion, text-to-speech, and AI-powered editing tools.
Gemini Image MCP Server
Image generation using Google's Gemini API.
Build-Scout
Interact with various build systems including Gradle, Maven, NPM/Yarn, Cargo, Python, Makefile, and CMake.
Bonk MCP
Implements Solana blockchain functionality for the LetsBonk launchpad.
Postman MCP Generator
A server providing JavaScript tools for making Postman API requests.
Remote MCP Server (Authless)
A template for deploying a remote, auth-less MCP server on Cloudflare Workers.
MetaMCP
A proxy server that combines multiple MCP servers into a single endpoint, routing requests to the appropriate underlying server.
Stackzero Labs MCP
A server for generating Stackzero Labs UI components.