@storybook/mcp 0.6.1 → 0.6.2
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 +2 -0
- package/dist/index.js +9 -4
- package/package.json +5 -5
package/dist/index.d.ts
CHANGED
|
@@ -108,6 +108,7 @@ declare const ComponentManifest: v.ObjectSchema<{
|
|
|
108
108
|
}, undefined>, undefined>, undefined>;
|
|
109
109
|
readonly reactDocgen: v.OptionalSchema<v.AnySchema, undefined>;
|
|
110
110
|
readonly reactDocgenTypescript: v.OptionalSchema<v.AnySchema, undefined>;
|
|
111
|
+
readonly reactComponentMeta: v.OptionalSchema<v.AnySchema, undefined>;
|
|
111
112
|
readonly docs: v.OptionalSchema<v.RecordSchema<v.StringSchema<undefined>, v.ObjectSchema<{
|
|
112
113
|
readonly id: v.StringSchema<undefined>;
|
|
113
114
|
readonly name: v.StringSchema<undefined>;
|
|
@@ -150,6 +151,7 @@ declare const ComponentManifestMap: v.ObjectSchema<{
|
|
|
150
151
|
}, undefined>, undefined>, undefined>;
|
|
151
152
|
readonly reactDocgen: v.OptionalSchema<v.AnySchema, undefined>;
|
|
152
153
|
readonly reactDocgenTypescript: v.OptionalSchema<v.AnySchema, undefined>;
|
|
154
|
+
readonly reactComponentMeta: v.OptionalSchema<v.AnySchema, undefined>;
|
|
153
155
|
readonly docs: v.OptionalSchema<v.RecordSchema<v.StringSchema<undefined>, v.ObjectSchema<{
|
|
154
156
|
readonly id: v.StringSchema<undefined>;
|
|
155
157
|
readonly name: v.StringSchema<undefined>;
|
package/dist/index.js
CHANGED
|
@@ -6,7 +6,7 @@ import * as v from "valibot";
|
|
|
6
6
|
|
|
7
7
|
//#region package.json
|
|
8
8
|
var name = "@storybook/mcp";
|
|
9
|
-
var version = "0.6.
|
|
9
|
+
var version = "0.6.2";
|
|
10
10
|
var description = "MCP server that serves knowledge about your components based on your Storybook stories and documentation";
|
|
11
11
|
|
|
12
12
|
//#endregion
|
|
@@ -50,6 +50,7 @@ const ComponentManifest = v.object({
|
|
|
50
50
|
stories: v.optional(v.array(Story)),
|
|
51
51
|
reactDocgen: v.optional(v.any()),
|
|
52
52
|
reactDocgenTypescript: v.optional(v.any()),
|
|
53
|
+
reactComponentMeta: v.optional(v.any()),
|
|
53
54
|
docs: v.optional(v.record(v.string(), Doc))
|
|
54
55
|
});
|
|
55
56
|
const ComponentManifestMap = v.object({
|
|
@@ -266,8 +267,8 @@ const parseReactDocgen = (reactDocgen) => {
|
|
|
266
267
|
* RDT uses flat type strings (prop.type.name / prop.type.raw) instead of react-docgen's
|
|
267
268
|
* nested tsType structure, so no serialization is needed.
|
|
268
269
|
*/
|
|
269
|
-
const
|
|
270
|
-
const props =
|
|
270
|
+
const parseComponentDocLike = (componentDoc) => {
|
|
271
|
+
const props = componentDoc.props ?? {};
|
|
271
272
|
return { props: Object.fromEntries(Object.entries(props).map(([propName, prop]) => [propName, {
|
|
272
273
|
description: prop.description || void 0,
|
|
273
274
|
type: prop.type?.raw ?? prop.type?.name,
|
|
@@ -275,6 +276,8 @@ const parseReactDocgenTypescript = (reactDocgenTypescript) => {
|
|
|
275
276
|
required: prop.required
|
|
276
277
|
}])) };
|
|
277
278
|
};
|
|
279
|
+
const parseReactDocgenTypescript = (reactDocgenTypescript) => parseComponentDocLike(reactDocgenTypescript);
|
|
280
|
+
const parseReactComponentMeta = (reactComponentMeta) => parseComponentDocLike(reactComponentMeta);
|
|
278
281
|
|
|
279
282
|
//#endregion
|
|
280
283
|
//#region src/utils/dedent.ts
|
|
@@ -381,11 +384,13 @@ function extractSummary(item, maxLength = MAX_SUMMARY_LENGTH) {
|
|
|
381
384
|
if (item.description) return item.description.length > maxLength ? `${item.description.slice(0, maxLength)}...` : item.description;
|
|
382
385
|
}
|
|
383
386
|
/**
|
|
384
|
-
* Extract parsed docgen from a component manifest, preferring reactDocgen over
|
|
387
|
+
* Extract parsed docgen from a component manifest, preferring reactDocgen over
|
|
388
|
+
* reactDocgenTypescript over reactComponentMeta.
|
|
385
389
|
*/
|
|
386
390
|
function getParsedDocgen(componentManifest) {
|
|
387
391
|
if (componentManifest.reactDocgen) return parseReactDocgen(componentManifest.reactDocgen);
|
|
388
392
|
if (componentManifest.reactDocgenTypescript) return parseReactDocgenTypescript(componentManifest.reactDocgenTypescript);
|
|
393
|
+
if (componentManifest.reactComponentMeta) return parseReactComponentMeta(componentManifest.reactComponentMeta);
|
|
389
394
|
}
|
|
390
395
|
/**
|
|
391
396
|
* Formats a story's content (description + code snippet) into markdown.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@storybook/mcp",
|
|
3
|
-
"version": "0.6.
|
|
3
|
+
"version": "0.6.2",
|
|
4
4
|
"description": "MCP server that serves knowledge about your components based on your Storybook stories and documentation",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"mcp",
|
|
@@ -25,13 +25,13 @@
|
|
|
25
25
|
"./package.json": "./package.json"
|
|
26
26
|
},
|
|
27
27
|
"dependencies": {
|
|
28
|
-
"@tmcp/adapter-valibot": "^0.1.
|
|
29
|
-
"@tmcp/transport-http": "^0.8.
|
|
30
|
-
"tmcp": "^1.
|
|
28
|
+
"@tmcp/adapter-valibot": "^0.1.5",
|
|
29
|
+
"@tmcp/transport-http": "^0.8.5",
|
|
30
|
+
"tmcp": "^1.19.3",
|
|
31
31
|
"valibot": "1.2.0"
|
|
32
32
|
},
|
|
33
33
|
"devDependencies": {
|
|
34
|
-
"@tmcp/transport-stdio": "^0.4.
|
|
34
|
+
"@tmcp/transport-stdio": "^0.4.2",
|
|
35
35
|
"react-docgen": "^8.0.2",
|
|
36
36
|
"react-docgen-typescript": "^2.4.0",
|
|
37
37
|
"srvx": "^0.8.16",
|