@vizejs/musea-mcp-server 0.386.0 → 0.388.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/dist/cli.mjs CHANGED
@@ -1,5 +1,5 @@
1
1
  #!/usr/bin/env node
2
- import { n as startServer } from "./src-CJlr_RgD.mjs";
2
+ import { n as startServer } from "./src-BrLbwFKO.mjs";
3
3
  //#region src/cli.ts
4
4
  /**
5
5
  * Musea MCP Server CLI.
package/dist/index.mjs CHANGED
@@ -1,2 +1,2 @@
1
- import { n as startServer, t as createMuseaServer } from "./src-CJlr_RgD.mjs";
1
+ import { n as startServer, t as createMuseaServer } from "./src-BrLbwFKO.mjs";
2
2
  export { createMuseaServer, createMuseaServer as default, startServer };
@@ -366,8 +366,6 @@ async function getComponentSourceDescriptor(ctx, resolved) {
366
366
  };
367
367
  if (!isProjectPath(ctx.projectRoot, componentPath)) return {
368
368
  reference: resolved.info.component,
369
- absolutePath: componentPath,
370
- path: componentPath,
371
369
  exists: false,
372
370
  error: "Component source is outside the project root."
373
371
  };
@@ -1402,6 +1400,7 @@ function normalizeCategories(categories) {
1402
1400
  async function handleGenerateVariants(ctx, binding, args) {
1403
1401
  const componentRelPath = args?.componentPath;
1404
1402
  if (!componentRelPath) throw new McpError(ErrorCode.InvalidParams, "componentPath is required");
1403
+ if (!componentRelPath.endsWith(".vue")) throw new McpError(ErrorCode.InvalidParams, "componentPath must be a .vue file");
1405
1404
  if (!binding.analyzeSfc) throw new McpError(ErrorCode.InternalError, "analyzeSfc not available in native binding");
1406
1405
  if (!binding.generateVariants) throw new McpError(ErrorCode.InternalError, "generateVariants not available in native binding");
1407
1406
  const absolutePath = resolveProjectPath(ctx.projectRoot, componentRelPath, "componentPath");
@@ -1732,12 +1731,11 @@ async function readResource(ctx, uri) {
1732
1731
  }] };
1733
1732
  }
1734
1733
  if (uri.startsWith("musea://source/")) {
1735
- const relativePath = decodeURIComponent(uri.slice(15));
1736
- const absolutePath = resolveProjectPath(ctx.projectRoot, relativePath, "source path");
1734
+ const resolved = await resolveArtReference(ctx, { path: decodeURIComponent(uri.slice(15)) });
1737
1735
  return { contents: [{
1738
1736
  uri,
1739
1737
  mimeType: "text/plain",
1740
- text: await fs.promises.readFile(absolutePath, "utf-8")
1738
+ text: await fs.promises.readFile(resolved.absolutePath, "utf-8")
1741
1739
  }] };
1742
1740
  }
1743
1741
  if (uri.startsWith("musea://component-source/")) {
@@ -1809,6 +1807,30 @@ async function readResource(ctx, uri) {
1809
1807
  throw new McpError(ErrorCode.InvalidRequest, `Unknown resource URI: ${uri}`);
1810
1808
  }
1811
1809
  //#endregion
1810
+ //#region src/tokens-path.ts
1811
+ /**
1812
+ * Resolve a design-token file or directory that stays inside the project root.
1813
+ */
1814
+ const AUTO_DETECT_TOKEN_DIRS = [
1815
+ "tokens",
1816
+ "design-tokens",
1817
+ "style-dictionary"
1818
+ ];
1819
+ /**
1820
+ * Return an explicit `tokensPath` or the first auto-detected candidate that
1821
+ * realpath-resolves inside `projectRoot`. Symlinks that leave the project
1822
+ * are rejected by `resolveProjectPath`.
1823
+ */
1824
+ async function resolveConfiguredTokensPath(projectRoot, tokensPath) {
1825
+ if (tokensPath) return resolveProjectPath(projectRoot, tokensPath, "tokensPath");
1826
+ for (const dir of AUTO_DETECT_TOKEN_DIRS) try {
1827
+ const candidate = resolveProjectPath(projectRoot, dir, "tokensPath");
1828
+ const stat = await fs.promises.stat(candidate);
1829
+ if (stat.isDirectory() || stat.isFile()) return candidate;
1830
+ } catch {}
1831
+ return null;
1832
+ }
1833
+ //#endregion
1812
1834
  //#region src/index.ts
1813
1835
  /**
1814
1836
  * Musea MCP Server — Vue.js design system toolkit.
@@ -1862,19 +1884,7 @@ function createMuseaServer(config) {
1862
1884
  return artCache;
1863
1885
  }
1864
1886
  async function resolveTokensPath() {
1865
- if (tokensPath) return resolveProjectPath(projectRoot, tokensPath, "tokensPath");
1866
- for (const dir of [
1867
- "tokens",
1868
- "design-tokens",
1869
- "style-dictionary"
1870
- ]) {
1871
- const candidate = path.join(projectRoot, dir);
1872
- try {
1873
- const stat = await fs.promises.stat(candidate);
1874
- if (stat.isDirectory() || stat.isFile()) return candidate;
1875
- } catch {}
1876
- }
1877
- return null;
1887
+ return resolveConfiguredTokensPath(projectRoot, tokensPath);
1878
1888
  }
1879
1889
  const ctx = {
1880
1890
  projectRoot,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vizejs/musea-mcp-server",
3
- "version": "0.386.0",
3
+ "version": "0.388.0",
4
4
  "description": "MCP server for building Vue.js design systems - component analysis, documentation, variant generation, and design tokens",
5
5
  "keywords": [
6
6
  "ai",
@@ -42,7 +42,7 @@
42
42
  },
43
43
  "dependencies": {
44
44
  "@modelcontextprotocol/sdk": "1.30.0",
45
- "@vizejs/native": "0.386.0",
45
+ "@vizejs/native": "0.388.0",
46
46
  "@vue/compiler-dom": "3.5.35",
47
47
  "typescript": "6.0.3"
48
48
  },