@a2uicatalog/mcp 0.1.0 → 0.1.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/package.json +1 -1
- package/server.mjs +21 -4
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@a2uicatalog/mcp",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.1",
|
|
4
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.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": { "a2uicatalog-mcp": "server.mjs" },
|
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.
|
|
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
|
-
|
|
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
|
|
251
|
+
console.error("a2uicatalog-mcp on stdio");
|
|
235
252
|
}
|