archflow-mcp / test_mcp_server.py
Ryan Cashman
Add MCP protocol validation and deployment infrastructure
600fa7d
#!/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")