Skip to content

Commit 5d21a93

Browse files
committed
fix(storybook): scope MCP guidance to documented catalog (#3527)
Keep Storybook on demand while moving its startup guidance into the contributor docs. Patch the addon instructions so the incremental catalog remains useful without hiding undocumented Astryx APIs. Generated-by: Codex
1 parent 6a8e8b0 commit 5d21a93

6 files changed

Lines changed: 88 additions & 53 deletions

File tree

AGENTS.md

Lines changed: 0 additions & 53 deletions
This file was deleted.

CONTRIBUTING.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,21 @@ npx knip --workspace packages/ui
7878

7979
Architecture is documented in [ARCHITECTURE.md](./ARCHITECTURE.md); evaluation commands and contracts live in [`packages/eval`](./packages/eval).
8080

81+
### Storybook component documentation
82+
83+
Storybook and its MCP endpoint are development-only and start on demand:
84+
85+
```sh
86+
npm --workspace @maka/desktop run storybook -- --no-open
87+
```
88+
89+
The MCP endpoint is then available at `http://localhost:6006/mcp`; the root
90+
`.mcp.json` registers it for clients that support repository MCP configuration.
91+
Its component catalog is incremental rather than exhaustive. For UI work,
92+
query Storybook documentation first. If the needed API is not documented there,
93+
follow [DESIGN.md](./DESIGN.md) and verify Astryx components and props against
94+
Astryx's official API or published type declarations. Never guess props.
95+
8196
## Pull requests
8297

8398
Opening a pull request pre-fills [`pull_request_template.md`](./.github/pull_request_template.md); fill it in rather than replacing it.

CONTRIBUTING.zh-CN.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,20 @@ npx knip --workspace packages/ui
7878

7979
架构说明见 [ARCHITECTURE.zh-CN.md](./ARCHITECTURE.zh-CN.md);Eval 的命令与 contract 见 [`packages/eval`](./packages/eval)
8080

81+
### Storybook 组件文档
82+
83+
Storybook 及其 MCP 端点仅用于开发,并按需启动:
84+
85+
```sh
86+
npm --workspace @maka/desktop run storybook -- --no-open
87+
```
88+
89+
启动后,MCP 端点位于 `http://localhost:6006/mcp`;支持仓库级 MCP 配置的客户端
90+
会通过根目录的 `.mcp.json` 注册它。当前组件目录会逐步补充,并不完整。进行 UI
91+
开发时应优先查询 Storybook 文档;如果所需 API 尚无文档,则遵循
92+
[DESIGN.md](./DESIGN.md),并根据 Astryx 官方 API 或已发布的类型声明核实 Astryx
93+
组件及其 props,切勿猜测 props。
94+
8195
## Pull Request
8296

8397
开 PR 时会自动填充 [`pull_request_template.md`](./.github/pull_request_template.md);请在它的基础上填写,不要整段替换。

LICENSE

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -308,6 +308,40 @@ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
308308
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
309309
THE SOFTWARE.
310310

311+
Storybook MCP addon dependency patch
312+
313+
Source: https://www.npmjs.com/package/@storybook/addon-mcp/v/0.7.0
314+
Repository: https://github.com/storybookjs/mcp/tree/main/packages/addon-mcp
315+
Version: 0.7.0
316+
Dependency patch: patches/@storybook+addon-mcp+0.7.0.patch
317+
Copyright (c) 2023 Storybook contributors
318+
License: MIT
319+
320+
Maka redistributes a source patch that replaces the addon's documentation
321+
workflow instructions. The following MIT License applies to that material:
322+
323+
MIT License
324+
325+
Copyright (c) 2023 Storybook contributors
326+
327+
Permission is hereby granted, free of charge, to any person obtaining a copy
328+
of this software and associated documentation files (the "Software"), to deal
329+
in the Software without restriction, including without limitation the rights
330+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
331+
copies of the Software, and to permit persons to whom the Software is
332+
furnished to do so, subject to the following conditions:
333+
334+
The above copyright notice and this permission notice shall be included in all
335+
copies or substantial portions of the Software.
336+
337+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
338+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
339+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
340+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
341+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
342+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
343+
THE SOFTWARE.
344+
311345
node-pty dependency patch
312346

313347
Source: https://www.npmjs.com/package/node-pty/v/1.2.0-beta.15
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
diff --git a/node_modules/@storybook/addon-mcp/dist/preset.js b/node_modules/@storybook/addon-mcp/dist/preset.js
2+
index 956b95c..5f82bf8 100644
3+
--- a/node_modules/@storybook/addon-mcp/dist/preset.js
4+
+++ b/node_modules/@storybook/addon-mcp/dist/preset.js
5+
@@ -748 +748 @@ var legacy_test_instructions_default = "## Validation Workflow\n\n- After editin
6+
-var review_docs_instructions_default = "## Documentation Workflow\n\n**CRITICAL: Never hallucinate component properties!** Undocumented props do not exist — never assume them from naming or other libraries; verify every prop via these tools, not source or types in node_modules.\n\n1. Call **list-all-documentation** once at task start for component and docs IDs.\n2. Call **get-documentation** with an `id` from that list for props and usage examples.\n\nOnly reference IDs returned by these tools — never guess; scope multi-source requests with `storybookId`.\n";
7+
+var maka_docs_instructions_default = "## Documentation Workflow\n\nUse Storybook documentation tools first to discover documented components, props, and examples. This catalog is incremental and incomplete: missing documentation does not mean a component or prop does not exist.\n\n1. Call **list-all-documentation** once at task start for available component and docs IDs.\n2. Call **get-documentation** with an `id` from that list for props and usage examples.\n3. Call **get-documentation-for-story** for additional details about a documented story variant.\n\nFor gaps, follow the repository's **DESIGN.md**. Verify Astryx components and props against Astryx's official API or published type declarations. Never guess props from names, conventions, or unrelated libraries. Only reference Storybook IDs returned by these tools; scope multi-source requests with `storybookId`.\n";
8+
@@ -773 +773 @@ function buildServerInstructions(options) {
9+
- const sections = [options.docsEnabled ? "Follow these workflows when working with UI and/or Storybook. Answer questions about component props, API, or usage with the documentation tools — never from source or type definitions." : "Follow these workflows when working with UI and/or Storybook."];
10+
+ const sections = ["Follow these workflows when working with UI and/or Storybook."];
11+
@@ -783 +783 @@ function buildServerInstructions(options) {
12+
- if (options.docsEnabled) sections.push((reviewEnabled ? review_docs_instructions_default : STORYBOOK_MCP_INSTRUCTIONS).trim());
13+
+ if (options.docsEnabled) sections.push(maka_docs_instructions_default.trim());

patches/README.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,18 @@ Keep this directory small. Prefer product code that uses the dependency's
2727
published API; only patch for bugs that block shipping and cannot be worked
2828
around at the call site.
2929

30+
## `@storybook/addon-mcp@0.7.0`
31+
32+
The upstream MCP instructions treat Storybook documentation as an exhaustive
33+
catalog and prohibit consulting source or type declarations. Maka's catalog is
34+
incremental, so that advice would incorrectly hide existing components and
35+
props. The patch keeps Storybook documentation first, states the coverage gap,
36+
and directs agents to `DESIGN.md` plus Astryx's official API or published types
37+
for missing documentation without guessing props.
38+
39+
Delete when the addon supports project-owned instructions that can replace its
40+
default documentation workflow.
41+
3042
## `@tufjs/models@5.0.0` and `@sigstore/core@4.0.1`
3143

3244
The published ECDSA verification paths rely on Node choosing a digest when

0 commit comments

Comments
 (0)