Add MCP server-level instructions to both packages#185
Conversation
🦋 Changeset detectedLatest commit: 8dbd727 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 |
Co-authored-by: JReinhold <5678122+JReinhold@users.noreply.github.com>
Co-authored-by: JReinhold <5678122+JReinhold@users.noreply.github.com>
|
Just as a heads up, I was blocked by some firewall rules while working on your feedback. Expand below for details. Warning Firewall rules blocked me from connecting to one or more addresses (expand for details)I tried to connect to the following addresses, but was blocked by firewall rules:
If you need me to access, download, or install something from one of these locations, you can either:
|
…ions Co-authored-by: JReinhold <5678122+JReinhold@users.noreply.github.com>
|
Just as a heads up, I was blocked by some firewall rules while working on your feedback. Expand below for details. Warning Firewall rules blocked me from connecting to one or more addresses (expand for details)I tried to connect to the following addresses, but was blocked by firewall rules:
If you need me to access, download, or install something from one of these locations, you can either:
|
commit: |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #185 +/- ##
=======================================
Coverage ? 73.28%
=======================================
Files ? 42
Lines ? 1179
Branches ? 333
=======================================
Hits ? 864
Misses ? 198
Partials ? 117 ☔ View full report in Codecov by Sentry. |
Bundle ReportChanges will increase total bundle size by 1.49kB (3.1%) ⬆️. This is within the configured threshold ✅ Detailed changes
Affected Assets, Files, and Routes:view changes for bundle: @storybook/mcp-esmAssets Changed:
|
…ithub.com/storybookjs/mcp into copilot/implement-mcp-server-instructions
There was a problem hiding this comment.
Pull request overview
Adds MCP server-level initialize.instructions guidance to both the standalone @storybook/mcp server and the @storybook/addon-mcp server, and updates the eval harness/tasks to exercise and score tool-usage workflows.
Changes:
- Introduce reusable base server instructions in
@storybook/mcpand include them in MCPinitializeresponses. - Add dynamic instruction composition in
@storybook/addon-mcpbased on enabled toolsets and runtime availability (docs/test). - Reshape eval tasks 901–907 with new configs/READMEs, MCP-tool-based quality scoring, and update model references.
Reviewed changes
Copilot reviewed 40 out of 44 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| pnpm-workspace.yaml | Bumps Storybook-related catalog versions used across the monorepo. |
| packages/mcp/src/instructions.md | Adds base documentation/verification workflow instructions for the MCP server. |
| packages/mcp/src/index.ts | Imports and wires server instructions into McpServer initialization; exports instructions for reuse. |
| packages/mcp/src/index.test.ts | Adds test asserting initialize.instructions is present and matches snapshot. |
| packages/mcp/src/globals.d.ts | Adds *.md module typing for TypeScript imports. |
| packages/mcp/bin.ts | Adds server instructions to the stdio server variant by reading instructions.md. |
| packages/addon-mcp/src/mcp-handler.ts | Adds dynamic server instructions tailored to toolsets and runtime feature availability. |
| packages/addon-mcp/src/mcp-handler.test.ts | Adds assertions/tests around instruction inclusion/exclusion by toolset and manifest availability. |
| packages/addon-mcp/src/instructions/test-instructions.md | Adds test/validation workflow instructions section. |
| packages/addon-mcp/src/instructions/dev-instructions.md | Adds dev workflow instructions section for story writing + previewing. |
| packages/addon-mcp/src/instructions/build-server-instructions.ts | Implements instruction composition (dev/test/docs) including reuse from @storybook/mcp. |
| packages/addon-mcp/src/instructions/build-server-instructions.test.ts | Adds unit tests for instruction composition across toolset combinations. |
| packages/addon-mcp/pnpm-lock.yaml | Updates lockfile to reflect Storybook catalog bumps. |
| eval/variant-configs/testing-toolset-internal.ts | Updates eval variant to use claude-sonnet-4.6. |
| eval/variant-configs/preview-by-id-internal.ts | Updates eval variant to use claude-sonnet-4.6. |
| eval/variant-configs/component-concise-reshaped-internal.ts | Adds a concise internal variant config for reshaped tasks 901–907. |
| eval/types.ts | Updates supported model lists/mappings to include claude-sonnet-4.6. |
| eval/templates/grading/vitest.config.ts | Updates coverage exclusion from preview.ts to preview.tsx. |
| eval/tasks/901-create-component-atom-reshaped/hooks.ts | Adds MCP-tools-based quality scoring; updates preview file handling. |
| eval/tasks/901-create-component-atom-reshaped/config.json | Adds expected MCP tool usage thresholds for task scoring. |
| eval/tasks/901-create-component-atom-reshaped/README.md | Adds task documentation including expected tools + quality signal. |
| eval/tasks/902-create-component-composite-reshaped/hooks.ts | Adds MCP-tools-based quality scoring; updates preview file handling. |
| eval/tasks/902-create-component-composite-reshaped/config.json | Adds expected MCP tool usage thresholds for task scoring. |
| eval/tasks/902-create-component-composite-reshaped/README.md | Adds task documentation including expected tools + quality signal. |
| eval/tasks/903-create-component-async-fetch-reshaped/hooks.ts | Adds MCP-tools-based quality scoring; updates preview file handling. |
| eval/tasks/903-create-component-async-fetch-reshaped/config.json | Adds expected MCP tool usage thresholds for task scoring. |
| eval/tasks/903-create-component-async-fetch-reshaped/README.md | Adds task documentation including expected tools + quality signal. |
| eval/tasks/904-create-component-async-module-reshaped/hooks.ts | Adds MCP-tools-based quality scoring; updates preview file handling. |
| eval/tasks/904-create-component-async-module-reshaped/config.json | Adds expected MCP tool usage thresholds for task scoring. |
| eval/tasks/904-create-component-async-module-reshaped/README.md | Adds task documentation including expected tools + quality signal. |
| eval/tasks/905-existing-component-write-story-reshaped/hooks.ts | Adds MCP-tools-based quality scoring; updates preview file handling. |
| eval/tasks/905-existing-component-write-story-reshaped/config.json | Adds expected MCP tool usage thresholds for task scoring. |
| eval/tasks/905-existing-component-write-story-reshaped/README.md | Adds task documentation including expected tools + quality signal. |
| eval/tasks/906-existing-component-edit-story-reshaped/hooks.ts | Adds MCP-tools-based quality scoring; updates preview file handling. |
| eval/tasks/906-existing-component-edit-story-reshaped/config.json | Adds expected MCP tool usage thresholds for task scoring. |
| eval/tasks/906-existing-component-edit-story-reshaped/README.md | Adds task documentation including expected tools + quality signal. |
| eval/tasks/907-existing-component-change-component-reshaped/hooks.ts | Adds MCP-tools-based quality scoring; updates preview file handling. |
| eval/tasks/907-existing-component-change-component-reshaped/config.json | Adds expected MCP tool usage thresholds for task scoring. |
| eval/tasks/907-existing-component-change-component-reshaped/README.md | Adds task documentation including expected tools + quality signal. |
| eval/pnpm-lock.yaml | Updates eval lockfile to reflect Storybook catalog bumps. |
| eval/lib/agents/claude-code-cli.ts | Updates tokenizer/model mapping to support claude-sonnet-4.6. |
| eval/README.md | Updates documentation/examples to reference claude-sonnet-4.6. |
| apps/internal-storybook/pnpm-lock.yaml | Updates internal-storybook lockfile to reflect Storybook catalog bumps. |
| .changeset/mcp-server-instructions.md | Adds changeset bumping both packages for new server instructions behavior. |
Files not reviewed (3)
- apps/internal-storybook/pnpm-lock.yaml: Language not supported
- eval/pnpm-lock.yaml: Language not supported
- packages/addon-mcp/pnpm-lock.yaml: Language not supported
You can also share your feedback on Copilot code review. Take the survey.
…alCalls is 0 Co-authored-by: JReinhold <5678122+JReinhold@users.noreply.github.com>
packages/mcp/src/instructions.mdfor composabilitydev-instructions.md(always) andtest-instructions.md(vitest only)mcp-server-instructions.mdbuildServerInstructions()composes based on actual availability;devEnablednow also gatedinstructionsis a getter on the server options object — readsserver.ctx.custom?.toolsetsper-request so per-request toolset header overrides are respectedtest-instructions.md: explicitly names therun-story-teststoolgradeMcpTools(): return summary whenexpectedToolCountis set even iftotalCalls === 0, so zero-MCP-call runs score 0 instead ofquality: undefined🔒 GitHub Advanced Security automatically protects Copilot coding agent pull requests. You can protect all pull requests by enabling Advanced Security for your repositories. Learn more about Advanced Security.