Skip to content

Add dynamic tools to Available Toolsets#265

Merged
yannbf merged 10 commits into
mainfrom
yann/update-available-toolsets
Jun 4, 2026
Merged

Add dynamic tools to Available Toolsets#265
yannbf merged 10 commits into
mainfrom
yann/update-available-toolsets

Conversation

@yannbf
Copy link
Copy Markdown
Member

@yannbf yannbf commented Jun 2, 2026

This adds dynamic tools which were not available in the template, as it was only adding static tools.

image

@changeset-bot
Copy link
Copy Markdown

changeset-bot Bot commented Jun 2, 2026

🦋 Changeset detected

Latest commit: 902debf

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

This PR includes changesets to release 1 package
Name Type
@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

@pkg-pr-new
Copy link
Copy Markdown

pkg-pr-new Bot commented Jun 2, 2026

npx https://pkg.pr.new/storybookjs/mcp/@storybook/addon-mcp@265
npx https://pkg.pr.new/storybookjs/mcp/@storybook/mcp@265
npx https://pkg.pr.new/storybookjs/mcp/@storybook/mcp-proxy@265

commit: 902debf

@codecov
Copy link
Copy Markdown

codecov Bot commented Jun 2, 2026

Bundle Report

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

Bundle name Size Change
@storybook/addon-mcp-esm* 114.53kB 31.73kB (38.31%) ⬆️⚠️

ℹ️ *Bundle size includes cached data from a previous commit

Affected Assets, Files, and Routes:

view changes for bundle: @storybook/addon-mcp-esm

Assets Changed:

Asset Name Size Change Total Size Change (%)
preset.js 31.73kB 114.53kB 38.31% ⚠️

Files in preset.js:

  • ./src/preset.ts → Total Size: 6.47kB

  • ./src/template.html → Total Size: 5.47kB

  • ./src/mcp-handler.ts → Total Size: 5.7kB

  • ./src/utils/get-tool-availability.ts → Total Size: 1.41kB

  • ./src/instructions/build-server-instructions.ts → Total Size: 2.11kB

@codecov
Copy link
Copy Markdown

codecov Bot commented Jun 2, 2026

Codecov Report

❌ Patch coverage is 80.64516% with 6 lines in your changes missing coverage. Please review.
✅ Project coverage is 79.03%. Comparing base (f56500d) to head (902debf).
⚠️ Report is 11 commits behind head on main.
✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
packages/addon-mcp/src/preset.ts 75.00% 0 Missing and 4 partials ⚠️
packages/addon-mcp/src/mcp-handler.ts 75.00% 0 Missing and 2 partials ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #265      +/-   ##
==========================================
+ Coverage   78.61%   79.03%   +0.42%     
==========================================
  Files          62       63       +1     
  Lines        1800     1808       +8     
  Branches      500      510      +10     
==========================================
+ Hits         1415     1429      +14     
+ Misses        218      213       -5     
+ Partials      167      166       -1     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

yannbf and others added 2 commits June 2, 2026 16:38
@yannbf yannbf force-pushed the yann/update-available-toolsets branch from 6b48934 to ca1596f Compare June 2, 2026 14:40
Base automatically changed from yann/story-discovery to main June 3, 2026 08:53
Comment thread packages/addon-mcp/src/utils/get-tool-availability.ts
Copilot AI review requested due to automatic review settings June 3, 2026 09:18
@netlify
Copy link
Copy Markdown

netlify Bot commented Jun 3, 2026

Deploy Preview for storybook-mcp-self-host-example canceled.

Name Link
🔨 Latest commit 902debf
🔍 Latest deploy log https://app.netlify.com/projects/storybook-mcp-self-host-example/deploys/6a211d851a3d700008711060

Copy link
Copy Markdown
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 updates the @storybook/addon-mcp /mcp landing page so it surfaces tools that are conditionally available at runtime (change-detection, dependency-graph, and review-related tools), and centralizes the tool-availability gating logic so the MCP server and landing page derive availability from the same helper.

Changes:

  • Add a shared getToolAvailability() helper to compute runtime gates (dependency graph support, change detection enablement, and review availability).
  • Expand the /mcp landing page “Available Toolsets” list to include get-changed-stories, get-stories-by-component, display-review, and get-documentation-for-story, with per-tool enabled/disabled badges + explanatory notices.
  • Update MCP server initialization to reuse the shared availability helper (reducing drift between registered tools and landing-page claims).

Reviewed changes

Copilot reviewed 8 out of 8 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
packages/mcp-proxy/src/types/record/v1.ts Reorders Valibot pipe validators for pid/port numeric fields.
packages/addon-mcp/src/utils/get-tool-availability.ts New shared helper returning a single “source of truth” for tool gating.
packages/addon-mcp/src/tools/get-stories-by-component.ts Reorders Valibot pipe validators for maxDistance.
packages/addon-mcp/src/template.html Adds the newly surfaced tool names and new placeholders for per-tool badges/notices.
packages/addon-mcp/src/preset.ts Uses getToolAvailability() and fills new HTML placeholders (badges + notices).
packages/addon-mcp/src/preset.test.ts Adds a test ensuring the landing page lists the new tools and no {{...}} placeholders leak.
packages/addon-mcp/src/mcp-handler.ts Switches to getToolAvailability() so server registration and landing page share gating logic.
.changeset/spotty-toolsets-surface.md Changeset documenting the landing page surfacing and the shared gating helper.

Comment thread packages/addon-mcp/src/preset.ts
Copy link
Copy Markdown
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

Copilot reviewed 6 out of 6 changed files in this pull request and generated no new comments.

Comment thread packages/addon-mcp/src/mcp-handler.ts Outdated
Copilot AI review requested due to automatic review settings June 4, 2026 06:36
@yannbf yannbf merged commit fb37940 into main Jun 4, 2026
14 checks passed
@yannbf yannbf deleted the yann/update-available-toolsets branch June 4, 2026 06:40
@storybook-app-bot storybook-app-bot Bot mentioned this pull request Jun 4, 2026
Copy link
Copy Markdown
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

Copilot reviewed 9 out of 9 changed files in this pull request and generated 3 comments.

Comment on lines 5 to 9
import { STORYBOOK_MCP_PROXY_HEADER } from './auth/index.ts';
import * as mcpHandlerModule from './mcp-handler.ts';
import * as runStoryTests from './tools/run-story-tests.ts';
import * as changeDetection from './utils/change-detection.ts';

Comment on lines +12 to +22
// Lets us flip `@storybook/addon-review` presence so the review tool's gate can be exercised.
// Keep the real exports (e.g. `normalizeStoryPath`) so unrelated tools still register.
const { mockGetAddonNames } = vi.hoisted(() => ({
mockGetAddonNames: vi.fn(() => [] as string[]),
}));
vi.mock('storybook/internal/common', async (importActual) => ({
...(await importActual<typeof import('storybook/internal/common')>()),
loadMainConfig: vi.fn().mockResolvedValue({}),
getAddonNames: () => mockGetAddonNames(),
}));

Comment on lines +9 to +10
/** Dev-server builder supports the dependency-graph API. Gates `get-stories-by-component`. */
dependencyGraphSupported: boolean;
@storybook-app-bot storybook-app-bot Bot mentioned this pull request Jun 5, 2026
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.

4 participants