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

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 +83 -12
  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_ve4nsqf8lo9 from 'node:url';
2
+ import CJS_COMPAT_NODE_PATH_ve4nsqf8lo9 from 'node:path';
3
+ import CJS_COMPAT_NODE_MODULE_ve4nsqf8lo9 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_ve4nsqf8lo9.fileURLToPath(import.meta.url);
6
+ var __dirname = CJS_COMPAT_NODE_PATH_ve4nsqf8lo9.dirname(__filename);
7
+ var require = CJS_COMPAT_NODE_MODULE_ve4nsqf8lo9.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.3",
28
28
  description: "MCP server that serves knowledge about your components based on your Storybook stories and documentation",
29
29
  keywords: [
30
30
  "mcp",
@@ -154,7 +154,7 @@ Only use properties explicitly documented or shown in example stories. Only refe
154
154
  }
155
155
  var DOCS_TOOLSET_INSTRUCTIONS = getDocsToolsetInstructions("mcp");
156
156
 
157
- // ../../core/dist/_browser-chunks/chunk-FMAVANLQ.js
157
+ // ../../core/dist/_browser-chunks/chunk-T36TEMM7.js
158
158
  var store$4, DEFAULT_CONFIG = {
159
159
  lang: void 0,
160
160
  message: void 0,
@@ -573,6 +573,77 @@ function record(key, value$1, message$1) {
573
573
  }
574
574
  };
575
575
  }
576
+ function strictObject(entries$1, message$1) {
577
+ return {
578
+ kind: "schema",
579
+ type: "strict_object",
580
+ reference: strictObject,
581
+ expects: "Object",
582
+ async: !1,
583
+ entries: entries$1,
584
+ message: message$1,
585
+ get "~standard"() {
586
+ return _getStandardProps(this);
587
+ },
588
+ "~run"(dataset, config$1) {
589
+ let input = dataset.value;
590
+ if (input && typeof input == "object") {
591
+ dataset.typed = !0, dataset.value = {};
592
+ for (let key in this.entries) {
593
+ let valueSchema = this.entries[key];
594
+ if (key in input || (valueSchema.type === "exact_optional" || valueSchema.type === "optional" || valueSchema.type === "nullish") && valueSchema.default !== void 0) {
595
+ let value$1 = key in input ? input[key] : getDefault(valueSchema), valueDataset = valueSchema["~run"]({ value: value$1 }, config$1);
596
+ if (valueDataset.issues) {
597
+ let pathItem = {
598
+ type: "object",
599
+ origin: "value",
600
+ input,
601
+ key,
602
+ value: value$1
603
+ };
604
+ for (let issue of valueDataset.issues)
605
+ issue.path ? issue.path.unshift(pathItem) : issue.path = [pathItem], dataset.issues?.push(issue);
606
+ if (dataset.issues || (dataset.issues = valueDataset.issues), config$1.abortEarly) {
607
+ dataset.typed = !1;
608
+ break;
609
+ }
610
+ }
611
+ valueDataset.typed || (dataset.typed = !1), dataset.value[key] = valueDataset.value;
612
+ } else if (valueSchema.fallback !== void 0) dataset.value[key] = getFallback(valueSchema);
613
+ else if (valueSchema.type !== "exact_optional" && valueSchema.type !== "optional" && valueSchema.type !== "nullish" && (_addIssue(this, "key", dataset, config$1, {
614
+ input: void 0,
615
+ expected: `"${key}"`,
616
+ path: [{
617
+ type: "object",
618
+ origin: "key",
619
+ input,
620
+ key,
621
+ value: input[key]
622
+ }]
623
+ }), config$1.abortEarly))
624
+ break;
625
+ }
626
+ if (!dataset.issues || !config$1.abortEarly) {
627
+ for (let key in input) if (!(key in this.entries)) {
628
+ _addIssue(this, "key", dataset, config$1, {
629
+ input: key,
630
+ expected: "never",
631
+ path: [{
632
+ type: "object",
633
+ origin: "key",
634
+ input,
635
+ key,
636
+ value: input[key]
637
+ }]
638
+ });
639
+ break;
640
+ }
641
+ }
642
+ } else _addIssue(this, "type", dataset, config$1);
643
+ return dataset;
644
+ }
645
+ };
646
+ }
576
647
  function string(message$1) {
577
648
  return {
578
649
  kind: "schema",
@@ -1617,10 +1688,10 @@ function createDocsToolset(options) {
1617
1688
  let { docsAccess, sources } = options, multiSource = !!sources?.length;
1618
1689
  if (!multiSource && !docsAccess)
1619
1690
  throw new Error("createDocsToolset requires a docsAccess or at least one source.");
1620
- let showSchema = multiSource ? object({
1691
+ let showSchema = multiSource ? strictObject({
1621
1692
  id: pipe(string(), description('The component or docs entry ID (e.g., "button")')),
1622
1693
  ...storybookIdField
1623
- }) : object({
1694
+ }) : strictObject({
1624
1695
  id: pipe(string(), description('The component or docs entry ID (e.g., "button")'))
1625
1696
  }), showStoryFields = {
1626
1697
  storyId: pipe(
@@ -1641,13 +1712,13 @@ function createDocsToolset(options) {
1641
1712
  'The human-readable story name (e.g., "Primary"). Use together with componentId.'
1642
1713
  )
1643
1714
  )
1644
- }, showStorySchema = multiSource ? object({ ...showStoryFields, ...storybookIdField }) : object(showStoryFields), access = (storybookId, ctx2) => multiSource ? selectSource(sources, storybookId, ctx2) : { access: docsAccess };
1715
+ }, showStorySchema = multiSource ? strictObject({ ...showStoryFields, ...storybookIdField }) : strictObject(showStoryFields), access = (storybookId, ctx2) => multiSource ? selectSource(sources, storybookId, ctx2) : { access: docsAccess };
1645
1716
  return {
1646
1717
  id: DOCS_TOOLSET_ID,
1647
1718
  description: "Storybook component and docs documentation.",
1648
1719
  methods: {
1649
1720
  [DOCS_METHOD_NAMES.list]: {
1650
- input: object({
1721
+ input: strictObject({
1651
1722
  withStoryIds: optional(
1652
1723
  pipe(
1653
1724
  boolean(),
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.3",
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.3",
53
53
  "tinyexec": "^1.0.2",
54
54
  "typescript": "^6.0.3"
55
55
  },