@storybook/addon-mcp 0.2.1 → 0.2.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/preset.js CHANGED
@@ -14,7 +14,7 @@ import { buffer } from "node:stream/consumers";
14
14
 
15
15
  //#region package.json
16
16
  var name = "@storybook/addon-mcp";
17
- var version = "0.2.1";
17
+ var version = "0.2.2";
18
18
  var description = "Help agents automatically write and test stories for your UI components";
19
19
 
20
20
  //#endregion
@@ -228,6 +228,16 @@ const StoryInputArray = v.array(StoryInput);
228
228
  //#region src/tools/preview-stories/preview-stories-app-template.html
229
229
  var preview_stories_app_template_default = "<!doctype html>\n<html>\n <head>\n <meta charset=\"utf-8\" />\n <meta name=\"viewport\" content=\"width=device-width, initial-scale=1\" />\n <style>\n * {\n margin: 0;\n padding: 0;\n box-sizing: border-box;\n }\n html[data-theme='light'] {\n color-scheme: light;\n }\n html[data-theme='dark'] {\n color-scheme: dark;\n }\n html,\n body {\n width: 100%;\n margin: 0;\n padding: 0;\n background-color: var(--color-background-secondary);\n }\n body {\n display: flex;\n flex-direction: column;\n gap: 1rem;\n }\n :root {\n /*\n These are fallback values, if the MCP client doesn't set them.\n See https://github.com/modelcontextprotocol/ext-apps/blob/main/specification/draft/apps.mdx#theming\n */\n --color-text-primary: light-dark(black, white);\n --color-border-primary: light-dark(#ccc, #444);\n --color-background-secondary: light-dark(#f9f9f9, #1e1e1e);\n --font-sans:\n -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Oxygen-Sans',\n Ubuntu, Cantarell, 'Helvetica Neue', sans-serif;\n --font-heading-xs-size: 1rem;\n --font-heading-xs-line-height: 1.25;\n --border-width-regular: 1px;\n }\n .story-heading {\n font-family: var(--font-sans);\n font-size: var(--font-heading-xs-size);\n line-height: var(--font-heading-xs-line-height);\n color: var(--color-text-primary);\n padding: 0.5rem 0;\n }\n .story-iframe {\n background-color: white;\n border: var(--border-width-regular) solid var(--color-border-primary);\n }\n body:has(> article:only-child) h1 {\n /* if there is only one story rendered, hide its heading */\n display: none;\n }\n </style>\n <template id=\"preview-template\">\n <article>\n <h1 class=\"story-heading\"></h1>\n <iframe class=\"story-iframe\"></iframe>\n </article>\n </template>\n <script type=\"module\">\n // APP_SCRIPT_PLACEHOLDER\n <\/script>\n </head>\n <body></body>\n</html>\n";
230
230
 
231
+ //#endregion
232
+ //#region src/utils/slash.ts
233
+ /**
234
+ * Normalize paths to forward slashes for cross-platform compatibility
235
+ * Storybook import paths always use forward slashes
236
+ */
237
+ function slash(path$1) {
238
+ return path$1.replace(/\\/g, "/");
239
+ }
240
+
231
241
  //#endregion
232
242
  //#region src/tools/preview-stories.ts
233
243
  const PREVIEW_STORIES_TOOL_NAME = "preview-stories";
@@ -285,7 +295,9 @@ async function addPreviewStoriesTool(server) {
285
295
  const textResult = [];
286
296
  for (const inputParams of input.stories) {
287
297
  const { exportName, explicitStoryName, absoluteStoryPath } = inputParams;
288
- const relativePath = `./${path.relative(process.cwd(), absoluteStoryPath)}`;
298
+ const normalizedCwd = slash(process.cwd());
299
+ const normalizedAbsolutePath = slash(absoluteStoryPath);
300
+ const relativePath = `./${path.posix.relative(normalizedCwd, normalizedAbsolutePath)}`;
289
301
  logger.debug("Searching for:");
290
302
  logger.debug({
291
303
  exportName,
@@ -4,7 +4,7 @@ const MCP_APP_SIZE_CHANGED_EVENT = "storybook-mcp:size-changed";
4
4
 
5
5
  //#endregion
6
6
  //#region package.json
7
- var version = "0.2.1";
7
+ var version = "0.2.2";
8
8
 
9
9
  //#endregion
10
10
  //#region src/tools/preview-stories/preview-stories-app-script.ts
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@storybook/addon-mcp",
3
- "version": "0.2.1",
3
+ "version": "0.2.2",
4
4
  "description": "Help agents automatically write and test stories for your UI components",
5
5
  "keywords": [
6
6
  "storybook-addon",