@adobe/spectrum-design-data-mcp 1.1.9 → 1.1.10

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/CHANGELOG.md CHANGED
@@ -1,5 +1,12 @@
1
1
  # [**@adobe/spectrum-design-data-mcp**](https://github.com/adobe/spectrum-design-data-mcp)
2
2
 
3
+ ## 1.1.10
4
+
5
+ ### Patch Changes
6
+
7
+ - Updated dependencies [[`c9002db`](https://github.com/adobe/spectrum-design-data/commit/c9002db2da1d1bb40446b4991648dc7809a55f33)]:
8
+ - @adobe/spectrum-component-api-schemas@6.1.0
9
+
3
10
  ## 1.1.9
4
11
 
5
12
  ### Patch Changes
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@adobe/spectrum-design-data-mcp",
3
- "version": "1.1.9",
3
+ "version": "1.1.10",
4
4
  "description": "Model Context Protocol server for Spectrum design data including tokens, schemas, and component anatomy",
5
5
  "keywords": [
6
6
  "mcp",
@@ -49,7 +49,7 @@
49
49
  "@modelcontextprotocol/sdk": "^1.27.1",
50
50
  "commander": "^13.1.0",
51
51
  "@adobe/spectrum-tokens": "14.7.0",
52
- "@adobe/spectrum-component-api-schemas": "6.0.0"
52
+ "@adobe/spectrum-component-api-schemas": "6.1.0"
53
53
  },
54
54
  "devDependencies": {
55
55
  "ava": "^6.0.1"
@@ -10,7 +10,7 @@ OF ANY KIND, either express or implied. See the License for the specific languag
10
10
  governing permissions and limitations under the License.
11
11
  */
12
12
 
13
- import { readFileSync, readdirSync, statSync } from "fs";
13
+ import { readFileSync, readdirSync } from "fs";
14
14
  import { join, dirname } from "path";
15
15
  import { fileURLToPath } from "url";
16
16
 
@@ -23,83 +23,54 @@ const __dirname = dirname(__filename);
23
23
  */
24
24
  export async function getSchemaData() {
25
25
  try {
26
- // Try to import from the workspace package first
27
- const componentSchemas = await import(
28
- "@adobe/spectrum-component-api-schemas"
29
- );
30
-
31
- // If the package exports schema data directly, use it
32
- if (componentSchemas.default || componentSchemas.schemas) {
33
- return componentSchemas.default || componentSchemas.schemas;
26
+ const { getAllSchemas } =
27
+ await import("@adobe/spectrum-component-api-schemas");
28
+ const schemas = await getAllSchemas();
29
+ const components = {};
30
+ for (const schema of schemas) {
31
+ if (schema.name) {
32
+ components[`${schema.name}.json`] = schema;
33
+ }
34
34
  }
35
-
36
- // Otherwise, read the schema files directly from the package
37
- return await loadSchemaFilesDirectly();
35
+ return { components, types: {} };
38
36
  } catch (error) {
39
37
  console.error(
40
38
  "Failed to load schema data from package, trying direct file access:",
41
39
  error,
42
40
  );
43
- return await loadSchemaFilesDirectly();
41
+ return loadSchemaFilesDirectly();
44
42
  }
45
43
  }
46
44
 
47
45
  /**
48
- * Load schema files directly from the repository structure
49
- * @returns {Promise<Object>} Schema data
46
+ * Load schema files directly from the repository structure (fallback)
47
+ * @returns {Object} Schema data
50
48
  */
51
- async function loadSchemaFilesDirectly() {
52
- const schemaData = {
53
- components: {},
54
- types: {},
55
- };
49
+ function loadSchemaFilesDirectly() {
50
+ const schemaData = { components: {}, types: {} };
56
51
 
57
- // Path to the schemas directory
58
- const schemasPath = join(
52
+ const componentsPath = join(
59
53
  __dirname,
60
- "../../../../packages/component-schemas/schemas",
54
+ "../../../../packages/design-data-spec/components",
61
55
  );
62
56
 
63
- // Load component schemas
64
- const componentsPath = join(schemasPath, "components");
65
57
  try {
66
- const componentFiles = readdirSync(componentsPath).filter((file) =>
67
- file.endsWith(".json"),
58
+ const componentFiles = readdirSync(componentsPath).filter((f) =>
59
+ f.endsWith(".json"),
68
60
  );
69
-
70
61
  for (const fileName of componentFiles) {
71
62
  try {
72
- const filePath = join(componentsPath, fileName);
73
- const fileContent = readFileSync(filePath, "utf8");
74
- schemaData.components[fileName] = JSON.parse(fileContent);
75
- } catch (error) {
76
- console.error(`Failed to load component schema ${fileName}:`, error);
63
+ schemaData.components[fileName] = JSON.parse(
64
+ readFileSync(join(componentsPath, fileName), "utf8"),
65
+ );
66
+ } catch (err) {
67
+ console.error(`Failed to load component schema ${fileName}:`, err);
77
68
  }
78
69
  }
79
70
  } catch (error) {
80
71
  console.error("Failed to read components directory:", error);
81
72
  }
82
73
 
83
- // Load type schemas
84
- const typesPath = join(schemasPath, "types");
85
- try {
86
- const typeFiles = readdirSync(typesPath).filter((file) =>
87
- file.endsWith(".json"),
88
- );
89
-
90
- for (const fileName of typeFiles) {
91
- try {
92
- const filePath = join(typesPath, fileName);
93
- const fileContent = readFileSync(filePath, "utf8");
94
- schemaData.types[fileName] = JSON.parse(fileContent);
95
- } catch (error) {
96
- console.error(`Failed to load type schema ${fileName}:`, error);
97
- }
98
- }
99
- } catch (error) {
100
- console.error("Failed to read types directory:", error);
101
- }
102
-
103
74
  return schemaData;
104
75
  }
105
76