MCP utilities¶
Request resolution¶
verify_api_key_and_get_db_list_and_ai_configuration returns the resolved
database list, AI configuration and runtime configuration. It first validates
X-API-Key against AI_HUB_USER_API_KEY or AI_HUB_ADMIN_API_KEY. If both
variables are absent or empty, it falls back to MongoDB only without
DATABASE_URL, routing with the key's clientId, or Client-ID as fallback,
plus the smartmobility data source. With DATABASE_URL, one of the configured
environment keys is required and the function reuses the FastAPI application's
PostgreSQL resources.
PostgreSQL MCP requests do not require MongoDB tenant-routing headers.
Shared helpers¶
get_user_by_user_application_idretrieves an active user by application ID;specific_commandsimplements/clear_historyfor agent wrappers.