@adobe/design-data-mcp 1.0.0 → 1.1.0
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 +10 -6
- package/src/cli.js +0 -0
- package/src/tools/design-data.js +7 -3
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@adobe/design-data-mcp",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.1.0",
|
|
4
4
|
"description": "MCP server for Spectrum design tokens and component schemas via the design-data CLI",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./src/index.js",
|
|
@@ -12,9 +12,6 @@
|
|
|
12
12
|
"README.md",
|
|
13
13
|
"LICENSE"
|
|
14
14
|
],
|
|
15
|
-
"scripts": {
|
|
16
|
-
"start": "node src/cli.js"
|
|
17
|
-
},
|
|
18
15
|
"repository": {
|
|
19
16
|
"type": "git",
|
|
20
17
|
"url": "git+https://github.com/adobe/spectrum-design-data.git",
|
|
@@ -32,6 +29,9 @@
|
|
|
32
29
|
"dependencies": {
|
|
33
30
|
"@modelcontextprotocol/sdk": "^1.27.1"
|
|
34
31
|
},
|
|
32
|
+
"devDependencies": {
|
|
33
|
+
"ava": "^6.0.1"
|
|
34
|
+
},
|
|
35
35
|
"engines": {
|
|
36
36
|
"node": ">=20.12.0"
|
|
37
37
|
},
|
|
@@ -43,5 +43,9 @@
|
|
|
43
43
|
"cli"
|
|
44
44
|
],
|
|
45
45
|
"author": "Adobe",
|
|
46
|
-
"license": "Apache-2.0"
|
|
47
|
-
|
|
46
|
+
"license": "Apache-2.0",
|
|
47
|
+
"scripts": {
|
|
48
|
+
"start": "node src/cli.js",
|
|
49
|
+
"test": "ava"
|
|
50
|
+
}
|
|
51
|
+
}
|
package/src/cli.js
CHANGED
|
File without changes
|
package/src/tools/design-data.js
CHANGED
|
@@ -19,6 +19,9 @@
|
|
|
19
19
|
|
|
20
20
|
import { spawnSync } from "child_process";
|
|
21
21
|
|
|
22
|
+
/** npx executable name — .cmd suffix required on Windows without shell: true. */
|
|
23
|
+
const NPX = process.platform === "win32" ? "npx.cmd" : "npx";
|
|
24
|
+
|
|
22
25
|
/**
|
|
23
26
|
* Run `npx -y @adobe/design-data` with the given args and return parsed JSON stdout.
|
|
24
27
|
*
|
|
@@ -30,7 +33,7 @@ import { spawnSync } from "child_process";
|
|
|
30
33
|
* Throws if the process can't start (result.error) or exits non-zero.
|
|
31
34
|
*/
|
|
32
35
|
function runDesignData(args) {
|
|
33
|
-
const result = spawnSync(
|
|
36
|
+
const result = spawnSync(NPX, ["-y", "@adobe/design-data", ...args], {
|
|
34
37
|
encoding: "utf8",
|
|
35
38
|
// Allow up to 30s for first-run install + binary execution.
|
|
36
39
|
timeout: 30_000,
|
|
@@ -126,6 +129,7 @@ export function createDesignDataTools() {
|
|
|
126
129
|
handler({ intent, limit = 5 }) {
|
|
127
130
|
return runDesignData([
|
|
128
131
|
"suggest",
|
|
132
|
+
"--",
|
|
129
133
|
intent,
|
|
130
134
|
"--format",
|
|
131
135
|
"json",
|
|
@@ -157,7 +161,7 @@ export function createDesignDataTools() {
|
|
|
157
161
|
},
|
|
158
162
|
handler({ id }) {
|
|
159
163
|
// component always outputs JSON — no --format flag.
|
|
160
|
-
return runDesignData(["component", id]);
|
|
164
|
+
return runDesignData(["component", "--", id]);
|
|
161
165
|
},
|
|
162
166
|
},
|
|
163
167
|
|
|
@@ -193,7 +197,7 @@ export function createDesignDataTools() {
|
|
|
193
197
|
additionalProperties: false,
|
|
194
198
|
},
|
|
195
199
|
handler({ property, colorScheme, scale, contrast }) {
|
|
196
|
-
const args = ["resolve", property, "--format", "json"];
|
|
200
|
+
const args = ["resolve", "--", property, "--format", "json"];
|
|
197
201
|
if (colorScheme) args.push("--color-scheme", colorScheme);
|
|
198
202
|
if (scale) args.push("--scale", scale);
|
|
199
203
|
if (contrast) args.push("--contrast", contrast);
|