#!/usr/bin/env python3
"""
Test script to verify the QML MCP server can start and list tools.
"""
import asyncio
import sys
import os
# Add the project directory to the path
sys.path.insert(0, os.path.dirname(os.path.abspath(__file__)))
async def test_server_startup():
"""Test that the server can start and list tools."""
from server import list_tools
print("Testing QML MCP Server startup...")
print("-" * 60)
try:
tools = await list_tools()
print(f"\n✓ Server initialized successfully!")
print(f"✓ Found {len(tools)} tools:\n")
for i, tool in enumerate(tools, 1):
print(f"{i}. {tool.name}")
print(f" Description: {tool.description[:100]}...")
print()
print("-" * 60)
print("✓ All checks passed!")
return True
except Exception as e:
print(f"\n✗ Error during startup: {e}")
import traceback
traceback.print_exc()
return False
if __name__ == "__main__":
success = asyncio.run(test_server_startup())
sys.exit(0 if success else 1)