""" CanRun Game Compatibility Checker - Simple MCP Server Implementation """ import gradio as gr import logging import os import signal import sys import time import asyncio import base64 from src.canrun_engine import CanRunEngine from plugin import CanRunGAssistPlugin # Configure logging logging.basicConfig( level=logging.INFO, format="%(asctime)s - %(levelname)s - %(message)s", handlers=[logging.StreamHandler(sys.stdout)] ) logger = logging.getLogger(__name__) def signal_handler(signum, frame): """Handle shutdown signals gracefully.""" logger.info(f"Received signal {signum}, shutting down gracefully...") sys.exit(0) async def analyze_game(game_name): """Analyze game compatibility using the CanRun engine""" if not game_name: return "Please enter a game name to begin the analysis." try: plugin = CanRunGAssistPlugin() params = {"game_name": game_name, "force_refresh": True} # Properly await the async method response = await plugin.check_game_compatibility(params) if response.get("success", False): return response.get("message", "Analysis completed successfully.") else: return response.get("message", "Could not analyze the game. Please check the game name and try again.") except Exception as e: logger.error(f"Error analyzing game: {e}") return f"An error occurred during analysis: {e}" def detect_hardware(): """Detect hardware specifications""" try: plugin = CanRunGAssistPlugin() response = plugin.detect_hardware({}) if response.get("success", False): return response.get("message", "Hardware detection successful.") else: return response.get("message", "Could not detect hardware specifications.") except Exception as e: logger.error(f"Error detecting hardware: {e}") return f"An error occurred during hardware detection: {e}" def get_logo_html(): """Get HTML that displays the logo""" logo_path = os.path.join(os.path.dirname(__file__), "logo.png") if os.path.exists(logo_path): # Read the logo file and encode it as base64 with open(logo_path, "rb") as image_file: encoded_image = base64.b64encode(image_file.read()).decode("utf-8") # Return HTML that displays the logo return f"""
Check if your PC can run any game with an advanced tier system and Steam API integration
Check if your PC can run any game with an advanced tier system and Steam API integration
CanRun - Advanced Game Compatibility Checker with MCP Server Support
Powered by G-Assist Integration