Spaces:
Paused
Paused
| #!/usr/bin/env python3 | |
| """ | |
| Test script to verify MCP and HTTP service availability | |
| """ | |
| import requests | |
| import asyncio | |
| import sys | |
| def test_http_endpoints(): | |
| """Test HTTP endpoints still work after MCP enablement""" | |
| print("π Testing HTTP endpoints...") | |
| # Test STT service | |
| stt_url = "https://pgits-stt-gpu-service.hf.space" | |
| try: | |
| response = requests.get(stt_url, timeout=10) | |
| print(f"β STT HTTP service accessible: {response.status_code}") | |
| except Exception as e: | |
| print(f"β STT HTTP service error: {e}") | |
| # Test TTS service | |
| tts_url = "https://pgits-tts-gpu-service.hf.space" | |
| try: | |
| response = requests.get(tts_url, timeout=10) | |
| print(f"β TTS HTTP service accessible: {response.status_code}") | |
| except Exception as e: | |
| print(f"β TTS HTTP service error: {e}") | |
| async def test_mcp_services(): | |
| """Test MCP service availability""" | |
| print("π Testing MCP services...") | |
| try: | |
| # Try to import MCP client | |
| from mcp import ClientSession | |
| print("β MCP client library available") | |
| # Test connecting to services | |
| # Note: Actual MCP connection would depend on service configuration | |
| print("π€ MCP STT service connection test...") | |
| print("π MCP TTS service connection test...") | |
| # For now, just verify the framework is ready | |
| print("β MCP framework ready for service connection") | |
| except ImportError as e: | |
| print(f"β MCP client not available: {e}") | |
| print("π¦ Installing MCP client may be needed") | |
| except Exception as e: | |
| print(f"β MCP connection error: {e}") | |
| def main(): | |
| """Main test function""" | |
| print("π§ͺ ChatCal MCP Service Test") | |
| print("=" * 50) | |
| # Test HTTP endpoints | |
| test_http_endpoints() | |
| print() | |
| # Test MCP services | |
| asyncio.run(test_mcp_services()) | |
| print() | |
| print("π Test completed!") | |
| print("Next: Enable MCP on your HF services if not already done") | |
| if __name__ == "__main__": | |
| main() |