From 0311c97a35f59eb68f7e9e4ae6c00647b71286a9 Mon Sep 17 00:00:00 2001 From: Antigravity Date: Sun, 3 May 2026 19:45:27 +0000 Subject: [PATCH] fix: add /health endpoint before auth middleware for Docker healthcheck (was 401 with MCP_REQUIRE_AUTH=true) --- docker-compose.yml | 2 +- mcp-server/index-sse.js | 6 +++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/docker-compose.yml b/docker-compose.yml index 424e444..3fbf32f 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -99,7 +99,7 @@ services: cpus: '0.25' memory: 128M healthcheck: - test: ["CMD-SHELL", "wget --spider -q http://localhost:3001/ || exit 1"] + test: ["CMD-SHELL", "wget -q -O /dev/null http://localhost:3001/health || exit 1"] interval: 30s timeout: 10s retries: 3 diff --git a/mcp-server/index-sse.js b/mcp-server/index-sse.js index d241f31..d134163 100644 --- a/mcp-server/index-sse.js +++ b/mcp-server/index-sse.js @@ -92,6 +92,10 @@ const app = express(); app.use(cors()); app.use(express.json({ limit: '10mb' })); +// ── Health (before auth middleware — used by Docker healthcheck) ──────────── + +app.get('/health', (req, res) => res.json({ ok: true, uptime: process.uptime() })); + // ── Auth Middleware ────────────────────────────────────────────────────────── app.use(async (req, res, next) => { @@ -211,7 +215,7 @@ app.get('/', (req, res) => { name: 'Memento MCP Server', version: '3.2.0', status: 'running', - endpoints: { mcp: '/mcp', health: '/', sessions: '/sessions' }, + endpoints: { mcp: '/mcp', health: '/health', sessions: '/sessions' }, auth: { enabled: process.env.MCP_REQUIRE_AUTH === 'true' }, tools: 22, });