#!/usr/bin/env php info('Starting MCP Apps Example Server...'); $server = Server::builder() ->setServerInfo('MCP Apps Weather Example', '1.0.0') ->setLogger(logger()) ->setSession(new FileSessionStore(__DIR__.'/sessions')) ->enableExtension(new McpApps()) ->addResource( [WeatherApp::class, 'getWeatherApp'], 'ui://weather-app', 'weather-app', description: 'Interactive weather dashboard', mimeType: McpApps::MIME_TYPE, meta: ['ui' => McpApps::resourceMarker()], ) ->addTool( [WeatherApp::class, 'getWeather'], 'get_weather', description: 'Get current weather for a city', meta: ['ui' => new UiToolMeta( resourceUri: 'ui://weather-app', visibility: [ToolVisibility::Model, ToolVisibility::App], )], ) ->build(); $result = $server->run(transport()); logger()->info('Server stopped gracefully.', ['result' => $result]); shutdown($result);