From b57c824438dfc6ad4042a053215ed6f16c1ba25f Mon Sep 17 00:00:00 2001 From: Simon Date: Wed, 3 Jun 2026 18:27:15 -0700 Subject: [PATCH] Fix Glama MCP startup --- Dockerfile | 2 +- src/index.ts | 18 ++++++++++++++++-- 2 files changed, 17 insertions(+), 3 deletions(-) diff --git a/Dockerfile b/Dockerfile index c828501..7a08b5b 100644 --- a/Dockerfile +++ b/Dockerfile @@ -2,4 +2,4 @@ # introspection checks. Installs the published package and launches the stdio server. FROM node:22-slim RUN npm install -g @kyanitelabs/epoch -ENTRYPOINT ["epoch"] +ENTRYPOINT ["node", "/usr/local/lib/node_modules/@kyanitelabs/epoch/dist/index.js"] diff --git a/src/index.ts b/src/index.ts index b4efc4d..0d849a3 100644 --- a/src/index.ts +++ b/src/index.ts @@ -1,3 +1,4 @@ +import { realpathSync } from "node:fs"; import { pathToFileURL } from "node:url"; import { startMcpServer } from "./entries/mcp.js"; import { startHttpServer } from "./entries/http.js"; @@ -96,8 +97,21 @@ function main(): void { }); } -const isEntrypoint = process.argv[1] !== undefined - && import.meta.url === pathToFileURL(process.argv[1]).href; +function isCurrentFileEntrypoint(): boolean { + const entrypoint = process.argv[1]; + + if (!entrypoint) { + return false; + } + + try { + return import.meta.url === pathToFileURL(realpathSync(entrypoint)).href; + } catch { + return import.meta.url === pathToFileURL(entrypoint).href; + } +} + +const isEntrypoint = isCurrentFileEntrypoint(); if (isEntrypoint) { main();