@storybook/mcp 11.0.0-alpha.1 → 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.
- package/README.md +1 -1
- package/dist/index.d.ts +3 -3
- package/dist/index.js +129 -35
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -355,7 +355,7 @@ Type:
|
|
|
355
355
|
|
|
356
356
|
Registers [documentation lookup](https://storybook.js.org/docs/next/ai/mcp/overview/#docs-show) by component/docs `id`.
|
|
357
357
|
|
|
358
|
-
When `options.multiSource` is `true`, the tool schema
|
|
358
|
+
When `options.multiSource` is `true`, the tool schema takes an optional `storybookId` input, defaulting to `local`.
|
|
359
359
|
|
|
360
360
|
#### `addGetStoryDocumentationTool`
|
|
361
361
|
|
package/dist/index.d.ts
CHANGED
|
@@ -480,10 +480,10 @@ interface InputType {
|
|
|
480
480
|
/** @see https://storybook.js.org/docs/api/arg-types#type */
|
|
481
481
|
type?: SBType | SBScalarType['name'];
|
|
482
482
|
/**
|
|
483
|
-
*
|
|
484
|
-
*
|
|
483
|
+
* Removed. Set the story value with `args`, or the docs-table text with `table.defaultValue`.
|
|
484
|
+
* The index signature would otherwise still accept this field.
|
|
485
485
|
*/
|
|
486
|
-
defaultValue?:
|
|
486
|
+
defaultValue?: never;
|
|
487
487
|
[key: string]: any;
|
|
488
488
|
}
|
|
489
489
|
interface StrictInputType extends InputType {
|
package/dist/index.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
3
|
-
import
|
|
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 =
|
|
6
|
-
var __dirname =
|
|
7
|
-
var require =
|
|
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.
|
|
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",
|
|
@@ -82,16 +82,16 @@ var package_default = {
|
|
|
82
82
|
}
|
|
83
83
|
};
|
|
84
84
|
|
|
85
|
-
// ../../core/dist/_browser-chunks/chunk-
|
|
85
|
+
// ../../core/dist/_browser-chunks/chunk-IE4ULIOQ.js
|
|
86
86
|
var CASE_SPLIT_PATTERN = new RegExp("\\p{Lu}?\\p{Ll}+|[0-9]+|\\p{Lu}+(?!\\p{Ll})|\\p{Emoji_Presentation}|\\p{Extended_Pictographic}|\\p{L}+", "gu");
|
|
87
87
|
function words(str) {
|
|
88
88
|
return Array.from(str.match(CASE_SPLIT_PATTERN) ?? []);
|
|
89
89
|
}
|
|
90
|
-
|
|
91
|
-
// ../../core/dist/_browser-chunks/chunk-TYQWMAQX.js
|
|
92
90
|
function kebabCase(str) {
|
|
93
91
|
return words(str).map((word) => word.toLowerCase()).join("-");
|
|
94
92
|
}
|
|
93
|
+
|
|
94
|
+
// ../../core/dist/_browser-chunks/chunk-QQVAH3EE.js
|
|
95
95
|
function parseToolsetMethodId(methodId) {
|
|
96
96
|
let separator = methodId.indexOf(".");
|
|
97
97
|
if (separator <= 0 || separator !== methodId.lastIndexOf(".") || separator === methodId.length - 1)
|
|
@@ -129,12 +129,12 @@ function getToolName(context) {
|
|
|
129
129
|
};
|
|
130
130
|
}
|
|
131
131
|
|
|
132
|
-
// ../../core/dist/_browser-chunks/chunk-
|
|
132
|
+
// ../../core/dist/_browser-chunks/chunk-PMPHKUPK.js
|
|
133
133
|
function resolveToolsetDescription(description3, context) {
|
|
134
134
|
return typeof description3 == "function" ? description3(context) : description3;
|
|
135
135
|
}
|
|
136
136
|
|
|
137
|
-
// ../../core/dist/_browser-chunks/chunk-
|
|
137
|
+
// ../../core/dist/_browser-chunks/chunk-DJVLGLRX.js
|
|
138
138
|
function getDocsToolsetInstructions(transport) {
|
|
139
139
|
let ref = getToolName({ transport });
|
|
140
140
|
return `## Documentation Workflow
|
|
@@ -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-
|
|
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",
|
|
@@ -781,7 +852,7 @@ function formatRequiresOwnMcpNotice(source, endpoint, options = {}) {
|
|
|
781
852
|
var RequiresOwnMcpError = class extends Error {
|
|
782
853
|
constructor(source) {
|
|
783
854
|
let endpoint = getSourceMcpEndpoint(source);
|
|
784
|
-
super(
|
|
855
|
+
super(formatRequiresOwnMcpNotice(source, endpoint)), this.name = "RequiresOwnMcpError", this.source = source, this.endpoint = endpoint;
|
|
785
856
|
}
|
|
786
857
|
}, ManifestGetError = class extends Error {
|
|
787
858
|
constructor(message, url, cause) {
|
|
@@ -1196,7 +1267,10 @@ async function defaultManifestProvider(request, path) {
|
|
|
1196
1267
|
throw new ManifestGetError(
|
|
1197
1268
|
"Request is required when using the default manifest provider. You must either pass the original request forward to the server context, or set a custom manifestProvider that doesn't need the request."
|
|
1198
1269
|
);
|
|
1199
|
-
let manifestUrl = getManifestUrlFromRequest(request, path)
|
|
1270
|
+
let manifestUrl = getManifestUrlFromRequest(request, path);
|
|
1271
|
+
return readManifestText(await fetch(manifestUrl), manifestUrl);
|
|
1272
|
+
}
|
|
1273
|
+
async function readManifestText(response, manifestUrl) {
|
|
1200
1274
|
if (!response.ok)
|
|
1201
1275
|
throw new ManifestGetError(
|
|
1202
1276
|
`Failed to fetch manifest: ${response.status} ${response.statusText}`,
|
|
@@ -1501,8 +1575,8 @@ function selectReportedManifests({
|
|
|
1501
1575
|
}) {
|
|
1502
1576
|
return manifests ?? sources?.find((listing) => listing.manifests)?.manifests;
|
|
1503
1577
|
}
|
|
1504
|
-
function resolveShow({ entry, sourceError }) {
|
|
1505
|
-
return sourceError !== void 0 ? { kind: "source-error", message: sourceError } : entry === void 0 ? { kind: "entry-missing" } : { kind: "found", entry };
|
|
1578
|
+
function resolveShow({ entry, sourceError, notice }) {
|
|
1579
|
+
return sourceError !== void 0 ? { kind: "source-error", message: sourceError } : notice !== void 0 ? { kind: "notice", message: notice } : entry === void 0 ? { kind: "entry-missing" } : { kind: "found", entry };
|
|
1506
1580
|
}
|
|
1507
1581
|
function isShowStorySelector({ storyId, componentId, storyName }) {
|
|
1508
1582
|
return storyId !== void 0 || componentId !== void 0 && storyName !== void 0;
|
|
@@ -1512,26 +1586,33 @@ function componentIdOfStoryId(storyId) {
|
|
|
1512
1586
|
return separator === -1 ? storyId : storyId.slice(0, separator);
|
|
1513
1587
|
}
|
|
1514
1588
|
function resolveShowStory(data) {
|
|
1515
|
-
let { entry, storyId, storyName, sourceError } = data;
|
|
1589
|
+
let { entry, storyId, storyName, sourceError, notice } = data;
|
|
1516
1590
|
if (!isShowStorySelector(data))
|
|
1517
1591
|
return { kind: "input-invalid" };
|
|
1518
1592
|
if (sourceError !== void 0)
|
|
1519
1593
|
return { kind: "source-error", message: sourceError };
|
|
1594
|
+
if (notice !== void 0)
|
|
1595
|
+
return { kind: "notice", message: notice };
|
|
1520
1596
|
if (entry === void 0 || entry.kind !== "component")
|
|
1521
1597
|
return { kind: "component-missing" };
|
|
1522
1598
|
let { component } = entry, story = storyId !== void 0 ? component.stories?.find((candidate) => candidate.id === storyId) : component.stories?.find((candidate) => candidate.name === storyName);
|
|
1523
1599
|
return story ? { kind: "found", component, story } : { kind: "story-missing", component };
|
|
1524
1600
|
}
|
|
1525
1601
|
function isDocsShowError(output) {
|
|
1526
|
-
|
|
1602
|
+
let { kind } = resolveShow(output);
|
|
1603
|
+
return kind !== "found" && kind !== "notice";
|
|
1604
|
+
}
|
|
1605
|
+
function isDocsShowStoryError(output) {
|
|
1606
|
+
let { kind } = resolveShowStory(output);
|
|
1607
|
+
return kind !== "found" && kind !== "notice";
|
|
1527
1608
|
}
|
|
1528
1609
|
function describeList(ctx2) {
|
|
1529
|
-
return `List all available UI components and documentation entries from the Storybook, returning the IDs the other documentation tools take as input. Call this first for any UI task \u2014 before writing a new component, check what the design system already provides and build on it instead of hand-rolling a duplicate; before answering any question about props, API, or usage, discover the relevant IDs here rather than reading component source. Then fetch the entries with ${getToolName(ctx2)(DOCS_METHOD_REFS.show)}, referencing only IDs returned here \u2014 never guess IDs. When multiple Storybook sources are configured, entries from every source are included; scope follow-up calls to one source via their
|
|
1610
|
+
return `List all available UI components and documentation entries from the Storybook, returning the IDs the other documentation tools take as input. Call this first for any UI task \u2014 before writing a new component, check what the design system already provides and build on it instead of hand-rolling a duplicate; before answering any question about props, API, or usage, discover the relevant IDs here rather than reading component source. Then fetch the entries with ${getToolName(ctx2)(DOCS_METHOD_REFS.show)}, referencing only IDs returned here \u2014 never guess IDs. When multiple Storybook sources are configured, entries from every source are included; scope follow-up calls to one source via their storybookId input. Pass withStoryIds: true when you need story IDs for other tools.`;
|
|
1530
1611
|
}
|
|
1531
1612
|
function describeShow(ctx2) {
|
|
1532
1613
|
return `Get documentation for a UI component or docs entry.
|
|
1533
1614
|
|
|
1534
|
-
Returns the first ${MAX_STORIES_TO_SHOW} stories (including story IDs) with code snippets showing how props are used, plus TypeScript prop definitions. Call this before using a component to avoid hallucinating prop names, types, or valid combinations, and to answer any question about a component's props, API, or usage \u2014 reading or grepping the component source is not a substitute. Stories reveal real prop usage patterns, interactions, and edge cases that type definitions alone don't show. If the example stories don't show the prop you need, use the ${getToolName(ctx2)(DOCS_METHOD_REFS.showStory)} tool to fetch the story documentation for the specific story variant you need \u2014 its story ID can be passed directly as
|
|
1615
|
+
Returns the first ${MAX_STORIES_TO_SHOW} stories (including story IDs) with code snippets showing how props are used, plus TypeScript prop definitions. Call this before using a component to avoid hallucinating prop names, types, or valid combinations, and to answer any question about a component's props, API, or usage \u2014 reading or grepping the component source is not a substitute. Stories reveal real prop usage patterns, interactions, and edge cases that type definitions alone don't show. If the example stories don't show the prop you need, use the ${getToolName(ctx2)(DOCS_METHOD_REFS.showStory)} tool to fetch the story documentation for the specific story variant you need \u2014 its story ID can be passed directly as storyId.
|
|
1535
1616
|
|
|
1536
1617
|
Example: id="button" returns Primary, Secondary, Large stories with code like <Button variant="primary" size="large"> showing actual prop combinations.`;
|
|
1537
1618
|
}
|
|
@@ -1543,6 +1624,7 @@ function renderShow(data, ctx2) {
|
|
|
1543
1624
|
let resolution = resolveShow(data);
|
|
1544
1625
|
switch (resolution.kind) {
|
|
1545
1626
|
case "source-error":
|
|
1627
|
+
case "notice":
|
|
1546
1628
|
return resolution.message;
|
|
1547
1629
|
case "entry-missing":
|
|
1548
1630
|
return formatEntryNotFound(data.id, data.storybookId, ctx2);
|
|
@@ -1560,6 +1642,7 @@ function renderShowStory(resolution, data, ctx2) {
|
|
|
1560
1642
|
case "input-invalid":
|
|
1561
1643
|
return `Provide either \`storyId\`, or both \`componentId\` and \`storyName\`. Story ids are listed by the ${getToolName(ctx2)(DOCS_METHOD_REFS.list)} tool with \`withStoryIds: true\` and in ${getToolName(ctx2)(DOCS_METHOD_REFS.show)} output.`;
|
|
1562
1644
|
case "source-error":
|
|
1645
|
+
case "notice":
|
|
1563
1646
|
return resolution.message;
|
|
1564
1647
|
case "component-missing":
|
|
1565
1648
|
return data.storyId !== void 0 ? `Story not found: "${data.storyId}". Use the ${getToolName(ctx2)(DOCS_METHOD_REFS.list)} tool with \`withStoryIds: true\` to see available stories and their ids.` : `Component not found: "${data.componentId}". Use the ${getToolName(ctx2)(DOCS_METHOD_REFS.list)} tool to see available components.`;
|
|
@@ -1574,18 +1657,29 @@ function renderShowStory(resolution, data, ctx2) {
|
|
|
1574
1657
|
}
|
|
1575
1658
|
}
|
|
1576
1659
|
var storybookIdField = {
|
|
1577
|
-
storybookId:
|
|
1578
|
-
|
|
1579
|
-
|
|
1660
|
+
storybookId: optional(
|
|
1661
|
+
pipe(
|
|
1662
|
+
string(),
|
|
1663
|
+
description(
|
|
1664
|
+
'The ID of the Storybook source to query (e.g., "local", "design-system"). Defaults to "local", this Storybook.'
|
|
1665
|
+
)
|
|
1666
|
+
),
|
|
1667
|
+
"local"
|
|
1580
1668
|
)
|
|
1581
1669
|
};
|
|
1670
|
+
async function resolveFromSource(access, id) {
|
|
1671
|
+
try {
|
|
1672
|
+
return { entry: await access.resolve(id) };
|
|
1673
|
+
} catch (error) {
|
|
1674
|
+
if (error instanceof RequiresOwnMcpError)
|
|
1675
|
+
return { notice: error.message };
|
|
1676
|
+
throw error;
|
|
1677
|
+
}
|
|
1678
|
+
}
|
|
1582
1679
|
function selectSource(sources, storybookId, ctx2) {
|
|
1583
1680
|
if (!sources?.length)
|
|
1584
1681
|
return {};
|
|
1585
|
-
let available = sources.map(({ source }) => source.id).join(", "), listRef = `Use the ${getToolName(ctx2)(DOCS_METHOD_REFS.list)} tool to see available sources
|
|
1586
|
-
if (!storybookId)
|
|
1587
|
-
return { sourceError: `storybookId is required. Available sources: ${available}. ${listRef}` };
|
|
1588
|
-
let match = sources.find(({ source }) => source.id === storybookId);
|
|
1682
|
+
let available = sources.map(({ source }) => source.id).join(", "), listRef = `Use the ${getToolName(ctx2)(DOCS_METHOD_REFS.list)} tool to see available sources.`, match = sources.find(({ source }) => source.id === storybookId);
|
|
1589
1683
|
return match ? { access: match.access } : {
|
|
1590
1684
|
sourceError: `Storybook source not found: "${storybookId}". Available sources: ${available}. ${listRef}`
|
|
1591
1685
|
};
|
|
@@ -1594,10 +1688,10 @@ function createDocsToolset(options) {
|
|
|
1594
1688
|
let { docsAccess, sources } = options, multiSource = !!sources?.length;
|
|
1595
1689
|
if (!multiSource && !docsAccess)
|
|
1596
1690
|
throw new Error("createDocsToolset requires a docsAccess or at least one source.");
|
|
1597
|
-
let showSchema = multiSource ?
|
|
1691
|
+
let showSchema = multiSource ? strictObject({
|
|
1598
1692
|
id: pipe(string(), description('The component or docs entry ID (e.g., "button")')),
|
|
1599
1693
|
...storybookIdField
|
|
1600
|
-
}) :
|
|
1694
|
+
}) : strictObject({
|
|
1601
1695
|
id: pipe(string(), description('The component or docs entry ID (e.g., "button")'))
|
|
1602
1696
|
}), showStoryFields = {
|
|
1603
1697
|
storyId: pipe(
|
|
@@ -1618,13 +1712,13 @@ function createDocsToolset(options) {
|
|
|
1618
1712
|
'The human-readable story name (e.g., "Primary"). Use together with componentId.'
|
|
1619
1713
|
)
|
|
1620
1714
|
)
|
|
1621
|
-
}, showStorySchema = multiSource ?
|
|
1715
|
+
}, showStorySchema = multiSource ? strictObject({ ...showStoryFields, ...storybookIdField }) : strictObject(showStoryFields), access = (storybookId, ctx2) => multiSource ? selectSource(sources, storybookId, ctx2) : { access: docsAccess };
|
|
1622
1716
|
return {
|
|
1623
1717
|
id: DOCS_TOOLSET_ID,
|
|
1624
1718
|
description: "Storybook component and docs documentation.",
|
|
1625
1719
|
methods: {
|
|
1626
1720
|
[DOCS_METHOD_NAMES.list]: {
|
|
1627
|
-
input:
|
|
1721
|
+
input: strictObject({
|
|
1628
1722
|
withStoryIds: optional(
|
|
1629
1723
|
pipe(
|
|
1630
1724
|
boolean(),
|
|
@@ -1661,7 +1755,7 @@ function createDocsToolset(options) {
|
|
|
1661
1755
|
title: "Get Documentation",
|
|
1662
1756
|
description: describeShow,
|
|
1663
1757
|
handler: async (input, ctx2) => {
|
|
1664
|
-
let { id, storybookId } = input, selected = access(storybookId, ctx2), data = selected.sourceError ? { id, storybookId, sourceError: selected.sourceError } : { id, storybookId,
|
|
1758
|
+
let { id, storybookId } = input, selected = access(storybookId, ctx2), data = selected.sourceError ? { id, storybookId, sourceError: selected.sourceError } : { id, storybookId, ...await resolveFromSource(selected.access, id) }, markdown = renderShow(data, ctx2), telemetry = {
|
|
1665
1759
|
payload: {
|
|
1666
1760
|
componentId: id,
|
|
1667
1761
|
found: data.entry !== void 0,
|
|
@@ -1676,7 +1770,7 @@ function createDocsToolset(options) {
|
|
|
1676
1770
|
title: "Get Documentation for Story",
|
|
1677
1771
|
description: "Get detailed documentation for a specific story variant of a UI component. Use this when you need to see more usage examples of a component, via the stories written for it. Identify the story by its story ID (preferred), or by componentId plus storyName.",
|
|
1678
1772
|
handler: async (input, ctx2) => {
|
|
1679
|
-
let { storyId, componentId, storyName, storybookId } = input, request = { storyId, componentId, storyName, storybookId }, resolveId = storyId !== void 0 ? componentIdOfStoryId(storyId) : componentId !== void 0 && storyName !== void 0 ? componentId : void 0, selected = resolveId !== void 0 ? access(storybookId, ctx2) : {}, data = selected.access && resolveId !== void 0 ? { ...request,
|
|
1773
|
+
let { storyId, componentId, storyName, storybookId } = input, request = { storyId, componentId, storyName, storybookId }, resolveId = storyId !== void 0 ? componentIdOfStoryId(storyId) : componentId !== void 0 && storyName !== void 0 ? componentId : void 0, selected = resolveId !== void 0 ? access(storybookId, ctx2) : {}, data = selected.access && resolveId !== void 0 ? { ...request, ...await resolveFromSource(selected.access, resolveId) } : { ...request, sourceError: selected.sourceError }, resolution = resolveShowStory(data), markdown = renderShowStory(resolution, data, ctx2), telemetry = {
|
|
1680
1774
|
payload: {
|
|
1681
1775
|
found: resolution.kind === "found",
|
|
1682
1776
|
storyId: resolution.kind === "found" ? resolution.story.id : storyId,
|
|
@@ -1684,7 +1778,7 @@ function createDocsToolset(options) {
|
|
|
1684
1778
|
resultTokenCount: estimateTokens(markdown)
|
|
1685
1779
|
}
|
|
1686
1780
|
};
|
|
1687
|
-
return
|
|
1781
|
+
return isDocsShowStoryError(data) ? { ok: !1, data, markdown, telemetry } : { ok: !0, data, markdown, telemetry };
|
|
1688
1782
|
}
|
|
1689
1783
|
}
|
|
1690
1784
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@storybook/mcp",
|
|
3
|
-
"version": "11.0.0-alpha.
|
|
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.
|
|
52
|
+
"storybook": "11.0.0-alpha.3",
|
|
53
53
|
"tinyexec": "^1.0.2",
|
|
54
54
|
"typescript": "^6.0.3"
|
|
55
55
|
},
|