@storybook/mcp 11.0.0-alpha.4 → 11.0.0-alpha.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.ts CHANGED
@@ -5,6 +5,13 @@ import { McpServer } from "tmcp";
5
5
  //#region code/core/dist/shared/open-service/toolsets/docs/public.d.ts
6
6
  //#endregion
7
7
  //#region code/core/.dts-emit/code/core/src/shared/open-service/toolsets/docs/instructions.d.ts
8
+ /**
9
+ * Server instructions for an MCP server that only serves the docs tools (`@storybook/mcp`).
10
+ *
11
+ * This is the workflow an agent should follow across the three tools, which no single tool
12
+ * description can state: discover ids first, then fetch, and never invent a prop. It names its
13
+ * tools through {@link getToolName} so the prose cannot drift from what is registered.
14
+ */
8
15
  declare const DOCS_TOOLSET_INSTRUCTIONS: string; //#endregion
9
16
  //#region code/core/.dts-emit/code/core/src/shared/open-service/toolsets/docs/manifest-formatter/manifest-types.d.ts
10
17
  declare const StorySchema: v.ObjectSchema<{
@@ -529,7 +536,7 @@ type DocgenJsDocTags = Record<string, string[]>;
529
536
  * Docgen payload returned by `core/docgen`'s `docgen` query.
530
537
  *
531
538
  * Component-only fields (props, descriptions, subcomponents). Story snippets and file-level
532
- * imports live in `core/story-docs` when `experimentalDocgenServer` is enabled.
539
+ * imports live in `core/story-docs` when `docgenServer` is enabled.
533
540
  */
534
541
  interface DocgenPayload {
535
542
  id: string;
@@ -585,7 +592,7 @@ type MdxDoc = {
585
592
  }; //#endregion
586
593
  //#region code/core/.dts-emit/code/core/src/shared/open-service/toolsets/docs/manifest-formatter/adapt-core-manifest.d.ts
587
594
  /**
588
- * Adapts the `experimentalDocgenServer` open-service payloads into the manifest formatter's
595
+ * Adapts the `docgenServer` open-service payloads into the manifest formatter's
589
596
  * {@link ComponentManifest}/{@link Doc} shapes.
590
597
  *
591
598
  * Only `argTypes` is dropped: the props section comes from `apiDescription` when the framework
@@ -689,7 +696,7 @@ type StorybookContext = {
689
696
  })) => void | Promise<void>;
690
697
  /**
691
698
  * Optional in-process resolver for a single component or docs entry, used in
692
- * Storybook's dev server when `experimentalDocgenServer` is enabled. When set,
699
+ * Storybook's dev server when `docgenServer` is enabled. When set,
693
700
  * single-entry tools (`docs-show`, `docs-show-story`) call
694
701
  * this instead of fetching the (potentially all-component) manifest index, so a
695
702
  * single lookup never triggers docgen extraction for every component.
@@ -713,7 +720,7 @@ type ResolvedEntry = {
713
720
  };
714
721
  /**
715
722
  * Open-service payload contracts (the "core format") that Storybook's
716
- * `experimentalDocgenServer` mode produces. `@storybook/mcp` adapts these into its
723
+ * `docgenServer` mode produces. `@storybook/mcp` adapts these into its
717
724
  * internal {@link ComponentManifest}/{@link Doc} shapes in one place
718
725
  * (`adaptCoreComponent`/`adaptCoreDoc`). Defined structurally (not as schemas) so
719
726
  * the addon can build them in-process without importing Storybook core.
package/dist/index.js CHANGED
@@ -1,10 +1,10 @@
1
- import CJS_COMPAT_NODE_URL_2k0ec9wyd2d from 'node:url';
2
- import CJS_COMPAT_NODE_PATH_2k0ec9wyd2d from 'node:path';
3
- import CJS_COMPAT_NODE_MODULE_2k0ec9wyd2d from "node:module";
1
+ import CJS_COMPAT_NODE_URL_lgg2mq0a13f from 'node:url';
2
+ import CJS_COMPAT_NODE_PATH_lgg2mq0a13f from 'node:path';
3
+ import CJS_COMPAT_NODE_MODULE_lgg2mq0a13f from "node:module";
4
4
 
5
- var __filename = CJS_COMPAT_NODE_URL_2k0ec9wyd2d.fileURLToPath(import.meta.url);
6
- var __dirname = CJS_COMPAT_NODE_PATH_2k0ec9wyd2d.dirname(__filename);
7
- var require = CJS_COMPAT_NODE_MODULE_2k0ec9wyd2d.createRequire(import.meta.url);
5
+ var __filename = CJS_COMPAT_NODE_URL_lgg2mq0a13f.fileURLToPath(import.meta.url);
6
+ var __dirname = CJS_COMPAT_NODE_PATH_lgg2mq0a13f.dirname(__filename);
7
+ var require = CJS_COMPAT_NODE_MODULE_lgg2mq0a13f.createRequire(import.meta.url);
8
8
 
9
9
  // ------------------------------------------------------------
10
10
  // end of CJS compatibility banner, injected by Storybook's esbuild configuration
@@ -24,7 +24,7 @@ import { HttpTransport } from "@tmcp/transport-http";
24
24
  // package.json
25
25
  var package_default = {
26
26
  name: "@storybook/mcp",
27
- version: "11.0.0-alpha.4",
27
+ version: "11.0.0-alpha.6",
28
28
  description: "MCP server that serves knowledge about your components based on your Storybook stories and documentation",
29
29
  keywords: [
30
30
  "mcp",
@@ -144,26 +144,6 @@ function resolveToolsetDescription(description3, context) {
144
144
  return typeof description3 == "function" ? description3(context) : description3;
145
145
  }
146
146
 
147
- // ../../core/dist/_browser-chunks/chunk-DJVLGLRX.js
148
- function getDocsToolsetInstructions(transport) {
149
- let ref = getToolName({ transport });
150
- return `## Documentation Workflow
151
-
152
- **CRITICAL: Never hallucinate component properties!** Before using ANY property on a component (even common-sounding ones like \`shadow\`), you MUST verify it is documented via these tools. If it is not documented, it does not exist \u2014 never assume props from naming conventions or other libraries; report it to the user instead.
153
-
154
- 1. Call **${ref("docs.list")}** once at the start of the task to discover available component and docs IDs.
155
- 2. Call **${ref("docs.show")}** with an \`id\` from that list to retrieve full component docs, props, usage examples, and stories.
156
- 3. Call **${ref("docs.showStory")}** for extra docs on a story variant not covered by the component docs.
157
-
158
- Only use properties explicitly documented or shown in example stories. Only reference IDs returned by these tools; never guess IDs.
159
-
160
- ## Multi-Source Requests
161
-
162
- - With multiple sources configured, **${ref("docs.list")}** returns entries from every source; pass \`storybookId\` to **${ref("docs.show")}** to scope one.
163
- `;
164
- }
165
- var DOCS_TOOLSET_INSTRUCTIONS = getDocsToolsetInstructions("mcp");
166
-
167
147
  // ../../core/dist/_browser-chunks/chunk-T36TEMM7.js
168
148
  var store$4, DEFAULT_CONFIG = {
169
149
  lang: void 0,
@@ -845,6 +825,20 @@ var __require2 = ((x) => typeof __require < "u" ? __require : typeof Proxy < "u"
845
825
  });
846
826
 
847
827
  // ../../core/dist/shared/open-service/toolsets/docs/public.js
828
+ var ref = getToolName({ transport: "mcp" }), DOCS_TOOLSET_INSTRUCTIONS = `## Documentation Workflow
829
+
830
+ **CRITICAL: Never hallucinate component properties!** Before using ANY property on a component (even common-sounding ones like \`shadow\`), you MUST verify it is documented via these tools. If it is not documented, it does not exist \u2014 never assume props from naming conventions or other libraries; report it to the user instead.
831
+
832
+ 1. Call **${ref("docs.list")}** once at the start of the task to discover available component and docs IDs.
833
+ 2. Call **${ref("docs.show")}** with an \`id\` from that list to retrieve full component docs, props, usage examples, and stories.
834
+ 3. Call **${ref("docs.showStory")}** for extra docs on a story variant not covered by the component docs.
835
+
836
+ Only use properties explicitly documented or shown in example stories. Only reference IDs returned by these tools; never guess IDs.
837
+
838
+ ## Multi-Source Requests
839
+
840
+ - With multiple sources configured, **${ref("docs.list")}** returns entries from every source; pass \`storybookId\` to **${ref("docs.show")}** to scope one.
841
+ `;
848
842
  function emptyManifests() {
849
843
  return { componentManifest: { v: 1, components: {} } };
850
844
  }
@@ -1348,8 +1342,8 @@ async function fetchManifests(request, manifestProvider, source) {
1348
1342
  });
1349
1343
  return { componentManifest, docsManifest };
1350
1344
  }
1351
- function parseManifestRef(ref) {
1352
- let [filePath = "", hash = ""] = ref.split("#"), manifestDir = COMPONENT_MANIFEST_PATH.replace(/^\.\//, "").replace(/[^/]+$/, ""), resolved = new URL(filePath, `https://localhost/${manifestDir}`).pathname.replace(
1345
+ function parseManifestRef(ref2) {
1346
+ let [filePath = "", hash = ""] = ref2.split("#"), manifestDir = COMPONENT_MANIFEST_PATH.replace(/^\.\//, "").replace(/[^/]+$/, ""), resolved = new URL(filePath, `https://localhost/${manifestDir}`).pathname.replace(
1353
1347
  /^\//,
1354
1348
  ""
1355
1349
  ), pointer = hash.split("/").filter(Boolean).map((segment) => segment.replace(/~1/g, "/").replace(/~0/g, "~"));
@@ -1373,13 +1367,13 @@ var jsonObject = (schema) => pipe(
1373
1367
  ), MdxRefPayload = jsonObject(
1374
1368
  looseObject({ id: optional(string()), name: optional(string()) })
1375
1369
  );
1376
- async function fetchRefValue(ref, request, provider, source, schema) {
1377
- let { path, pointer } = parseManifestRef(ref), jsonString = await provider(request, path, source), target;
1370
+ async function fetchRefValue(ref2, request, provider, source, schema) {
1371
+ let { path, pointer } = parseManifestRef(ref2), jsonString = await provider(request, path, source), target;
1378
1372
  try {
1379
1373
  target = JSON.parse(jsonString);
1380
1374
  } catch (error) {
1381
1375
  throw new ManifestGetError(
1382
- `Failed to parse externalized payload referenced by "${ref}"`,
1376
+ `Failed to parse externalized payload referenced by "${ref2}"`,
1383
1377
  path,
1384
1378
  error instanceof Error ? error : void 0
1385
1379
  );
@@ -1389,13 +1383,13 @@ async function fetchRefValue(ref, request, provider, source, schema) {
1389
1383
  target = target[key];
1390
1384
  else
1391
1385
  throw new ManifestGetError(
1392
- `Reference "${ref}" could not be resolved: missing "${key}".`,
1386
+ `Reference "${ref2}" could not be resolved: missing "${key}".`,
1393
1387
  path
1394
1388
  );
1395
1389
  let parsed = safeParse(schema, target);
1396
1390
  if (!parsed.success)
1397
1391
  throw new ManifestGetError(
1398
- `Payload referenced by "${ref}" is not a valid manifest payload.`,
1392
+ `Payload referenced by "${ref2}" is not a valid manifest payload.`,
1399
1393
  path
1400
1394
  );
1401
1395
  return parsed.output;
@@ -1451,10 +1445,10 @@ async function resolveComponentStories(component, request, manifestProvider, sou
1451
1445
  };
1452
1446
  }
1453
1447
  async function resolveDocEntry(doc, request, manifestProvider, source) {
1454
- let ref = "mdx" in doc ? doc.mdx?.$ref : void 0;
1455
- if (!ref)
1448
+ let ref2 = "mdx" in doc ? doc.mdx?.$ref : void 0;
1449
+ if (!ref2)
1456
1450
  return doc;
1457
- let payload = await fetchRefValue(ref, request, manifestProvider ?? defaultManifestProvider, source, MdxRefPayload);
1451
+ let payload = await fetchRefValue(ref2, request, manifestProvider ?? defaultManifestProvider, source, MdxRefPayload);
1458
1452
  return adaptCoreDoc({
1459
1453
  ...payload,
1460
1454
  id: payload.id ?? doc.id,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@storybook/mcp",
3
- "version": "11.0.0-alpha.4",
3
+ "version": "11.0.0-alpha.6",
4
4
  "description": "MCP server that serves knowledge about your components based on your Storybook stories and documentation",
5
5
  "keywords": [
6
6
  "mcp",
@@ -49,7 +49,7 @@
49
49
  "react-docgen": "^8.0.2",
50
50
  "react-docgen-typescript": "^2.4.0",
51
51
  "srvx": "^0.8.16",
52
- "storybook": "11.0.0-alpha.4",
52
+ "storybook": "11.0.0-alpha.6",
53
53
  "tinyexec": "^1.0.2",
54
54
  "typescript": "^6.0.3"
55
55
  },