@smwb/ui-mcp-solid 0.3.0 → 0.4.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/componentMeta.mjs CHANGED
@@ -419,12 +419,34 @@ export function getComponentProps(catalog, nameOrId) {
419
419
  ssr: entry.ssr,
420
420
  extends: entry.extends,
421
421
  inheritedAttributes: entry.inheritedAttributes,
422
- styles: entry.styles,
423
422
  props: entry.props,
424
423
  sourcePath: entry.sourcePath,
425
424
  };
426
425
  }
427
426
 
427
+ export function getComponentStyles(catalog, nameOrId) {
428
+ const entry = resolveComponent(catalog, nameOrId);
429
+ if (!entry) {
430
+ return null;
431
+ }
432
+
433
+ if (!entry.styles) {
434
+ return {
435
+ id: entry.id,
436
+ name: entry.name,
437
+ styles: null,
438
+ sourcePath: entry.sourcePath,
439
+ };
440
+ }
441
+
442
+ return {
443
+ id: entry.id,
444
+ name: entry.name,
445
+ styles: entry.styles,
446
+ sourcePath: entry.sourcePath,
447
+ };
448
+ }
449
+
428
450
  export function resolveMetaRootDirs(packageRoot) {
429
451
  const candidates = [
430
452
  path.join(packageRoot, "component-meta"),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@smwb/ui-mcp-solid",
3
- "version": "0.3.0",
3
+ "version": "0.4.1",
4
4
  "description": "Model Context Protocol server exposing the @smwb/ui-solid (SolidJS) component catalog and customization guide.",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -28,8 +28,8 @@
28
28
  "zod": "^4.4.3"
29
29
  },
30
30
  "devDependencies": {
31
- "@smwb/ui-solid": "^0.3.0",
32
- "@smwb/ui-styles": "^1.0.3",
31
+ "@smwb/ui-solid": "^0.4.1",
32
+ "@smwb/ui-styles": "^1.0.4",
33
33
  "glob": "^13.0.6",
34
34
  "typescript": "^6.0.3",
35
35
  "vitest": "^2.1.9"
package/server.mjs CHANGED
@@ -4,7 +4,12 @@ import { fileURLToPath } from "node:url";
4
4
  import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
5
5
  import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
6
6
  import { z } from "zod";
7
- import { getComponentProps, loadCatalogFromPackageRoot, searchComponents } from "./componentMeta.mjs";
7
+ import {
8
+ getComponentProps,
9
+ getComponentStyles,
10
+ loadCatalogFromPackageRoot,
11
+ searchComponents,
12
+ } from "./componentMeta.mjs";
8
13
  import { getCustomization, loadCustomizationCatalog, searchCustomization } from "./customizationMeta.mjs";
9
14
 
10
15
  const scriptDir = path.dirname(fileURLToPath(import.meta.url));
@@ -20,7 +25,7 @@ const server = new McpServer(
20
25
  },
21
26
  {
22
27
  instructions:
23
- "@smwb/ui-solid component catalog and customization guide. Use search_components / get_component_props for API metadata, and search_customization / get_customization for theming and appearance options. Every component exposes an `ssr` field: `safe` (always true — nothing throws during renderToString), `rendering` (\"universal\" = emits static HTML on the server and hydrates; \"client\" = a pure overlay that renders nothing server-side and mounts via a portal after hydration), and an optional `note`.",
28
+ "@smwb/ui-solid component catalog and customization guide. Use search_components / get_component_props for API metadata (props, SSR), get_component_styles for required Less imports, and search_customization / get_customization for theming and appearance options. Every component exposes an `ssr` field: `safe` (always true — nothing throws during renderToString), `rendering` (\"universal\" = emits static HTML on the server and hydrates; \"client\" = a pure overlay that renders nothing server-side and mounts via a portal after hydration), and an optional `note`.",
24
29
  }
25
30
  );
26
31
 
@@ -54,7 +59,7 @@ server.registerTool(
54
59
  {
55
60
  title: "Get @smwb/ui-solid component props",
56
61
  description:
57
- "Return the full metadata document for a @smwb/ui-solid component, including prop names, types, required flags, descriptions, SSR classification (`ssr.safe`, `ssr.rendering`, `ssr.note`), and required Less imports (`styles.base`, `styles.entries`, `styles.dependencies`, `styles.importExample`).",
62
+ "Return the API metadata for a @smwb/ui-solid component: prop names, types, required flags, descriptions, and SSR classification (`ssr.safe`, `ssr.rendering`, `ssr.note`). For Less imports use get_component_styles.",
58
63
  inputSchema: z.object({
59
64
  nameOrId: z
60
65
  .string()
@@ -90,6 +95,47 @@ server.registerTool(
90
95
  }
91
96
  );
92
97
 
98
+ server.registerTool(
99
+ "get_component_styles",
100
+ {
101
+ title: "Get @smwb/ui-solid component styles",
102
+ description:
103
+ "Return required Less imports for a @smwb/ui-solid component: `styles.base` (foundation/theme), `styles.entries` (component entry), `styles.dependencies` (transitive imports from nested components), and `styles.importExample`.",
104
+ inputSchema: z.object({
105
+ nameOrId: z
106
+ .string()
107
+ .describe("Exact component name (Sheet) or metadata id (layout/sheet/sheet, inputs/button/button)"),
108
+ }),
109
+ },
110
+ async ({ nameOrId }) => {
111
+ const result = getComponentStyles(catalog, nameOrId);
112
+ if (!result) {
113
+ return {
114
+ isError: true,
115
+ content: [
116
+ {
117
+ type: "text",
118
+ text: JSON.stringify(
119
+ {
120
+ error: "Component not found",
121
+ nameOrId,
122
+ hint: "Call search_components first to discover valid ids and names.",
123
+ },
124
+ null,
125
+ 2
126
+ ),
127
+ },
128
+ ],
129
+ };
130
+ }
131
+
132
+ return {
133
+ content: [{ type: "text", text: JSON.stringify(result, null, 2) }],
134
+ structuredContent: result,
135
+ };
136
+ }
137
+ );
138
+
93
139
  server.registerTool(
94
140
  "search_customization",
95
141
  {