"""Simple test script for MCP server - Windows compatible""" import requests import json BASE_URL = "https://chunte-thumbnail-crafter-mini-mcp-experiment.hf.space" print("\n" + "="*60) print(" Thumbnail Crafter MCP Server - Test Suite") print(" Testing:", BASE_URL) print("="*60 + "\n") # Test 1: Health print("TEST 1: Health Check") print("-" * 40) try: r = requests.get(f"{BASE_URL}/health", timeout=10) print(f"Status: {r.status_code}") if r.status_code == 200: print("PASS - Server is healthy") print(f"Response: {r.json()}") else: print("FAIL - Bad status code") except Exception as e: print(f"FAIL - Error: {e}") print("\n" + "="*60 + "\n") # Test 2: Layout List print("TEST 2: List Layouts") print("-" * 40) try: r = requests.post( f"{BASE_URL}/tools", json={"name": "layout_list", "arguments": {}}, timeout=60 ) print(f"Status: {r.status_code}") if r.status_code == 200: data = r.json() if data.get('success'): print("PASS - Got layouts") print(f"Layouts available: {len(data.get('layouts', []))}") for layout in data.get('layouts', []): print(f" - {layout['id']}: {layout['name']}") else: print(f"FAIL - {data.get('error')}") else: print("FAIL - Bad status code") print(f"Response: {r.text[:300]}") except Exception as e: print(f"FAIL - Error: {e}") print("\n" + "="*60 + "\n") # Test 3: Canvas State print("TEST 3: Get Canvas State") print("-" * 40) try: r = requests.post( f"{BASE_URL}/tools", json={"name": "canvas_get_state", "arguments": {}}, timeout=60 ) print(f"Status: {r.status_code}") if r.status_code == 200: data = r.json() if data.get('success'): print("PASS - Got canvas state") state = data.get('state', {}) print(f"Canvas size: {state.get('canvasSize')}") print(f"Background: {state.get('bgColor')}") print(f"Objects: {len(state.get('objects', []))}") else: print(f"FAIL - {data.get('error')}") else: print("FAIL - Bad status code") except Exception as e: print(f"FAIL - Error: {e}") print("\n" + "="*60) print(" Tests Complete!") print("="*60 + "\n")