@a2uicatalog/mcp 0.1.0 → 0.2.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 CHANGED
@@ -1,19 +1,46 @@
1
1
  {
2
2
  "name": "@a2uicatalog/mcp",
3
- "version": "0.1.0",
4
- "description": "Local MCP server for the A2UI Atomic Catalog: browse the 474-atom vocabulary, validate a payload (hallucinated atom = parse error, not a broken screen), get a shareable preview URL, and deploy a training.md to your own Google Apps Script. Pure-local for browsing/validation — no network, no secret, no account.",
3
+ "version": "0.2.0",
4
+ "description": "CLI + local MCP server for the A2UI Atomic Catalog. Render an A2UI payload to HTML with no account and no MCP client (`npx @a2uicatalog/mcp render page.json`), browse and validate the 474-atom vocabulary offline, or run the local MCP server for Claude/Cursor. A hallucinated atom is a parse error, not a broken screen.",
5
5
  "type": "module",
6
- "bin": { "a2uicatalog-mcp": "server.mjs" },
7
- "engines": { "node": ">=18" },
6
+ "bin": {
7
+ "a2uicatalog-mcp": "server.mjs",
8
+ "a2ui": "cli.mjs"
9
+ },
10
+ "engines": {
11
+ "node": ">=18"
12
+ },
8
13
  "license": "MIT",
9
14
  "author": "Curtis Krygier",
10
15
  "homepage": "https://a2uicatalog.ai",
11
- "repository": { "type": "git", "url": "git+https://github.com/a2uicatalog/a2ui.git", "directory": "mcp" },
16
+ "repository": {
17
+ "type": "git",
18
+ "url": "git+https://github.com/a2uicatalog/a2ui.git",
19
+ "directory": "mcp"
20
+ },
12
21
  "bugs": "https://github.com/a2uicatalog/a2ui/issues",
13
- "keywords": ["mcp", "model-context-protocol", "a2ui", "ui-generation", "claude", "agent", "google-apps-script"],
14
- "files": ["server.mjs", "demo.mjs", "test.mjs", "scripts", "data", "README.md"],
22
+ "keywords": [
23
+ "mcp",
24
+ "model-context-protocol",
25
+ "cli",
26
+ "a2ui",
27
+ "ui-generation",
28
+ "claude",
29
+ "agent",
30
+ "google-apps-script"
31
+ ],
32
+ "files": [
33
+ "README.md",
34
+ "cli-test.mjs",
35
+ "cli.mjs",
36
+ "data",
37
+ "demo.mjs",
38
+ "scripts",
39
+ "server.mjs",
40
+ "test.mjs"
41
+ ],
15
42
  "scripts": {
16
- "test": "node test.mjs",
43
+ "test": "node test.mjs && node cli-test.mjs",
17
44
  "demo": "node demo.mjs",
18
45
  "sync-data": "node scripts/sync-data.mjs",
19
46
  "prepublishOnly": "npm run sync-data && npm test"
package/server.mjs CHANGED
@@ -16,7 +16,7 @@
16
16
  import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
17
17
  import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
18
18
  import { z } from "zod";
19
- import { readFileSync } from "fs";
19
+ import { readFileSync, realpathSync } from "fs";
20
20
  import { fileURLToPath } from "url";
21
21
  import { dirname, join } from "path";
22
22
  import { gzipSync } from "zlib";
@@ -121,7 +121,7 @@ function redact(text) {
121
121
  }
122
122
  function tooBig(s) { return typeof s === "string" && s.length > MAX_INPUT; }
123
123
 
124
- const server = new McpServer({ name: "a2uicatalog-mcp", version: "0.1.0" });
124
+ const server = new McpServer({ name: "a2uicatalog-mcp", version: "0.1.1" });
125
125
 
126
126
  // ── OFFICIAL SERVING PATTERN: A2UI as MCP Resource (application/a2ui+json) ──
127
127
  for (const name of Object.keys(UIS)) {
@@ -228,8 +228,25 @@ export async function buildApp(training_md) {
228
228
  // Export internals for the test harness (when imported, not run over stdio).
229
229
  export { validate, encodeUrl, loadUI, ATOMS };
230
230
 
231
- if (process.argv[1] && process.argv[1].endsWith("server.mjs")) {
231
+ // Detect "am I the entry point" by REALPATH, not by filename. npm's `bin` field
232
+ // (package.json) makes the installed executable a SYMLINK named after the bin
233
+ // key ("a2uicatalog-mcp"), not "server.mjs" — a filename-suffix check like the
234
+ // old `process.argv[1].endsWith("server.mjs")` therefore never matches when
235
+ // launched via `npx @a2uicatalog/mcp` or a global install (npm creates
236
+ // bin/a2uicatalog-mcp -> ../lib/node_modules/@a2uicatalog/mcp/server.mjs).
237
+ // Confirmed live and silent — v0.1.0 loaded, built its catalog indices, and
238
+ // exited with ZERO output on every real install path (npx, global install)
239
+ // while `node server.mjs` directly kept working, which is why local dev
240
+ // testing never caught it. realpathSync resolves the symlink on both sides,
241
+ // so the comparison is correct regardless of what name it was invoked under.
242
+ let isEntryPoint = false;
243
+ try {
244
+ isEntryPoint = !!(process.argv[1] &&
245
+ realpathSync(process.argv[1]) === realpathSync(fileURLToPath(import.meta.url)));
246
+ } catch (e) { /* argv[1] missing or unreadable -> not the entry point */ }
247
+
248
+ if (isEntryPoint) {
232
249
  const transport = new StdioServerTransport();
233
250
  await server.connect(transport);
234
- console.error("a2uicatalog-mcp test harness on stdio");
251
+ console.error("a2uicatalog-mcp on stdio");
235
252
  }