Skip to main content
Glama
test_final_system.pyโ€ข5.76 kB
#!/usr/bin/env python3 """ Final System Test Test the production MCP system functionality """ import requests import json from datetime import datetime def test_production_system(): """Test the production MCP system.""" base_url = "http://localhost:8000" print("๐Ÿงช TESTING PRODUCTION MCP SYSTEM") print("=" * 60) print(f"๐Ÿ• Started at: {datetime.now().strftime('%Y-%m-%d %H:%M:%S')}") print("=" * 60) # Test 1: Server Health print("\n๐Ÿ” Test 1: Server Health") try: response = requests.get(f"{base_url}/api/health") if response.status_code == 200: health = response.json() print(f" โœ… Server Status: {health.get('status')}") print(f" โœ… Ready: {health.get('ready')}") print(f" โœ… Loaded Agents: {health.get('system', {}).get('loaded_agents', 0)}") else: print(f" โŒ Health check failed: {response.status_code}") except Exception as e: print(f" โŒ Health check error: {e}") # Test 2: Math Calculation print("\n๐Ÿ”ข Test 2: Math Calculation") try: response = requests.post( f"{base_url}/api/mcp/command", json={"command": "Calculate 25 * 4"}, timeout=10 ) if response.status_code == 200: result = response.json() print(f" โœ… Status: {result.get('status')}") print(f" ๐Ÿค– Agent: {result.get('agent_used')}") print(f" ๐Ÿ“Š Result: {result.get('result', 'N/A')}") print(f" ๐Ÿ’พ Stored: {result.get('stored_in_mongodb', False)}") else: print(f" โŒ Math test failed: {response.status_code}") except Exception as e: print(f" โŒ Math test error: {e}") # Test 3: Weather Query print("\n๐ŸŒค๏ธ Test 3: Weather Query") try: response = requests.post( f"{base_url}/api/mcp/command", json={"command": "What is the weather in Mumbai?"}, timeout=15 ) if response.status_code == 200: result = response.json() print(f" โœ… Status: {result.get('status')}") print(f" ๐Ÿค– Agent: {result.get('agent_used')}") print(f" ๐ŸŒ City: {result.get('city', 'N/A')}") print(f" ๐Ÿ’พ Stored: {result.get('stored_in_mongodb', False)}") else: print(f" โŒ Weather test failed: {response.status_code}") except Exception as e: print(f" โŒ Weather test error: {e}") # Test 4: Document Analysis print("\n๐Ÿ“„ Test 4: Document Analysis") try: response = requests.post( f"{base_url}/api/mcp/command", json={"command": "Analyze this text: Hello world, this is a test document."}, timeout=10 ) if response.status_code == 200: result = response.json() print(f" โœ… Status: {result.get('status')}") print(f" ๐Ÿค– Agent: {result.get('agent_used')}") print(f" ๐Ÿ“Š Processed: {result.get('total_documents', 0)} documents") print(f" ๐Ÿ’พ Stored: {result.get('stored_in_mongodb', False)}") else: print(f" โŒ Document test failed: {response.status_code}") except Exception as e: print(f" โŒ Document test error: {e}") # Test 5: Agent Management print("\n๐Ÿ”ง Test 5: Agent Management") try: response = requests.get(f"{base_url}/api/agents") if response.status_code == 200: agents_data = response.json() summary = agents_data.get('summary', {}) print(f" โœ… Total Agents: {summary.get('total_agents', 0)}") print(f" โœ… Loaded Agents: {summary.get('loaded_agents', 0)}") print(f" โœ… Failed Agents: {summary.get('failed_agents', 0)}") agents = agents_data.get('agents', {}) loaded_agents = [aid for aid, info in agents.items() if info.get('status') == 'loaded'] print(f" ๐Ÿ“‹ Loaded: {', '.join(loaded_agents)}") else: print(f" โŒ Agent management test failed: {response.status_code}") except Exception as e: print(f" โŒ Agent management test error: {e}") # Test 6: Agent Discovery print("\n๐Ÿ” Test 6: Agent Discovery") try: response = requests.get(f"{base_url}/api/agents/discover") if response.status_code == 200: discovery = response.json() discovered = discovery.get('discovered', {}) print(f" โœ… Live: {len(discovered.get('live', []))} agents") print(f" โœ… Inactive: {len(discovered.get('inactive', []))} agents") print(f" โœ… Future: {len(discovered.get('future', []))} agents") print(f" โœ… Templates: {len(discovered.get('templates', []))} agents") else: print(f" โŒ Discovery test failed: {response.status_code}") except Exception as e: print(f" โŒ Discovery test error: {e}") print("\n" + "=" * 60) print("๐ŸŽ‰ PRODUCTION SYSTEM TEST COMPLETED") print("=" * 60) print(f"๐Ÿ• Completed at: {datetime.now().strftime('%Y-%m-%d %H:%M:%S')}") print("\n๐Ÿ“Š SYSTEM CAPABILITIES:") print(" โœ… Production MCP Server v2.0.0") print(" โœ… Modular Agent Architecture") print(" โœ… Auto-Discovery & Hot-Swapping") print(" โœ… Fault-Tolerant Agent Management") print(" โœ… Health Monitoring & Recovery") print(" โœ… MongoDB Integration") print(" โœ… Inter-Agent Communication") print(" โœ… Scalable Deployment Ready") if __name__ == "__main__": test_production_system()

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/tensorwhiz141/MCP2'

If you have feedback or need assistance with the MCP directory API, please join our Discord server