Skip to content

[recipes] Fix work-operating-model health endpoint routing - #453

Open
eazene wants to merge 2 commits into
NateBJones-Projects:mainfrom
eazene:contrib/eazene/fix-wom-health-route
Open

[recipes] Fix work-operating-model health endpoint routing#453
eazene wants to merge 2 commits into
NateBJones-Projects:mainfrom
eazene:contrib/eazene/fix-wom-health-route

Conversation

@eazene

@eazene eazene commented Jul 15, 2026

Copy link
Copy Markdown
Contributor

What

Fixes the health endpoint routing in the work-operating-model-activation recipe'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 the app.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 absolute app.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=... initialize200 with serverInfo (MCP unaffected)

🤖 Generated with Claude Code

https://claude.ai/code/session_01LxP7M99m4EF5Ve7rn3SNKH

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
@github-actions github-actions Bot added the recipe Contribution: step-by-step recipe label Jul 15, 2026
@github-actions

github-actions Bot commented Jul 15, 2026

Copy link
Copy Markdown

OB1 PR Gate

Folder structure — All files are in allowed directories
Required files — README.md and metadata.json found in all contribution folders
Metadata valid — All metadata.json files passed JSON Schema validation
No credentials — No API keys, tokens, or secrets detected
SQL safety — SQL safety issues:

  • recipes/work-operating-model-activation/schema.sql line 479: DELETE FROM without WHERE clause

Category artifacts — Required file types present for each category
PR format — Title follows [category] Description format
No binary blobs — No oversized or binary files
README completeness — All READMEs include Prerequisites, Steps, and Expected Outcome
Contribution dependencies — All declared skill and primitive dependencies exist and are linked in README
LLM clarity review — Covered by Claude PR Review workflow
Remote MCP pattern — No local MCP server patterns detected — uses remote MCP correctly
Tool audit link — Extensions/integrations link to the MCP Tool Audit guide
Scope check — All changes are within the contribution folder(s)
Internal links — All relative links in READMEs resolve to existing files

Result: 14/15 checks passed. Please fix the issues above and push again.


Post-Merge Tasks

These 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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

recipe Contribution: step-by-step recipe

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant