@storybook/addon-mcp 0.0.7 → 0.0.8
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 +10 -2
- package/package.json +3 -2
package/dist/preset.js
CHANGED
|
@@ -6,11 +6,12 @@ import { storyNameFromExport } from "storybook/internal/csf";
|
|
|
6
6
|
import { logger } from "storybook/internal/node-logger";
|
|
7
7
|
import * as v from "valibot";
|
|
8
8
|
import { telemetry } from "storybook/internal/telemetry";
|
|
9
|
+
import { addGetComponentDocumentationTool, addListAllComponentsTool } from "@storybook/mcp";
|
|
9
10
|
import { buffer } from "node:stream/consumers";
|
|
10
11
|
|
|
11
12
|
//#region package.json
|
|
12
13
|
var name = "@storybook/addon-mcp";
|
|
13
|
-
var version = "0.0.
|
|
14
|
+
var version = "0.0.8";
|
|
14
15
|
var description = "Help agents automatically write and test stories for your UI components";
|
|
15
16
|
|
|
16
17
|
//#endregion
|
|
@@ -213,6 +214,12 @@ const initializeMCPServer = async (options) => {
|
|
|
213
214
|
});
|
|
214
215
|
await addGetStoryUrlsTool(server);
|
|
215
216
|
await addGetUIBuildingInstructionsTool(server);
|
|
217
|
+
const [features, componentManifestGenerator] = await Promise.all([options.presets.apply("features"), options.presets.apply("experimental_componentManifestGenerator")]);
|
|
218
|
+
if (features.experimentalComponentsManifest && componentManifestGenerator) {
|
|
219
|
+
logger.info("Experimental components manifest feature detected - registering component tools");
|
|
220
|
+
await addListAllComponentsTool(server);
|
|
221
|
+
await addGetComponentDocumentationTool(server);
|
|
222
|
+
}
|
|
216
223
|
transport = new HttpTransport(server, { path: null });
|
|
217
224
|
origin = `http://localhost:${options.port}`;
|
|
218
225
|
logger.debug("MCP server origin:", origin);
|
|
@@ -229,7 +236,8 @@ const mcpServerHandler = async (req, res, next, options) => {
|
|
|
229
236
|
const addonContext = {
|
|
230
237
|
options,
|
|
231
238
|
origin,
|
|
232
|
-
disableTelemetry
|
|
239
|
+
disableTelemetry,
|
|
240
|
+
source: `${origin}/manifests/components.json`
|
|
233
241
|
};
|
|
234
242
|
const response = await transport.respond(webRequest, addonContext);
|
|
235
243
|
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.0.
|
|
3
|
+
"version": "0.0.8",
|
|
4
4
|
"description": "Help agents automatically write and test stories for your UI components",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"storybook-addon",
|
|
@@ -29,7 +29,8 @@
|
|
|
29
29
|
"@tmcp/adapter-valibot": "^0.1.4",
|
|
30
30
|
"@tmcp/transport-http": "^0.7.0",
|
|
31
31
|
"tmcp": "^1.15.2",
|
|
32
|
-
"valibot": "^1.1.0"
|
|
32
|
+
"valibot": "^1.1.0",
|
|
33
|
+
"@storybook/mcp": "0.0.3"
|
|
33
34
|
},
|
|
34
35
|
"devDependencies": {
|
|
35
36
|
"@types/node": "20.19.0",
|