MCP Integration
React Native Storybook can expose an experimental MCP (Model Context Protocol) endpoint for AI tooling integration starting from v10.3.What is MCP?
Model Context Protocol is a standardized interface that allows AI tools to query documentation and interact with your Storybook instance. This enables:- AI-powered component discovery: Ask AI about available components and their stories
- Automated documentation queries: Retrieve component metadata, args, and parameters
- Story selection tools: Control which story is displayed on connected devices
- Development assistance: Integrate Storybook data into AI coding assistants
Endpoint Location
When enabled, the MCP endpoint runs on the same channel server as WebSockets:http://localhost:7007/mcp
Configuration
Enable with Metro
For Metro-based projects (Expo, React Native CLI):websockets: 'auto' automatically detects your LAN IP and is available from v10.2. You can also manually set { host, port }.Enable with Re.Pack / Rspack
For projects using Re.Pack:WebSocket Requirements
MCP functionality is split into two categories:- Documentation Tools
- Story Selection Tools
Available without WebSocketsThese tools work with
experimental_mcp: true alone:- Query component documentation
- Retrieve story metadata
- Access args and parameters
- Browse available stories
MCP Client Configuration
Configure your AI tool to connect to the Storybook MCP endpoint:Example: Claude Desktop
Example: Custom Client
Complete Setup Example
Configure your AI tool
Add the MCP endpoint to your AI tool’s configuration using the URL from the Metro output.
Network Configuration
For Physical Devices
When testing on physical devices, use your machine’s IP address:For Android Emulator
Android emulators use a special IP to access the host machine:Firewall Configuration
Ensure your firewall allows connections on the MCP port:Use Cases
Component Discovery
Ask AI to find components:Documentation Queries
Retrieve component information:Development Assistance
Integrate with coding workflows:Testing Automation
Combine with testing tools:Troubleshooting
404 Error on /mcp
Problem: MCP endpoint returns 404 Solutions:- Ensure
experimental_mcp: trueis set in Metro config - Restart Metro bundler after config changes
- Verify you’re using Storybook v10.3 or later
Story Selection Tool Unavailable
Problem: AI tool reports story selection is unavailable Solution: Enable WebSockets in Metro config:Connection Issues from Physical Devices
Problem: Cannot connect to MCP endpoint from device Solutions:- Use
websockets: 'auto'for automatic IP detection - Manually set your machine’s LAN IP address
- Check firewall settings
- Verify device is on the same network
MCP Server Not Starting
Problem: Metro starts but MCP endpoint isn’t available Solutions:- Check if port 7007 is already in use:
- Use a different port:
Security Considerations
MCP endpoints should only be enabled in development environments. Never expose MCP in production builds.
Disable in Production
Use environment variables to control MCP:Network Access Control
- Run MCP on localhost for local development only
- Use VPN for remote team access
- Avoid exposing MCP port to public networks
- Consider authentication for shared development environments