Skip to content

Conversation

@JReinhold
Copy link
Contributor

@JReinhold JReinhold commented Oct 28, 2025

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-Toolsets header, 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 core and componentDocumentation. Instead of core I also thought about storiesDevelopment, 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.

@changeset-bot
Copy link

changeset-bot bot commented Oct 28, 2025

🦋 Changeset detected

Latest commit: 2d37946

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 2 packages
Name Type
@storybook/mcp Patch
@storybook/addon-mcp Patch

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

@JReinhold JReinhold self-assigned this Oct 28, 2025
@JReinhold JReinhold requested a review from Copilot October 28, 2025 20:50
@pkg-pr-new
Copy link

pkg-pr-new bot commented Oct 28, 2025

npm i https://pkg.pr.new/@storybook/addon-mcp@48
npm i https://pkg.pr.new/@storybook/mcp@48

commit: 2d37946

Copy link
Contributor

Copilot AI left a 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-Toolsets header
  • Tools can now be dynamically enabled/disabled based on toolset configuration
  • Component manifest tools from @storybook/mcp now accept an optional enabled parameter
  • 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
Copy link

codecov bot commented Oct 28, 2025

Codecov Report

❌ Patch coverage is 74.00000% with 13 lines in your changes missing coverage. Please review.
✅ Project coverage is 84.50%. Comparing base (7283cac) to head (2d37946).
⚠️ Report is 19 commits behind head on main.
✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
packages/addon-mcp/src/preset.ts 0.00% 12 Missing ⚠️
packages/addon-mcp/src/mcp-handler.ts 96.87% 0 Missing and 1 partial ⚠️
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.
📢 Have feedback on the report? Share it here.

Copy link
Member

@shilman shilman left a 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:
   ...

@codecov
Copy link

codecov bot commented Oct 29, 2025

Bundle Report

Changes will increase total bundle size by 33.88kB (100.0%) ⬆️⚠️, exceeding the configured threshold of 5%.

Bundle name Size Change
@storybook/mcp-esm 19.31kB 19.31kB (100%) ⬆️⚠️
@storybook/addon-mcp-esm 14.57kB 14.57kB (100%) ⬆️⚠️

Copy link
Member

@shilman shilman left a 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.

@JReinhold
Copy link
Contributor Author

@paoloricciuti liked the approach which is enough of a ✅ for me!

@JReinhold JReinhold merged commit ff44b3e into main Oct 29, 2025
12 of 14 checks passed
@JReinhold JReinhold deleted the configure-toolset branch October 29, 2025 20:14
@github-actions github-actions bot mentioned this pull request Oct 29, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants