Spaces:
Sleeping
Sleeping
| #!/usr/bin/env python3 | |
| """ | |
| Manual MCP Server Test | |
| Tests the MCP server can be imported and basic functions work | |
| """ | |
| import sys | |
| from pathlib import Path | |
| # Add current directory to path | |
| sys.path.insert(0, str(Path(__file__).parent)) | |
| print("π§ͺ Testing ArchFlow MCP Server\n") | |
| # Test 1: Import server | |
| print("Test 1: Importing mcp_server...") | |
| try: | |
| import mcp_server | |
| print("β Successfully imported mcp_server\n") | |
| except ImportError as e: | |
| print(f"β Failed to import: {e}\n") | |
| sys.exit(1) | |
| # Test 2: Check server instance | |
| print("Test 2: Checking server instance...") | |
| if hasattr(mcp_server, 'server'): | |
| print(f"β Server instance found: {mcp_server.server}\n") | |
| else: | |
| print("β Server instance not found\n") | |
| sys.exit(1) | |
| # Test 3: Check handlers | |
| print("Test 3: Checking registered handlers...") | |
| server = mcp_server.server | |
| handlers = [] | |
| if hasattr(server, '_list_tools_handler'): | |
| handlers.append("list_tools") | |
| if hasattr(server, '_call_tool_handler'): | |
| handlers.append("call_tool") | |
| if hasattr(server, '_list_resources_handler'): | |
| handlers.append("list_resources") | |
| if hasattr(server, '_read_resource_handler'): | |
| handlers.append("read_resource") | |
| print(f"β Found {len(handlers)} handlers: {', '.join(handlers)}\n") | |
| # Test 4: Check app.py integration | |
| print("Test 4: Checking app.py integration...") | |
| try: | |
| from app import detect_patterns_in_text, TECH_PATTERNS | |
| print(f"β App integration working") | |
| print(f" - {len(TECH_PATTERNS)} tech patterns loaded\n") | |
| except ImportError as e: | |
| print(f"β App integration failed: {e}\n") | |
| # Test 5: Test pattern detection | |
| print("Test 5: Testing pattern detection...") | |
| try: | |
| test_text = "We're using Kubernetes and microservices" | |
| sirens, good = detect_patterns_in_text(test_text) | |
| print(f"β Pattern detection working") | |
| print(f" - Detected {len(sirens)} anti-patterns") | |
| print(f" - Detected {len(good)} good practices\n") | |
| except Exception as e: | |
| print(f"β Pattern detection failed: {e}\n") | |
| print("π All manual tests passed!") | |
| print("\nπ Next steps:") | |
| print(" 1. Install MCP SDK: pip install mcp") | |
| print(" 2. Run validation: python mcp_validation.py") | |
| print(" 3. Test with MCP Inspector or Claude Desktop\n") | |