hermes-skills/arifos-fastmcp-http-app-debug/SKILL.md
Debug why custom REST routes in rest_routes.py return HTTP 404 despite existing in the file — FastMCP http_app() called before _register(mcp) completes, causing mcp.run() fallback that bypasses Uvicorn
npx skillsauth add ariffazil/openclaw-workspace arifos-fastmcp-http-app-debugInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
New REST endpoints added to arifOS/arifosmcp/runtime/rest_routes.py exist in the file (syntax valid), return HTTP 404 from live container, but container logs show no route registration errors.
[arif-register] Registered: command_center OK
HTTP app not available — falling back to mcp.run()
server.py calls mcp.http_app() (line 432) to get a Starlette app, then tries mcp._mcp_server.app (line 434) as fallback. Both return None because:
mcp.http_app() is called before all tools and apps are fully registeredmcp.tool() / mcp.prompt() calls and all _register(mcp) calls completeNone, the server falls back to mcp.run() — FastMCP's native stdio/streamable transport starts instead of Uvicornapp.add_api_route() in rest_routes.py are never in the request path# 1. Check what the container actually started
docker logs arifosmcp 2>&1 | grep -E "HTTP app not|mcp.run|registered"
# 2. Verify endpoints exist in the container image
docker exec arifosmcp grep -c "tools.json\|mcp/status" /app/arifosmcp/runtime/rest_routes.py
# 3. Test if the endpoint is reachable
curl -sv https://arifos.arif-fazil.com/mcp/status 2>&1 | grep "HTTP/"
# 4. If HTTP 404 but grep finds the code → route registration was bypassed
In server.py, move app = mcp.http_app(...) to after all _register(mcp) calls complete. Sequence:
# 1. All tool registrations
for tool_fn in _CANONICAL_TOOL_FNS:
mcp.tool(...)(tool_fn)
# 2. All app registrations
_safe_register(mcp, "arifosmcp.apps.command_center.app", "command_center")
# 3. NOW get the HTTP app — after all registrations complete
app = mcp.http_app(stateless_http=True)
if app is None:
app = mcp._mcp_server.app # FastMCP v3 internal
# 4. Register custom REST routes on the resolved app
register_rest_routes(app, mcp)
# 5. Run with Uvicorn
FastMCP's http_app() is a post-registration call, not a setup call. Must be called after all mcp.tool(), mcp.prompt(), and _register() calls complete. The arifOS server structure currently calls it too early.
When adding new REST routes to rest_routes.py, always verify:
register_rest_routes(app, mcp)app is the Uvicorn-served Starlette app (not None)HTTP app not available — if they do, routes won't registerGuard pattern for new endpoints:
if app is None:
return JSONResponse({"error": "REST routes unavailable — HTTP app not initialized"}, status_code=503)
development
Governed intelligence skill for AAA as the abstraction, attestation, and abduction control plane across arifOS, APEX, A-FORGE, GEOX, WEALTH, WELL, and the ariffazil profile repository. Use when the user asks to explain or design AAA, route agentic work, reduce chaos/entropy in an arifOS federation task, create AREP/task declarations, classify risk, plan multi-repo changes, review governance boundaries, or translate human intent into evidence-backed, authority-safe, recursively agentic workflows. Provides deterministic F1-F13 floor checking, bounded abduction, and FederationReceipt composition.
development
Check every skill’s “use when” and “do not use when” clauses for collisions, missing negatives, and vague verbs like “help,” “assist,” or “improve.” Load when linting, reviewing, or validating trigger boundaries.
development
Bootstrap, design, and package new skills. Load when capturing user intent for a new skill or drafting its initial instruction framework.
content-media
Diagnose which federation services are up, down, or drifting. Produce a prioritized remediation plan.