@storybook/mcp 0.0.6 → 0.0.7-next.0

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
@@ -42,38 +42,56 @@ interface StorybookContext extends Record<string, unknown> {
42
42
  }
43
43
  declare const ComponentManifest: v.ObjectSchema<{
44
44
  readonly id: v.StringSchema<undefined>;
45
- readonly summary: v.ExactOptionalSchema<v.StringSchema<undefined>, undefined>;
46
- readonly examples: v.ExactOptionalSchema<v.ArraySchema<v.ObjectSchema<{
47
- readonly snippet: v.StringSchema<undefined>;
45
+ readonly path: v.StringSchema<undefined>;
46
+ readonly summary: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
47
+ readonly stories: v.OptionalSchema<v.ArraySchema<v.ObjectSchema<{
48
+ readonly snippet: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
48
49
  readonly name: v.StringSchema<undefined>;
49
- readonly description: v.ExactOptionalSchema<v.StringSchema<undefined>, undefined>;
50
- readonly import: v.ExactOptionalSchema<v.StringSchema<undefined>, undefined>;
51
- readonly jsDocTags: v.ExactOptionalSchema<v.RecordSchema<v.StringSchema<undefined>, v.ArraySchema<v.StringSchema<undefined>, undefined>, undefined>, undefined>;
50
+ readonly description: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
51
+ readonly import: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
52
+ readonly jsDocTags: v.OptionalSchema<v.RecordSchema<v.StringSchema<undefined>, v.ArraySchema<v.StringSchema<undefined>, undefined>, undefined>, undefined>;
53
+ readonly error: v.OptionalSchema<v.ObjectSchema<{
54
+ readonly name: v.StringSchema<undefined>;
55
+ readonly message: v.StringSchema<undefined>;
56
+ }, undefined>, undefined>;
52
57
  }, undefined>, undefined>, undefined>;
53
- readonly reactDocgen: v.ExactOptionalSchema<v.CustomSchema<Documentation, undefined>, undefined>;
58
+ readonly reactDocgen: v.OptionalSchema<v.CustomSchema<Documentation, undefined>, undefined>;
54
59
  readonly name: v.StringSchema<undefined>;
55
- readonly description: v.ExactOptionalSchema<v.StringSchema<undefined>, undefined>;
56
- readonly import: v.ExactOptionalSchema<v.StringSchema<undefined>, undefined>;
57
- readonly jsDocTags: v.ExactOptionalSchema<v.RecordSchema<v.StringSchema<undefined>, v.ArraySchema<v.StringSchema<undefined>, undefined>, undefined>, undefined>;
60
+ readonly description: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
61
+ readonly import: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
62
+ readonly jsDocTags: v.OptionalSchema<v.RecordSchema<v.StringSchema<undefined>, v.ArraySchema<v.StringSchema<undefined>, undefined>, undefined>, undefined>;
63
+ readonly error: v.OptionalSchema<v.ObjectSchema<{
64
+ readonly name: v.StringSchema<undefined>;
65
+ readonly message: v.StringSchema<undefined>;
66
+ }, undefined>, undefined>;
58
67
  }, undefined>;
59
68
  type ComponentManifest = v.InferOutput<typeof ComponentManifest>;
60
69
  declare const ComponentManifestMap: v.ObjectSchema<{
61
70
  readonly v: v.NumberSchema<undefined>;
62
71
  readonly components: v.RecordSchema<v.StringSchema<undefined>, v.ObjectSchema<{
63
72
  readonly id: v.StringSchema<undefined>;
64
- readonly summary: v.ExactOptionalSchema<v.StringSchema<undefined>, undefined>;
65
- readonly examples: v.ExactOptionalSchema<v.ArraySchema<v.ObjectSchema<{
66
- readonly snippet: v.StringSchema<undefined>;
73
+ readonly path: v.StringSchema<undefined>;
74
+ readonly summary: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
75
+ readonly stories: v.OptionalSchema<v.ArraySchema<v.ObjectSchema<{
76
+ readonly snippet: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
67
77
  readonly name: v.StringSchema<undefined>;
68
- readonly description: v.ExactOptionalSchema<v.StringSchema<undefined>, undefined>;
69
- readonly import: v.ExactOptionalSchema<v.StringSchema<undefined>, undefined>;
70
- readonly jsDocTags: v.ExactOptionalSchema<v.RecordSchema<v.StringSchema<undefined>, v.ArraySchema<v.StringSchema<undefined>, undefined>, undefined>, undefined>;
78
+ readonly description: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
79
+ readonly import: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
80
+ readonly jsDocTags: v.OptionalSchema<v.RecordSchema<v.StringSchema<undefined>, v.ArraySchema<v.StringSchema<undefined>, undefined>, undefined>, undefined>;
81
+ readonly error: v.OptionalSchema<v.ObjectSchema<{
82
+ readonly name: v.StringSchema<undefined>;
83
+ readonly message: v.StringSchema<undefined>;
84
+ }, undefined>, undefined>;
71
85
  }, undefined>, undefined>, undefined>;
72
- readonly reactDocgen: v.ExactOptionalSchema<v.CustomSchema<Documentation, undefined>, undefined>;
86
+ readonly reactDocgen: v.OptionalSchema<v.CustomSchema<Documentation, undefined>, undefined>;
73
87
  readonly name: v.StringSchema<undefined>;
74
- readonly description: v.ExactOptionalSchema<v.StringSchema<undefined>, undefined>;
75
- readonly import: v.ExactOptionalSchema<v.StringSchema<undefined>, undefined>;
76
- readonly jsDocTags: v.ExactOptionalSchema<v.RecordSchema<v.StringSchema<undefined>, v.ArraySchema<v.StringSchema<undefined>, undefined>, undefined>, undefined>;
88
+ readonly description: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
89
+ readonly import: v.OptionalSchema<v.StringSchema<undefined>, undefined>;
90
+ readonly jsDocTags: v.OptionalSchema<v.RecordSchema<v.StringSchema<undefined>, v.ArraySchema<v.StringSchema<undefined>, undefined>, undefined>, undefined>;
91
+ readonly error: v.OptionalSchema<v.ObjectSchema<{
92
+ readonly name: v.StringSchema<undefined>;
93
+ readonly message: v.StringSchema<undefined>;
94
+ }, undefined>, undefined>;
77
95
  }, undefined>, undefined>;
78
96
  }, undefined>;
79
97
  type ComponentManifestMap = v.InferOutput<typeof ComponentManifestMap>;
package/dist/index.js CHANGED
@@ -5,7 +5,7 @@ import * as v from "valibot";
5
5
 
6
6
  //#region package.json
7
7
  var name = "@storybook/mcp";
8
- var version = "0.0.6";
8
+ var version = "0.0.7-next.0";
9
9
  var description = "MCP server that serves knowledge about your components based on your Storybook stories and documentation";
10
10
 
11
11
  //#endregion
@@ -13,20 +13,25 @@ var description = "MCP server that serves knowledge about your components based
13
13
  const JSDocTag = v.record(v.string(), v.array(v.string()));
14
14
  const BaseManifest = v.object({
15
15
  name: v.string(),
16
- description: v.exactOptional(v.string()),
17
- import: v.exactOptional(v.string()),
18
- jsDocTags: v.exactOptional(JSDocTag)
16
+ description: v.optional(v.string()),
17
+ import: v.optional(v.string()),
18
+ jsDocTags: v.optional(JSDocTag),
19
+ error: v.optional(v.object({
20
+ name: v.string(),
21
+ message: v.string()
22
+ }))
19
23
  });
20
- const Example = v.object({
24
+ const Story = v.object({
21
25
  ...BaseManifest.entries,
22
- snippet: v.string()
26
+ snippet: v.optional(v.string())
23
27
  });
24
28
  const ComponentManifest = v.object({
25
29
  ...BaseManifest.entries,
26
30
  id: v.string(),
27
- summary: v.exactOptional(v.string()),
28
- examples: v.exactOptional(v.array(Example)),
29
- reactDocgen: v.exactOptional(v.custom(() => true))
31
+ path: v.string(),
32
+ summary: v.optional(v.string()),
33
+ stories: v.optional(v.array(Story)),
34
+ reactDocgen: v.optional(v.custom(() => true))
30
35
  });
31
36
  const ComponentManifestMap = v.object({
32
37
  v: v.number(),
@@ -183,20 +188,21 @@ function formatComponentManifest(componentManifest) {
183
188
  if (componentManifest.description) parts.push(dedent`<description>
184
189
  ${componentManifest.description}
185
190
  </description>`);
186
- if (componentManifest.examples && componentManifest.examples.length > 0) for (const example of componentManifest.examples) {
187
- const exampleParts = [];
188
- exampleParts.push(dedent`<example>
189
- <example_name>${example.name.replace(/([A-Z])/g, " $1").trim()}</example_name>`);
190
- if (example.description) exampleParts.push(dedent`<example_description>
191
- ${example.description}
192
- </example_description>`);
193
- exampleParts.push("<example_code>");
194
- const importStatement = example.import || componentManifest.import;
195
- if (importStatement) exampleParts.push(`${importStatement}\n`);
196
- exampleParts.push(dedent`${example.snippet}
197
- </example_code>
198
- </example>`);
199
- parts.push(exampleParts.join("\n"));
191
+ if (componentManifest.stories && componentManifest.stories.length > 0) for (const story of componentManifest.stories) {
192
+ if (!story.snippet) continue;
193
+ const storyParts = [];
194
+ storyParts.push(dedent`<story>
195
+ <story_name>${story.name.replace(/([A-Z])/g, " $1").trim()}</story_name>`);
196
+ if (story.description) storyParts.push(dedent`<story_description>
197
+ ${story.description}
198
+ </story_description>`);
199
+ storyParts.push("<story_code>");
200
+ const importStatement = story.import || componentManifest.import;
201
+ if (importStatement) storyParts.push(`${importStatement}\n`);
202
+ storyParts.push(dedent`${story.snippet}
203
+ </story_code>
204
+ </story>`);
205
+ parts.push(storyParts.join("\n"));
200
206
  }
201
207
  if (componentManifest.reactDocgen) {
202
208
  const parsedDocgen = parseReactDocgen(componentManifest.reactDocgen);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@storybook/mcp",
3
- "version": "0.0.6",
3
+ "version": "0.0.7-next.0",
4
4
  "description": "MCP server that serves knowledge about your components based on your Storybook stories and documentation",
5
5
  "keywords": [
6
6
  "storybook",
@@ -8,8 +8,7 @@
8
8
  ],
9
9
  "homepage": "https://github.com/storybookjs/mcp/blob/main/packages/mcp/README.md",
10
10
  "repository": {
11
- "type": "git",
12
- "url": "https://github.com/storybookjs/mcp.git",
11
+ "url": "git+https://github.com/storybookjs/mcp.git",
13
12
  "directory": "packages/mcp"
14
13
  },
15
14
  "license": "MIT",
@@ -36,17 +35,19 @@
36
35
  "@tsconfig/node24": "^24.0.1",
37
36
  "@types/node": "20.19.0",
38
37
  "@vitest/coverage-v8": "3.2.4",
38
+ "publint": "0.3.15",
39
39
  "react-docgen": "^8.0.2",
40
40
  "srvx": "^0.8.16",
41
- "tsdown": "^0.15.9",
41
+ "tsdown": "^0.15.12",
42
42
  "typescript": "^5.9.3",
43
43
  "vitest": "3.2.4"
44
44
  },
45
45
  "scripts": {
46
46
  "build": "tsdown",
47
47
  "dev": "node --watch ./serve.ts",
48
- "test": "vitest",
49
48
  "inspect": "mcp-inspector --config ../../.mcp.inspect.json --server storybook-mcp",
49
+ "publint": "publint",
50
+ "test": "vitest",
50
51
  "typecheck": "tsc --noEmit"
51
52
  }
52
53
  }