@storybook/addon-mcp 0.1.3 → 0.1.4-next.1
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 +7 -94
- package/package.json +4 -4
package/dist/preset.js
CHANGED
|
@@ -11,7 +11,7 @@ import { buffer } from "node:stream/consumers";
|
|
|
11
11
|
|
|
12
12
|
//#region package.json
|
|
13
13
|
var name = "@storybook/addon-mcp";
|
|
14
|
-
var version = "0.1.
|
|
14
|
+
var version = "0.1.4-next.1";
|
|
15
15
|
var description = "Help agents automatically write and test stories for your UI components";
|
|
16
16
|
|
|
17
17
|
//#endregion
|
|
@@ -325,6 +325,10 @@ function getToolsets(request, addonOptions) {
|
|
|
325
325
|
return toolsets;
|
|
326
326
|
}
|
|
327
327
|
|
|
328
|
+
//#endregion
|
|
329
|
+
//#region src/template.html
|
|
330
|
+
var template_default = "<!doctype html>\n<html>\n <head>\n {{REDIRECT_META}}\n <style>\n @font-face {\n font-family: 'Nunito Sans';\n font-style: normal;\n font-weight: 400;\n font-display: swap;\n src: url('./sb-common-assets/nunito-sans-regular.woff2') format('woff2');\n }\n\n * {\n margin: 0;\n padding: 0;\n box-sizing: border-box;\n }\n\n html,\n body {\n height: 100%;\n font-family:\n 'Nunito Sans',\n -apple-system,\n BlinkMacSystemFont,\n 'Segoe UI',\n Roboto,\n Oxygen,\n Ubuntu,\n Cantarell,\n sans-serif;\n }\n\n body {\n display: flex;\n flex-direction: column;\n justify-content: center;\n align-items: center;\n text-align: center;\n padding: 2rem;\n background-color: #ffffff;\n color: rgb(46, 52, 56);\n line-height: 1.6;\n }\n\n p {\n margin-bottom: 1rem;\n }\n\n code {\n font-family: 'Monaco', 'Courier New', monospace;\n background: #f5f5f5;\n padding: 0.2em 0.4em;\n border-radius: 3px;\n }\n\n a {\n color: #1ea7fd;\n }\n\n @media (prefers-color-scheme: dark) {\n body {\n background-color: rgb(34, 36, 37);\n color: rgb(201, 205, 207);\n }\n\n code {\n background: rgba(255, 255, 255, 0.1);\n }\n }\n </style>\n </head>\n <body>\n <div>\n <p>\n Storybook MCP server successfully running via\n <code>@storybook/addon-mcp</code>.\n </p>\n <p>\n See how to connect to it from your coding agent in\n <a\n target=\"_blank\"\n href=\"https://github.com/storybookjs/mcp/tree/main/packages/addon-mcp#configuring-your-agent\"\n >the addon's README</a\n >.\n </p>\n <p id=\"redirect-message\">\n Automatically redirecting to\n <a href=\"/manifests/components.html\">component manifest</a>\n in <span id=\"countdown\">10</span> seconds...\n </p>\n </div>\n <script>\n let countdown = 10;\n const countdownElement = document.getElementById('countdown');\n if (countdownElement) {\n setInterval(() => {\n countdown -= 1;\n countdownElement.textContent = countdown.toString();\n }, 1000);\n }\n <\/script>\n </body>\n</html>\n";
|
|
331
|
+
|
|
328
332
|
//#endregion
|
|
329
333
|
//#region src/preset.ts
|
|
330
334
|
const experimental_devServer = async (app, options) => {
|
|
@@ -340,99 +344,8 @@ const experimental_devServer = async (app, options) => {
|
|
|
340
344
|
app.get("/mcp", async (req, res) => {
|
|
341
345
|
if ((req.headers["accept"] || "").includes("text/html")) {
|
|
342
346
|
res.writeHead(200, { "Content-Type": "text/html" });
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
<html>
|
|
346
|
-
<head>
|
|
347
|
-
${shouldRedirect ? "<meta http-equiv=\"refresh\" content=\"10;url=/manifests/components.html\" />" : ""}
|
|
348
|
-
<style>
|
|
349
|
-
@font-face {
|
|
350
|
-
font-family: 'Nunito Sans';
|
|
351
|
-
font-style: normal;
|
|
352
|
-
font-weight: 400;
|
|
353
|
-
font-display: swap;
|
|
354
|
-
src: url('./sb-common-assets/nunito-sans-regular.woff2') format('woff2');
|
|
355
|
-
}
|
|
356
|
-
|
|
357
|
-
* {
|
|
358
|
-
margin: 0;
|
|
359
|
-
padding: 0;
|
|
360
|
-
box-sizing: border-box;
|
|
361
|
-
}
|
|
362
|
-
|
|
363
|
-
html, body {
|
|
364
|
-
height: 100%;
|
|
365
|
-
font-family: 'Nunito Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
|
|
366
|
-
}
|
|
367
|
-
|
|
368
|
-
body {
|
|
369
|
-
display: flex;
|
|
370
|
-
flex-direction: column;
|
|
371
|
-
justify-content: center;
|
|
372
|
-
align-items: center;
|
|
373
|
-
text-align: center;
|
|
374
|
-
padding: 2rem;
|
|
375
|
-
background-color: #ffffff;
|
|
376
|
-
color: rgb(46, 52, 56);
|
|
377
|
-
line-height: 1.6;
|
|
378
|
-
}
|
|
379
|
-
|
|
380
|
-
p {
|
|
381
|
-
margin-bottom: 1rem;
|
|
382
|
-
}
|
|
383
|
-
|
|
384
|
-
code {
|
|
385
|
-
font-family: 'Monaco', 'Courier New', monospace;
|
|
386
|
-
background: #f5f5f5;
|
|
387
|
-
padding: 0.2em 0.4em;
|
|
388
|
-
border-radius: 3px;
|
|
389
|
-
}
|
|
390
|
-
|
|
391
|
-
a {
|
|
392
|
-
color: #1ea7fd;
|
|
393
|
-
}
|
|
394
|
-
|
|
395
|
-
@media (prefers-color-scheme: dark) {
|
|
396
|
-
body {
|
|
397
|
-
background-color: rgb(34, 36, 37);
|
|
398
|
-
color: rgb(201, 205, 207);
|
|
399
|
-
}
|
|
400
|
-
|
|
401
|
-
code {
|
|
402
|
-
background: rgba(255, 255, 255, 0.1);
|
|
403
|
-
}
|
|
404
|
-
}
|
|
405
|
-
</style>
|
|
406
|
-
</head>
|
|
407
|
-
<body>
|
|
408
|
-
<div>
|
|
409
|
-
<p>
|
|
410
|
-
Storybook MCP server successfully running via
|
|
411
|
-
<code>@storybook/addon-mcp</code>.
|
|
412
|
-
</p>
|
|
413
|
-
<p>
|
|
414
|
-
See how to connect to it from your coding agent in <a target="_blank" href="https://github.com/storybookjs/mcp/tree/main/packages/addon-mcp#configuring-your-agent">the addon's README</a>.
|
|
415
|
-
</p>
|
|
416
|
-
${shouldRedirect ? `
|
|
417
|
-
<p>
|
|
418
|
-
Automatically redirecting to
|
|
419
|
-
<a href="/manifests/components.html">component manifest</a>
|
|
420
|
-
in <span id="countdown">10</span> seconds...
|
|
421
|
-
</p>` : ""}
|
|
422
|
-
</div>
|
|
423
|
-
${shouldRedirect ? `
|
|
424
|
-
<script>
|
|
425
|
-
let countdown = 10;
|
|
426
|
-
const countdownElement = document.getElementById('countdown');
|
|
427
|
-
setInterval(() => {
|
|
428
|
-
countdown -= 1;
|
|
429
|
-
countdownElement.textContent = countdown.toString();
|
|
430
|
-
}, 1000);
|
|
431
|
-
<\/script>
|
|
432
|
-
` : ""}
|
|
433
|
-
</body>
|
|
434
|
-
</html>
|
|
435
|
-
`);
|
|
347
|
+
const html = template_default.replace("{{REDIRECT_META}}", shouldRedirect ? "<meta http-equiv=\"refresh\" content=\"10;url=/manifests/components.html\" />" : "<style>#redirect-message { display: none; }</style>");
|
|
348
|
+
res.end(html);
|
|
436
349
|
} else {
|
|
437
350
|
res.writeHead(200, { "Content-Type": "text/plain" });
|
|
438
351
|
res.end("Storybook MCP server successfully running via @storybook/addon-mcp");
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@storybook/addon-mcp",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.4-next.1",
|
|
4
4
|
"description": "Help agents automatically write and test stories for your UI components",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"storybook-addon",
|
|
@@ -35,15 +35,15 @@
|
|
|
35
35
|
"devDependencies": {
|
|
36
36
|
"@types/node": "20.19.0",
|
|
37
37
|
"@vitest/coverage-v8": "3.2.4",
|
|
38
|
-
"storybook": "
|
|
38
|
+
"storybook": "^10.1.0-alpha.2",
|
|
39
39
|
"ts-dedent": "^2.2.0",
|
|
40
|
-
"tsdown": "^0.15.
|
|
40
|
+
"tsdown": "^0.15.12",
|
|
41
41
|
"typescript": "^5.9.3",
|
|
42
42
|
"vite": "^7.0.5",
|
|
43
43
|
"vitest": "3.2.4"
|
|
44
44
|
},
|
|
45
45
|
"peerDependencies": {
|
|
46
|
-
"storybook": "^9.1.16 || ^10.0.0"
|
|
46
|
+
"storybook": "^9.1.16 || ^10.0.0 || ^10.1.0-0 || ^10.2.0-0 || ^10.3.0-0 || ^10.4.0-0"
|
|
47
47
|
},
|
|
48
48
|
"publishConfig": {
|
|
49
49
|
"access": "public"
|