### Run Project with Bun Source: https://github.com/m-yoshiro/storybook-mcp/blob/main/storybook-sample/README.md Executes the main application file (`index.ts`) using the Bun runtime. This command starts the project's execution environment. ```bash bun run index.ts ``` -------------------------------- ### Install Dependencies Source: https://github.com/m-yoshiro/storybook-mcp/blob/main/README.md Installs project dependencies using either Bun or npm. Bun is recommended for faster installation. ```bash bun install # or npm install ``` -------------------------------- ### Install Dependencies with Bun Source: https://github.com/m-yoshiro/storybook-mcp/blob/main/storybook-sample/README.md Installs project dependencies using the Bun package manager. This command fetches and installs all packages listed in the project's dependency manifest. ```bash bun install ``` -------------------------------- ### Server Configuration Source: https://github.com/m-yoshiro/storybook-mcp/blob/main/README.md Example configuration JSON for setting up the Storybook MCP server. It specifies the command to run and arguments, including an optional path to Storybook static JSON files. ```json { "mcpServers": { "storybook-mcp": { "command": "node", "args": [ "/< your path>/index.js", "/< your path>/index.json" ] } } } ``` -------------------------------- ### Clone Repository Source: https://github.com/m-yoshiro/storybook-mcp/blob/main/README.md Clones the Storybook MCP server repository from GitHub. This is the first step to get the project code. ```bash git clone https://github.com/m-yoshiro/storybook-mcp.git cd storybook-mcp ``` -------------------------------- ### Handle Vite App Loading Errors in Storybook Source: https://github.com/m-yoshiro/storybook-mcp/blob/main/storybook-sample/storybook-static/iframe.html This JavaScript function intercepts Vite application loading errors within Storybook. It checks if the error occurs on a non-localhost hostname during development and provides informative console messages and in-page UI feedback to guide the user on resolving host configuration issues. ```javascript // eslint-disable-next-line no-underscore-dangle, @typescript-eslint/naming-convention function __onViteAppLoadingError(event) { const hostname = globalThis.location.hostname; if (hostname !== 'localhost' && globalThis.CONFIG_TYPE === 'DEVELOPMENT') { const message = `Failed to load the Storybook preview file 'vite-app.js': It looks like you're visiting the Storybook development server on another hostname than localhost: '${hostname}', but you haven't configured the necessary security features to support this. Please re-run your Storybook development server with the '--host ${hostname}' flag, or manually configure your Vite allowedHosts configuration with viteFinal. See:`; const docs = [ 'https://storybook.js.org/docs/api/cli-options#dev', 'https://storybook.js.org/docs/api/main-config/main-config-vite-final', 'https://vite.dev/config/server-options.html#server-allowedhosts', ]; console.error(`${message}\n${docs.map((doc) => `- ${doc}`).join('\n')}`); document.getElementById('storybook-root').innerHTML = `

${message.replaceAll( '\n', '
' )}