[recipes] Fix work-operating-model health endpoint routing - #453
Conversation
The MCP server's health check used app.get("/health"), but Supabase mounts
edge functions at /functions/v1/<name> without stripping the function-name
segment. Hono therefore sees the path as /work-operating-model-mcp/health,
never /health, so the route missed and requests fell through to the API-key
auth gate — returning 401 instead of a health payload.
Move the check into the app.all("*") catch-all as a prefix-agnostic suffix
match (c.req.path.endsWith("/health")), placed before the auth gate so it
stays public and works under any mount prefix. MCP behavior is unchanged.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01LxP7M99m4EF5Ve7rn3SNKH
OB1 PR Gate✅ Folder structure — All files are in allowed directories
✅ Category artifacts — Required file types present for each category Result: 14/15 checks passed. Please fix the issues above and push again. Post-Merge TasksThese don't block merge — they're reminders for admins after this PR lands.
|
The four SQL functions (update_work_operating_model_updated_at, operating_model_next_layer, operating_model_start_session, operating_model_save_layer) had a role-mutable search_path, which the Supabase database linter flags (0011_function_search_path_mutable) as a defense-in-depth issue. Add `SET search_path = public, pg_temp` to each function definition so the resolution path is fixed at deploy time and unqualified references still resolve. Applies on a fresh schema install; no behavior change. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01LxP7M99m4EF5Ve7rn3SNKH
What
Fixes the health endpoint routing in the
work-operating-model-activationrecipe's MCP server.Problem
The server registered its health check as
app.get("/health"). Supabase mounts edge functions at/functions/v1/<name>and does not strip the function-name segment before handing the request to the function. Hono therefore sees the path as/work-operating-model-mcp/health, never/health— so the route misses and the request falls through to theapp.all("*")catch-all, which enforces the MCP access key and returns 401 for what should be a public health check.Fix
Move the health check into the
app.all("*")catch-all as a prefix-agnostic suffix match (c.req.method === "GET" && c.req.path.endsWith("/health")), placed before the API-key gate so it stays public and works under any mount prefix. The absoluteapp.get("/health")route is removed. MCP request handling is unchanged.Testing
Deployed to a live Supabase project and verified against the function URL:
GET .../work-operating-model-mcp/health(no key) → 200{"status":"ok",...}POST .../work-operating-model-mcp(no key) → 401 (MCP still gated)POST .../work-operating-model-mcp?key=...initialize→ 200 withserverInfo(MCP unaffected)🤖 Generated with Claude Code
https://claude.ai/code/session_01LxP7M99m4EF5Ve7rn3SNKH