Fix: Wrongly enabling docs toolset when only docs manifests where present#193
Fix: Wrongly enabling docs toolset when only docs manifests where present#193
Conversation
…' manifests.docs alone doesn't enable the docs toolset.
🦋 Changeset detectedLatest commit: c34f94a The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
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: |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #193 +/- ##
==========================================
- Coverage 73.45% 73.28% -0.17%
==========================================
Files 42 42
Lines 1179 1179
Branches 333 333
==========================================
- Hits 866 864 -2
- Misses 197 198 +1
- Partials 116 117 +1 ☔ View full report in Codecov by Sentry. |
Bundle ReportBundle size has no change ✅ |
There was a problem hiding this comment.
Pull request overview
Fixes incorrect detection of “docs toolset” availability in @storybook/addon-mcp when only a docs manifest is present (e.g., from addon-docs) but the required components manifest is missing, preventing the MCP docs tools from being shown as enabled and then crashing at runtime.
Changes:
- Tighten manifest availability detection to require
experimental_manifests.components(or the legacy generator) rather than any manifest. - Add a regression test covering the
docs-only manifest scenario. - Update affected tests/fixtures to include a
componentsmanifest where appropriate, and adjust the /mcp HTML notice wording.
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| packages/addon-mcp/src/tools/is-manifest-available.ts | Require components manifest (or legacy generator) to consider docs toolset available |
| packages/addon-mcp/src/tools/is-manifest-available.test.ts | Adds regression test for docs-only manifests |
| packages/addon-mcp/src/preset.ts | Updates docs toolset notice text on the human-readable /mcp page |
| packages/addon-mcp/src/preset.test.ts | Updates preset test to mock experimental_manifests.components |
| packages/addon-mcp/src/mcp-handler.test.ts | Updates handler test to mock experimental_manifests.components for docs tools registration |
You can also share your feedback on Copilot code review. Take the survey.
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 6 out of 6 changed files in this pull request and generated no new comments.
You can also share your feedback on Copilot code review. Take the survey.
This PR fixes an issue that the docs toolset would be enabled (and reported as all green on the human readable
/mcproute) when there were any manifest.addon-docsadds adocsmanifest, but that is not enough for the docs toolset to work, it needs acomponentsmanifest as supplied by the React renderer.Users would have addon-mcp installed in a non-React renderer with addon-docs, and the MCP server would crash trying to deliver docs becaause no components manifest would be found.