@adobe/design-data-mcp 1.7.44-beta.0 → 1.8.0-beta.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/package.json +3 -2
- package/src/tools/design-data.js +21 -3
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@adobe/design-data-mcp",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.8.0-beta.2",
|
|
4
4
|
"description": "MCP server for Spectrum design tokens, component schemas, and design guidelines (embedded, offline)",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./src/index.js",
|
|
@@ -28,8 +28,9 @@
|
|
|
28
28
|
},
|
|
29
29
|
"dependencies": {
|
|
30
30
|
"@modelcontextprotocol/sdk": "^1.27.1",
|
|
31
|
+
"@adobe/design-data": "3.1.0-beta.0",
|
|
31
32
|
"@adobe/design-data-wasm": "0.9.0",
|
|
32
|
-
"@adobe/spectrum-design-data": "3.3.0-beta.
|
|
33
|
+
"@adobe/spectrum-design-data": "3.3.0-beta.2"
|
|
33
34
|
},
|
|
34
35
|
"devDependencies": {
|
|
35
36
|
"@anthropic-ai/mcpb": "^2.1.2",
|
package/src/tools/design-data.js
CHANGED
|
@@ -20,6 +20,8 @@ import { createRequire } from "module";
|
|
|
20
20
|
import { readFileSync, existsSync } from "fs";
|
|
21
21
|
import { join, dirname, resolve, sep } from "path";
|
|
22
22
|
|
|
23
|
+
import { loadGuideline } from "@adobe/design-data/guideline";
|
|
24
|
+
|
|
23
25
|
import { checkDatasetFreshness } from "../dataset-freshness.js";
|
|
24
26
|
|
|
25
27
|
let _wasm;
|
|
@@ -73,6 +75,24 @@ function loadDataFile(subdir, id) {
|
|
|
73
75
|
`Install it with: pnpm add @adobe/spectrum-design-data`,
|
|
74
76
|
);
|
|
75
77
|
}
|
|
78
|
+
|
|
79
|
+
// Guideline loading (path-traversal guard included) is shared with
|
|
80
|
+
// @adobe/design-data-agent-mcp's describe_guideline tool via
|
|
81
|
+
// @adobe/design-data/guideline — reuse it here instead of duplicating the
|
|
82
|
+
// same containment check.
|
|
83
|
+
if (subdir === "guidelines") {
|
|
84
|
+
try {
|
|
85
|
+
return loadGuideline(resolve(pkgRoot, subdir), id);
|
|
86
|
+
} catch (err) {
|
|
87
|
+
if (err.message.startsWith("Not found:")) {
|
|
88
|
+
throw new Error(
|
|
89
|
+
`${err.message} Call design-data-guideline-list to see available guideline IDs.`,
|
|
90
|
+
);
|
|
91
|
+
}
|
|
92
|
+
throw err;
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
|
|
76
96
|
const baseDir = resolve(pkgRoot, subdir);
|
|
77
97
|
const filePath = resolve(baseDir, `${id}.json`);
|
|
78
98
|
// Containment check: reject any path that escapes the intended subdirectory.
|
|
@@ -82,9 +102,7 @@ function loadDataFile(subdir, id) {
|
|
|
82
102
|
if (!existsSync(filePath)) {
|
|
83
103
|
throw new Error(
|
|
84
104
|
`Not found: "${id}" in ${subdir}/. ` +
|
|
85
|
-
|
|
86
|
-
? `Call design-data-primer to see available component IDs.`
|
|
87
|
-
: `Call design-data-guideline-list to see available guideline IDs.`),
|
|
105
|
+
`Call design-data-primer to see available component IDs.`,
|
|
88
106
|
);
|
|
89
107
|
}
|
|
90
108
|
return JSON.parse(readFileSync(filePath, "utf-8"));
|