Skip to content

#1 Persistent memory for AI coding agents based on real-world benchmarks

fix: viewer not found when installed via npx (#109)

Rohit Ghumarebe24ef72ed0a
diff --git a/package.json b/package.json
index c79375da..5311f6d5 100644
--- a/package.json
+++ b/package.json
@@ -10,7 +10,7 @@
"agentmemory-mcp": "dist/standalone.mjs"
},
"scripts": {
- "build": "tsdown && (cp iii-config.yaml dist/ 2>/dev/null || true) && (cp docker-compose.yml dist/ 2>/dev/null || true)",
+ "build": "tsdown && (cp iii-config.yaml dist/ 2>/dev/null || true) && (cp docker-compose.yml dist/ 2>/dev/null || true) && mkdir -p dist/viewer && cp src/viewer/index.html dist/viewer/",
"dev": "tsx src/index.ts",
"start": "node dist/cli.mjs",
"migrate": "node dist/functions/migrate.js",
diff --git a/src/viewer/server.ts b/src/viewer/server.ts
index cd878a03..4a6aaba8 100644
--- a/src/viewer/server.ts
+++ b/src/viewer/server.ts
@@ -102,9 +102,11 @@ export function startViewerServer(
) {
const base = dirname(fileURLToPath(import.meta.url));
const candidates = [
- join(base, "..", "src", "viewer", "index.html"),
- join(base, "..", "viewer", "index.html"),
+ join(base, "index.html"),
join(base, "viewer", "index.html"),
+ join(base, "..", "viewer", "index.html"),
+ join(base, "..", "src", "viewer", "index.html"),
+ join(base, "..", "dist", "viewer", "index.html"),
];
for (const p of candidates) {
try {