#ifndef ESP_PLATFORM #include #include #include #include #include namespace tt::app::mcpsettings { struct Context { AppInstanceId instanceId; }; void createMcpInfo(lv_obj_t* parent, void* userData) { auto* context = static_cast(userData); lv_obj_t* title = lv_label_create(parent); lv_label_set_text(title, "MCP Settings"); lv_obj_align(title, LV_ALIGN_TOP_MID, 0, 18); lv_obj_t* info = lv_label_create(parent); lv_label_set_text(info, "MCP is available while the simulator web server is running.\n\n" "Endpoint: POST /api/mcp\n" "JSON-RPC methods: tools/list, tools/call\n\n" "Simulator tools: get_capabilities, clear_screen, draw_text, list_apps, run_app\n\n" "Open the simulator dashboard/API at http://127.0.0.1/api/sysinfo."); lv_label_set_long_mode(info, LV_LABEL_LONG_WRAP); lv_obj_set_width(info, LV_PCT(90)); lv_obj_align(info, LV_ALIGN_CENTER, 0, 8); (void)context; } int32_t appMain(int, char**) { Context context{app_scheduler_current_app_id()}; TaskEventGroup group{}; task_event_group_construct(&group); AppEventSubscription subscription{}; if (app_event_subscribe(&subscription, &group) != ERROR_NONE) { task_event_group_destruct(&group); return -1; } auto window = window_manager_create(context.instanceId, createMcpInfo, &context); bool close = false; while (!close) { task_event_group_wait_any(&group, nullptr, portMAX_DELAY); AppEvent event{}; while (app_event_poll(&subscription, &event) == ERROR_NONE) { if (event.type == APP_EVENT_CLOSE) { close = true; break; } } } window_manager_remove(window); app_event_unsubscribe(&subscription); task_event_group_destruct(&group); return 0; } extern const AppManifest manifest = { .id = "McpSettings", .name = "MCP Settings", .category = APP_CATEGORY_SETTINGS, .location = {APP_LOCATION_MEMORY, reinterpret_cast(appMain)}, .flags = 0, .stack = {.depth = 8192, .desired_memory_capability = 0} }; } #endif