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

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.
Files changed (2) hide show
  1. package/dist/index.js +96 -15
  2. package/package.json +2 -2
package/dist/index.js CHANGED
@@ -1,10 +1,10 @@
1
- import CJS_COMPAT_NODE_URL_wv85m4giz1 from 'node:url';
2
- import CJS_COMPAT_NODE_PATH_wv85m4giz1 from 'node:path';
3
- import CJS_COMPAT_NODE_MODULE_wv85m4giz1 from "node:module";
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";
4
4
 
5
- var __filename = CJS_COMPAT_NODE_URL_wv85m4giz1.fileURLToPath(import.meta.url);
6
- var __dirname = CJS_COMPAT_NODE_PATH_wv85m4giz1.dirname(__filename);
7
- var require = CJS_COMPAT_NODE_MODULE_wv85m4giz1.createRequire(import.meta.url);
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);
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.2",
27
+ version: "11.0.0-alpha.4",
28
28
  description: "MCP server that serves knowledge about your components based on your Storybook stories and documentation",
29
29
  keywords: [
30
30
  "mcp",
@@ -129,7 +129,17 @@ function getToolName(context) {
129
129
  };
130
130
  }
131
131
 
132
- // ../../core/dist/_browser-chunks/chunk-PMPHKUPK.js
132
+ // ../../core/dist/_browser-chunks/chunk-7OC3MZ62.js
133
+ function defineToolset(definition) {
134
+ for (let [methodName, method] of Object.entries(definition.methods)) {
135
+ let input = method.input;
136
+ if (input["~standard"].vendor === "valibot" && input.type !== "strict_object")
137
+ throw new Error(
138
+ `Toolset method "${definition.id}.${methodName}" must declare its input with v.strictObject, got a valibot "${String(input.type)}" schema. Undeclared arguments would otherwise be silently dropped or passed through instead of rejected.`
139
+ );
140
+ }
141
+ return definition;
142
+ }
133
143
  function resolveToolsetDescription(description3, context) {
134
144
  return typeof description3 == "function" ? description3(context) : description3;
135
145
  }
@@ -154,7 +164,7 @@ Only use properties explicitly documented or shown in example stories. Only refe
154
164
  }
155
165
  var DOCS_TOOLSET_INSTRUCTIONS = getDocsToolsetInstructions("mcp");
156
166
 
157
- // ../../core/dist/_browser-chunks/chunk-FMAVANLQ.js
167
+ // ../../core/dist/_browser-chunks/chunk-T36TEMM7.js
158
168
  var store$4, DEFAULT_CONFIG = {
159
169
  lang: void 0,
160
170
  message: void 0,
@@ -573,6 +583,77 @@ function record(key, value$1, message$1) {
573
583
  }
574
584
  };
575
585
  }
586
+ function strictObject(entries$1, message$1) {
587
+ return {
588
+ kind: "schema",
589
+ type: "strict_object",
590
+ reference: strictObject,
591
+ expects: "Object",
592
+ async: !1,
593
+ entries: entries$1,
594
+ message: message$1,
595
+ get "~standard"() {
596
+ return _getStandardProps(this);
597
+ },
598
+ "~run"(dataset, config$1) {
599
+ let input = dataset.value;
600
+ if (input && typeof input == "object") {
601
+ dataset.typed = !0, dataset.value = {};
602
+ for (let key in this.entries) {
603
+ let valueSchema = this.entries[key];
604
+ if (key in input || (valueSchema.type === "exact_optional" || valueSchema.type === "optional" || valueSchema.type === "nullish") && valueSchema.default !== void 0) {
605
+ let value$1 = key in input ? input[key] : getDefault(valueSchema), valueDataset = valueSchema["~run"]({ value: value$1 }, config$1);
606
+ if (valueDataset.issues) {
607
+ let pathItem = {
608
+ type: "object",
609
+ origin: "value",
610
+ input,
611
+ key,
612
+ value: value$1
613
+ };
614
+ for (let issue of valueDataset.issues)
615
+ issue.path ? issue.path.unshift(pathItem) : issue.path = [pathItem], dataset.issues?.push(issue);
616
+ if (dataset.issues || (dataset.issues = valueDataset.issues), config$1.abortEarly) {
617
+ dataset.typed = !1;
618
+ break;
619
+ }
620
+ }
621
+ valueDataset.typed || (dataset.typed = !1), dataset.value[key] = valueDataset.value;
622
+ } else if (valueSchema.fallback !== void 0) dataset.value[key] = getFallback(valueSchema);
623
+ else if (valueSchema.type !== "exact_optional" && valueSchema.type !== "optional" && valueSchema.type !== "nullish" && (_addIssue(this, "key", dataset, config$1, {
624
+ input: void 0,
625
+ expected: `"${key}"`,
626
+ path: [{
627
+ type: "object",
628
+ origin: "key",
629
+ input,
630
+ key,
631
+ value: input[key]
632
+ }]
633
+ }), config$1.abortEarly))
634
+ break;
635
+ }
636
+ if (!dataset.issues || !config$1.abortEarly) {
637
+ for (let key in input) if (!(key in this.entries)) {
638
+ _addIssue(this, "key", dataset, config$1, {
639
+ input: key,
640
+ expected: "never",
641
+ path: [{
642
+ type: "object",
643
+ origin: "key",
644
+ input,
645
+ key,
646
+ value: input[key]
647
+ }]
648
+ });
649
+ break;
650
+ }
651
+ }
652
+ } else _addIssue(this, "type", dataset, config$1);
653
+ return dataset;
654
+ }
655
+ };
656
+ }
576
657
  function string(message$1) {
577
658
  return {
578
659
  kind: "schema",
@@ -1617,10 +1698,10 @@ function createDocsToolset(options) {
1617
1698
  let { docsAccess, sources } = options, multiSource = !!sources?.length;
1618
1699
  if (!multiSource && !docsAccess)
1619
1700
  throw new Error("createDocsToolset requires a docsAccess or at least one source.");
1620
- let showSchema = multiSource ? object({
1701
+ let showSchema = multiSource ? strictObject({
1621
1702
  id: pipe(string(), description('The component or docs entry ID (e.g., "button")')),
1622
1703
  ...storybookIdField
1623
- }) : object({
1704
+ }) : strictObject({
1624
1705
  id: pipe(string(), description('The component or docs entry ID (e.g., "button")'))
1625
1706
  }), showStoryFields = {
1626
1707
  storyId: pipe(
@@ -1641,13 +1722,13 @@ function createDocsToolset(options) {
1641
1722
  'The human-readable story name (e.g., "Primary"). Use together with componentId.'
1642
1723
  )
1643
1724
  )
1644
- }, showStorySchema = multiSource ? object({ ...showStoryFields, ...storybookIdField }) : object(showStoryFields), access = (storybookId, ctx2) => multiSource ? selectSource(sources, storybookId, ctx2) : { access: docsAccess };
1645
- return {
1725
+ }, showStorySchema = multiSource ? strictObject({ ...showStoryFields, ...storybookIdField }) : strictObject(showStoryFields), access = (storybookId, ctx2) => multiSource ? selectSource(sources, storybookId, ctx2) : { access: docsAccess };
1726
+ return defineToolset({
1646
1727
  id: DOCS_TOOLSET_ID,
1647
1728
  description: "Storybook component and docs documentation.",
1648
1729
  methods: {
1649
1730
  [DOCS_METHOD_NAMES.list]: {
1650
- input: object({
1731
+ input: strictObject({
1651
1732
  withStoryIds: optional(
1652
1733
  pipe(
1653
1734
  boolean(),
@@ -1711,7 +1792,7 @@ function createDocsToolset(options) {
1711
1792
  }
1712
1793
  }
1713
1794
  }
1714
- };
1795
+ });
1715
1796
  }
1716
1797
 
1717
1798
  // src/utils/error-to-mcp-content.ts
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@storybook/mcp",
3
- "version": "11.0.0-alpha.2",
3
+ "version": "11.0.0-alpha.4",
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.2",
52
+ "storybook": "11.0.0-alpha.4",
53
53
  "tinyexec": "^1.0.2",
54
54
  "typescript": "^6.0.3"
55
55
  },