feat: Implement unified launcher and update unified app for Gradio UI and MCP SSE server integration
0c00a27
| """ | |
| FleetMind Unified Launcher | |
| Runs both Gradio UI and MCP SSE server together | |
| """ | |
| import subprocess | |
| import sys | |
| import time | |
| import signal | |
| import os | |
| # Store processes for cleanup | |
| processes = [] | |
| def signal_handler(sig, frame): | |
| """Handle shutdown gracefully""" | |
| print("\n\nπ Shutting down FleetMind...") | |
| for proc in processes: | |
| proc.terminate() | |
| sys.exit(0) | |
| # Register signal handler | |
| signal.signal(signal.SIGINT, signal_handler) | |
| signal.signal(signal.SIGTERM, signal_handler) | |
| print("=" * 70) | |
| print("FleetMind - Unified Launcher (Gradio UI + MCP SSE Server)") | |
| print("=" * 70) | |
| # Start MCP SSE server (app.py) in background | |
| print("\n[1/2] Starting MCP SSE server...") | |
| mcp_process = subprocess.Popen( | |
| [sys.executable, "app.py"], | |
| stdout=subprocess.PIPE, | |
| stderr=subprocess.STDOUT, | |
| text=True, | |
| bufsize=1 | |
| ) | |
| processes.append(mcp_process) | |
| print("β MCP SSE server started (background)") | |
| # Give MCP server time to initialize | |
| time.sleep(2) | |
| # Start Gradio UI (ui/app.py) in foreground | |
| print("\n[2/2] Starting Gradio UI...") | |
| print("=" * 70) | |
| ui_process = subprocess.Popen( | |
| [sys.executable, "ui/app.py"], | |
| stdout=sys.stdout, | |
| stderr=sys.stderr | |
| ) | |
| processes.append(ui_process) | |
| print("\nβ Both services running!") | |
| print("=" * 70) | |
| print("π Gradio UI: http://0.0.0.0:7860") | |
| print("π MCP SSE: http://0.0.0.0:7860/sse") | |
| print("=" * 70) | |
| # Wait for UI process (it blocks) | |
| try: | |
| ui_process.wait() | |
| except KeyboardInterrupt: | |
| signal_handler(None, None) | |