setup static method

Future<McpConnectivityInfo> setup({
  1. required int appPort,
  2. int? forwardPort,
})

Configures port forwarding for the current platform and returns connectivity information for logs/debug.

appPort is the port where the HTTP server listens inside the app. forwardPort is the local port on the dev's PC (Android/iOS only).

Implementation

static Future<McpConnectivityInfo> setup({
  required int appPort,
  int? forwardPort,
}) async {
  final fwPort = forwardPort ?? (appPort + 1);

  if (kIsWeb) return _webInfo(appPort);

  if (Platform.isAndroid) return _setupAndroid(appPort, fwPort);
  if (Platform.isIOS) return _setupIOS(appPort, fwPort);
  if (Platform.isMacOS || Platform.isLinux || Platform.isWindows) {
    return _desktopInfo(appPort);
  }

  return _unknownInfo(appPort);
}