generated from storybookjs/addon-kit
-
Notifications
You must be signed in to change notification settings - Fork 10
Support Webpack-based frameworks, require Storybook 10.1 #36
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
a1f8bbe
ensure all storybook versions are the same, require canary version wi…
JReinhold 93f88e4
use experimental_devServer preset property to register MCP handler
JReinhold 15ea27c
Update packages/addon-mcp/README.md
JReinhold 85eec7f
Update .changeset/dark-eagles-argue.md
JReinhold 031169f
update to latest SB 10.1 canary version
JReinhold File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| --- | ||
| '@storybook/addon-mcp': minor | ||
| --- | ||
|
|
||
| Add support for Webpack (including Webpack-based frameworks like Next.js) | ||
|
|
||
| # Breaking Change | ||
|
|
||
| This requires version 10.1 of Storybook, currently only available as the canary version `0.0.0-pr-32810-sha-6e759c7e`. If you want to continue to use the addon with Storybook 9 or 10.0 (and Vite), stick to [version `0.0.9` of this package](https://github.com/storybookjs/mcp/tree/%40storybook/addon-mcp%400.0.9). |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,20 +1,11 @@ | ||
| import type { Plugin } from 'vite'; | ||
| import { mcpServerHandler } from './mcp-handler.ts'; | ||
| import type { Options } from 'storybook/internal/types'; | ||
| import type { PresetProperty } from 'storybook/internal/types'; | ||
|
|
||
| // This is a workaround for Storybook not having an API for addons to register server middlewares/handlers | ||
| // We can do it through Vite's plugin API instead, which gets added to Storybook's dev server in the end. 😈 | ||
| export const viteFinal = async (config: any, options: Options) => { | ||
| const mcpHandlerPlugin: Plugin = { | ||
| name: 'storybook:mcp-server', | ||
| configureServer(server) { | ||
| server.middlewares.use('/mcp', (req, res, next) => | ||
| mcpServerHandler(req, res, next, options), | ||
| ); | ||
| }, | ||
| }; | ||
| return { | ||
| ...config, | ||
| plugins: config.plugins.concat(mcpHandlerPlugin), | ||
| }; | ||
| export const experimental_devServer: PresetProperty< | ||
| 'experimental_devServer' | ||
| > = (app, options) => { | ||
| app!.use('/mcp', (req, res, next) => | ||
| mcpServerHandler(req, res, next, options), | ||
| ); | ||
| return app; | ||
| }; | ||
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.