@ateam-ai/mcp 0.4.68 → 0.4.69
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/src/http.js +34 -0
package/package.json
CHANGED
package/src/http.js
CHANGED
|
@@ -31,6 +31,22 @@ import {
|
|
|
31
31
|
import { mountOAuth } from "./oauth.js";
|
|
32
32
|
import { connectGithubPage } from "./pages.js";
|
|
33
33
|
|
|
34
|
+
// Read once at import: the version of the code in THIS process, and when it
|
|
35
|
+
// started. See the /health handler for why both matter.
|
|
36
|
+
const PKG_VERSION = await (async () => {
|
|
37
|
+
try {
|
|
38
|
+
const { readFileSync } = await import("node:fs");
|
|
39
|
+
const { fileURLToPath } = await import("node:url");
|
|
40
|
+
const { dirname, join } = await import("node:path");
|
|
41
|
+
const here = dirname(fileURLToPath(import.meta.url));
|
|
42
|
+
return JSON.parse(readFileSync(join(here, "..", "package.json"), "utf8")).version || "unknown";
|
|
43
|
+
} catch {
|
|
44
|
+
// Never let a liveness probe fail over its own labelling.
|
|
45
|
+
return "unknown";
|
|
46
|
+
}
|
|
47
|
+
})();
|
|
48
|
+
const STARTED_AT = new Date().toISOString();
|
|
49
|
+
|
|
34
50
|
// Active sessions
|
|
35
51
|
const transports = {};
|
|
36
52
|
|
|
@@ -213,10 +229,28 @@ export function startHttpServer(port = 3100) {
|
|
|
213
229
|
}
|
|
214
230
|
|
|
215
231
|
// ─── Health check ─────────────────────────────────────────────
|
|
232
|
+
//
|
|
233
|
+
// version + startedAt are the whole point of this probe, not decoration.
|
|
234
|
+
//
|
|
235
|
+
// Without them every field here was TRUE while the agent served seven-day-old
|
|
236
|
+
// code: ok, service, transport and sessions all reported correctly, and not
|
|
237
|
+
// one of them could reveal that the process had been running since Aug 15
|
|
238
|
+
// across ~10 publishes. A liveness probe that cannot answer "is this the code
|
|
239
|
+
// I shipped?" is the truthful-but-useless shape — and a stale server that
|
|
240
|
+
// ANSWERS is worse than one that is down, because its errors describe bugs
|
|
241
|
+
// that were already fixed. (2026-08-22: it returned a 401 from a code path
|
|
242
|
+
// deleted in 2ff2a34, and a session went debugging a system that was correct.)
|
|
243
|
+
//
|
|
244
|
+
// version comes from the package.json NEXT TO THIS FILE, read at import, so it
|
|
245
|
+
// describes the code actually loaded — not what npm has, and not what a
|
|
246
|
+
// container was built with.
|
|
216
247
|
app.get("/health", (_req, res) => {
|
|
217
248
|
res.json({
|
|
218
249
|
ok: true,
|
|
219
250
|
service: "ateam-mcp",
|
|
251
|
+
version: PKG_VERSION,
|
|
252
|
+
startedAt: STARTED_AT,
|
|
253
|
+
uptime_s: Math.round(process.uptime()),
|
|
220
254
|
transport: "http",
|
|
221
255
|
sessions: getSessionStats(),
|
|
222
256
|
});
|