Skip to main content
Glama

MCP Learning Project

by BerdTan
simple_test.pyโ€ข2.81 kB
#!/usr/bin/env python3 """ Simple test to verify our MCP server setup """ import asyncio import json import logging import sys from pathlib import Path # Set up logging logging.basicConfig(level=logging.INFO) logger = logging.getLogger(__name__) print("๐Ÿš€ MCP Testing Harness - Simple Test") print("=" * 40) # Test 1: Check if we can import our modules print("\n๐Ÿ“ฆ Testing imports...") try: # Add src to path sys.path.insert(0, str(Path(__file__).parent / "src")) from core.server import MCPServer from core.testing import MCPServerTester print("โœ… Imports successful!") except ImportError as e: print(f"โŒ Import error: {e}") sys.exit(1) # Test 2: Create server instance print("\n๐Ÿ”ง Testing server creation...") try: server = MCPServer(host="localhost", port=8000, debug=True) print("โœ… Server created successfully!") except Exception as e: print(f"โŒ Server creation failed: {e}") sys.exit(1) # Test 3: Create tester instance print("\n๐Ÿงช Testing tester creation...") try: tester = MCPServerTester() print("โœ… Tester created successfully!") except Exception as e: print(f"โŒ Tester creation failed: {e}") sys.exit(1) # Test 4: Test server registry print("\n๐Ÿ“‹ Testing server registry...") async def test_registry(): try: from core.server import MCPServerInfo from datetime import datetime # Create test server info test_server = MCPServerInfo( id="", name="Test Server", description="A test server", version="1.0.0", host="localhost", port=8001, status="stopped", created_at=datetime.now(), tools=[], config={} ) # Register server server_id = await server.registry.register_server(test_server) print(f"โœ… Server registered with ID: {server_id}") # List servers servers = await server.registry.list_servers() print(f"โœ… Found {len(servers)} registered servers") # Unregister server success = await server.registry.unregister_server(server_id) print(f"โœ… Server unregistered: {'Success' if success else 'Failed'}") except Exception as e: print(f"โŒ Registry test failed: {e}") # Run the async test print("\n๐Ÿ”„ Running registry test...") asyncio.run(test_registry()) print("\n๐ŸŽ‰ All tests completed successfully!") print("\n๐Ÿ’ก Your MCP Testing Harness is ready!") print(" Next steps:") print(" 1. Run: python simple_test.py") print(" 2. Start the server: python src/main.py") print(" 3. Test with an MCP client")

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/BerdTan/mcpharness'

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