-
Notifications
You must be signed in to change notification settings - Fork 10
Configure toolsets via addon options and headers #48
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
Conversation
🦋 Changeset detectedLatest commit: 2d37946 The changes in this PR will be included in the next version bump. This PR includes changesets to release 2 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
commit: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR adds configurable toolset support to the Storybook MCP addon, allowing users to enable or disable groups of tools either through addon configuration options or per-request headers. The feature introduces two toolset categories: storiesDevelopment (for story URLs and UI building instructions) and componentDocumentation (for component manifest and documentation tools).
Key Changes:
- Added toolset configuration via addon options and per-request
X-MCP-Toolsetsheader - Tools can now be dynamically enabled/disabled based on toolset configuration
- Component manifest tools from
@storybook/mcpnow accept an optionalenabledparameter - Comprehensive test coverage for toolset resolution logic
Reviewed Changes
Copilot reviewed 13 out of 13 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
packages/mcp/src/tools/list-all-components.ts |
Added optional enabled parameter to support dynamic tool enablement |
packages/mcp/src/tools/get-component-documentation.ts |
Added optional enabled parameter to support dynamic tool enablement |
packages/addon-mcp/src/types.ts |
Added AddonOptions schema with toolsets configuration and extended AddonContext |
packages/addon-mcp/src/tools/get-ui-building-instructions.ts |
Added enabled callback checking storiesDevelopment toolset; removed unused imports |
packages/addon-mcp/src/tools/get-story-urls.ts |
Added enabled callback checking storiesDevelopment toolset |
packages/addon-mcp/src/preset.ts |
Added validation and passing of addon options to handler |
packages/addon-mcp/src/mcp-handler.ts |
Refactored handler signature; added getToolsets() function for header-based configuration |
packages/addon-mcp/src/mcp-handler.test.ts |
Added comprehensive tests for getToolsets() function and updated existing tests |
packages/addon-mcp/README.md |
Added documentation for toolset configuration via addon options and headers |
apps/internal-storybook/.storybook/main.ts |
Added example toolset configuration (commented out) |
.github/workflows/check.yml |
Moved id-token: write permission to the correct job |
.github/instructions/addon-mcp.instructions.md |
Added comprehensive documentation about toolsets architecture and usage |
.github/copilot-instructions.md |
Added toolset configuration documentation |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #48 +/- ##
==========================================
- Coverage 85.27% 84.50% -0.77%
==========================================
Files 14 14
Lines 774 813 +39
Branches 152 157 +5
==========================================
+ Hits 660 687 +27
- Misses 107 118 +11
- Partials 7 8 +1 ☔ View full report in Codecov by Sentry. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
WDYT about the following structure:
- dev:
- get-story-urls
- get-ui-building-instructions
- docs:
...
- test:
...
Bundle ReportChanges will increase total bundle size by 33.88kB (100.0%) ⬆️
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm going to trust your judgment on the MCP details here. From an addon configuration standpoint it looks good. On the MCP side you might want to get another review or maybe you can walk me through it on a quick call.
Co-authored-by: Michael Shilman <[email protected]>
|
@paoloricciuti liked the approach which is enough of a ✅ for me! |
Added the ability to enable/disable "toolsets", either the Core Tools or the Component Documentation Tools.
They can be configured via addon options, and both default to true.
They can also be configured via the
X-MCP-Toolsetsheader, that users can set when setting up the MCP server. this configuration API directly mimics how you can similarly configure the remote GitHub MCP. I'm not married to this specific structure of the API, it was just easy to copy what they had done.I'm also open to different naming of the toolsets instead of
coreandcomponentDocumentation. Instead ofcoreI also thought aboutstoriesDevelopment,storybookDevelopment,storybookContext...See the updated readme for a more detailed explanation of configuring toolsets.
Component Documentation Tools are still conditioned on manifests being present, no matter how much you try to enable them via toolset configuration.