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
Federation-wide gold (XAUUSD) trading capability. Python stack, OANDA broker, backtesting, macro signals, RSI strategy. Every organ has a role.
development
Capital claim state management — tracks claim lifecycle across WEALTH organ.
development
Archived constitutional warga placeholder retained only for audit provenance. Do not use for active work; use the live arifOS governance and constitutional skills instead.
testing
Warga (citizen) agent skills for AAA federation members. See subdirectories for specialized warga skills.