MCP Configuration
React Native Storybook can expose an experimental MCP (Model Context Protocol) endpoint for AI tooling from v10.3 onwards. The endpoint runs on the same channel server as WebSockets at:
http://<host>:<port>/mcp
Enable with Metro
// metro.config.js
const { withStorybook } = require('@storybook/react-native/metro/withStorybook');
module.exports = withStorybook(config, {
websockets: 'auto',
experimental_mcp: true,
});
You can also set websockets manually with { host, port }. 'auto' is available from v10.2.
Enable with Re.Pack / Rspack
import { StorybookPlugin } from '@storybook/react-native/repack/withStorybook';
new StorybookPlugin({
enabled: storybookEnabled,
websockets: 'auto',
experimental_mcp: true,
});
You can also set websockets manually with { host, port }. 'auto' is available from v10.2.
Behavior
experimental_mcp: trueenables MCP HTTP endpoints.websocketsis optional for MCP docs/query tools.- Story selection tools are only available when
websocketsis enabled.
If you enable MCP without websockets, Storybook still serves documentation tools, but cannot push story selection events to connected devices.
MCP Client Example
{
"mcpServers": {
"storybook": {
"type": "http",
"url": "http://localhost:7007/mcp"
}
}
}
Troubleshooting
404on/mcp- Ensure
experimental_mcp: trueis set in Metro/Re.Pack config. - Restart bundler after config changes.
- Ensure
- Story selection tool unavailable
- Enable
websocketsin Metro/Re.Pack config.
- Enable
- Connection issues from physical devices
- Prefer
websockets: 'auto'or use your machine LAN IP and ensure network/firewall access.
- Prefer