@neuctra/ui-mcp 0.2.1 → 0.2.3

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.
@@ -1,15 +1,15 @@
1
1
  {
2
2
  "$schema": "https://json-schema.org/draft/2020-12/schema#",
3
3
  "package": "@neuctra/ui",
4
- "version": "0.5.2",
5
- "generatedAt": "2026-08-14T05:45:27.177Z",
4
+ "version": "0.5.3",
5
+ "generatedAt": "2026-08-14T07:21:57.602Z",
6
6
  "componentCount": 76,
7
7
  "components": [
8
8
  {
9
9
  "name": "Accordion",
10
10
  "importFrom": "@neuctra/ui",
11
11
  "module": "Accordion",
12
- "category": "uncategorized",
12
+ "category": "data-display",
13
13
  "propsInterface": "AccordionProps",
14
14
  "description": "The Accordion component is a flexible UI primitive built with React and TypeScript. It allows users to expand and collapse content sections, making it ideal for FAQs, documentation, and content-heavy interfaces.",
15
15
  "props": [
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@neuctra/ui-mcp",
3
- "version": "0.2.1",
3
+ "version": "0.2.3",
4
4
  "description": "MCP server exposing the @neuctra/ui component registry (props, defaults, examples, theme tokens) so AI coding tools generate accurate Neuctra UI code.",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -21,6 +21,13 @@
21
21
  "bin": {
22
22
  "neuctra-ui-mcp": "./bin/cli.mjs"
23
23
  },
24
+ "main": "./src/server.mjs",
25
+ "exports": {
26
+ ".": "./src/server.mjs",
27
+ "./data/components.json": "./data/components.json",
28
+ "./data/theme.json": "./data/theme.json",
29
+ "./package.json": "./package.json"
30
+ },
24
31
  "files": [
25
32
  "bin",
26
33
  "src",
package/src/server.mjs CHANGED
@@ -4,15 +4,22 @@ import { fileURLToPath } from "node:url";
4
4
  import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
5
5
  import { z } from "zod";
6
6
 
7
- const __dirname = path.dirname(fileURLToPath(import.meta.url));
8
- const DATA_DIR = path.resolve(__dirname, "..", "data");
9
-
10
- const registry = JSON.parse(
11
- fs.readFileSync(path.join(DATA_DIR, "components.json"), "utf8"),
12
- );
13
- const theme = JSON.parse(fs.readFileSync(path.join(DATA_DIR, "theme.json"), "utf8"));
14
-
15
- const componentsByName = new Map(registry.components.map((c) => [c.name, c]));
7
+ // Reads data/*.json from disk. Only works on runtimes with a filesystem
8
+ // (Node, Bun, Deno) — callers on edge/serverless runtimes without one
9
+ // (Cloudflare Workers) must import the JSON files themselves at build time
10
+ // and pass them into createServer({ registry, theme }) instead. Resolving
11
+ // __dirname is deferred inside this function (not module top-level) because
12
+ // import.meta.url is unavailable in some bundled edge runtimes even when
13
+ // this function itself is never called there.
14
+ function loadDataFromDisk() {
15
+ const __dirname = path.dirname(fileURLToPath(import.meta.url));
16
+ const DATA_DIR = path.resolve(__dirname, "..", "data");
17
+ const registry = JSON.parse(
18
+ fs.readFileSync(path.join(DATA_DIR, "components.json"), "utf8"),
19
+ );
20
+ const theme = JSON.parse(fs.readFileSync(path.join(DATA_DIR, "theme.json"), "utf8"));
21
+ return { registry, theme };
22
+ }
16
23
 
17
24
  function summarize(component) {
18
25
  return {
@@ -31,7 +38,10 @@ function matchesQuery(component, query) {
31
38
  return component.props.some((p) => p.name.toLowerCase().includes(q));
32
39
  }
33
40
 
34
- export function createServer() {
41
+ export function createServer(data) {
42
+ const { registry, theme } = data ?? loadDataFromDisk();
43
+ const componentsByName = new Map(registry.components.map((c) => [c.name, c]));
44
+
35
45
  const server = new McpServer({
36
46
  name: "neuctra-ui",
37
47
  version: "0.1.0",