@storybook/addon-mcp 0.1.0 → 0.1.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/README.md +2 -1
- package/dist/preset.js +23 -4
- package/package.json +4 -4
package/README.md
CHANGED
|
@@ -15,7 +15,7 @@ The addon provides tools to improve agents' UI development capabilities, retriev
|
|
|
15
15
|
### Installation and Setup
|
|
16
16
|
|
|
17
17
|
> [!NOTE]
|
|
18
|
-
> This addon requires Storybook
|
|
18
|
+
> This addon requires Storybook version 9.1.16 or higher.
|
|
19
19
|
|
|
20
20
|
Use Storybook's CLI to automatically install and configure the addon:
|
|
21
21
|
|
|
@@ -125,6 +125,7 @@ These additional tools are available when the **experimental** component manifes
|
|
|
125
125
|
|
|
126
126
|
**Requirements:**
|
|
127
127
|
|
|
128
|
+
- Storybook version 10.1.0 or higher (currently only available as prereleases, `storybook@next`)
|
|
128
129
|
- React-based framework (`react-vite`, `nextjs-vite`, `nextjs`, `react-webpack5`)
|
|
129
130
|
- Feature flag `features.experimentalComponentsManifest` set to `true` in `.storybook/main.js`
|
|
130
131
|
|
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.1";
|
|
15
15
|
var description = "Help agents automatically write and test stories for your UI components";
|
|
16
16
|
|
|
17
17
|
//#endregion
|
|
@@ -223,21 +223,40 @@ const initializeMCPServer = async (options) => {
|
|
|
223
223
|
transport = new HttpTransport(server, { path: null });
|
|
224
224
|
origin = `http://localhost:${options.port}`;
|
|
225
225
|
logger.debug("MCP server origin:", origin);
|
|
226
|
+
return server;
|
|
226
227
|
};
|
|
227
228
|
/**
|
|
228
229
|
* Vite middleware handler that wraps the MCP handler.
|
|
229
230
|
* This converts Node.js IncomingMessage/ServerResponse to Web API Request/Response.
|
|
230
231
|
*/
|
|
231
232
|
const mcpServerHandler = async (req, res, next, options) => {
|
|
232
|
-
const
|
|
233
|
+
const disableTelemetry = options.disableTelemetry ?? false;
|
|
233
234
|
if (!initialize) initialize = initializeMCPServer(options);
|
|
234
|
-
await initialize;
|
|
235
|
+
const server = await initialize;
|
|
235
236
|
const webRequest = await incomingMessageToWebRequest(req);
|
|
236
237
|
const addonContext = {
|
|
237
238
|
options,
|
|
238
239
|
origin,
|
|
239
240
|
disableTelemetry,
|
|
240
|
-
source: `${origin}/manifests/components.json
|
|
241
|
+
source: `${origin}/manifests/components.json`,
|
|
242
|
+
...!disableTelemetry && {
|
|
243
|
+
onListAllComponents: async ({ manifest }) => {
|
|
244
|
+
await collectTelemetry({
|
|
245
|
+
event: "tool:listAllComponents",
|
|
246
|
+
server,
|
|
247
|
+
componentCount: Object.keys(manifest.components).length
|
|
248
|
+
});
|
|
249
|
+
},
|
|
250
|
+
onGetComponentDocumentation: async ({ input, foundComponents, notFoundIds }) => {
|
|
251
|
+
await collectTelemetry({
|
|
252
|
+
event: "tool:getComponentDocumentation",
|
|
253
|
+
server,
|
|
254
|
+
inputComponentCount: input.componentIds.length,
|
|
255
|
+
foundCount: foundComponents.length,
|
|
256
|
+
notFoundCount: notFoundIds.length
|
|
257
|
+
});
|
|
258
|
+
}
|
|
259
|
+
}
|
|
241
260
|
};
|
|
242
261
|
const response = await transport.respond(webRequest, addonContext);
|
|
243
262
|
if (response) await webResponseToServerResponse(response, res);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@storybook/addon-mcp",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.1",
|
|
4
4
|
"description": "Help agents automatically write and test stories for your UI components",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"storybook-addon",
|
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
"@tmcp/transport-http": "^0.7.0",
|
|
31
31
|
"tmcp": "^1.15.2",
|
|
32
32
|
"valibot": "^1.1.0",
|
|
33
|
-
"@storybook/mcp": "0.0.
|
|
33
|
+
"@storybook/mcp": "0.0.5"
|
|
34
34
|
},
|
|
35
35
|
"devDependencies": {
|
|
36
36
|
"@types/node": "20.19.0",
|
|
@@ -40,10 +40,10 @@
|
|
|
40
40
|
"tsdown": "^0.15.9",
|
|
41
41
|
"typescript": "^5.9.3",
|
|
42
42
|
"vite": "^7.0.5",
|
|
43
|
-
"vitest": "
|
|
43
|
+
"vitest": "3.2.4"
|
|
44
44
|
},
|
|
45
45
|
"peerDependencies": {
|
|
46
|
-
"storybook": "
|
|
46
|
+
"storybook": "^9.1.16 || ^10.0.0"
|
|
47
47
|
},
|
|
48
48
|
"publishConfig": {
|
|
49
49
|
"access": "public"
|