File size: 1,624 Bytes
837c66d
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
#!/usr/bin/env python3
"""
Test script to verify MCP server connection
"""

import asyncio
import aiohttp
import json

async def test_mcp_server():
    """Test the MCP server on Hugging Face Spaces"""
    url = "https://galcan-mcp-docs-server.hf.space"
    
    print("Testing MCP server connection...")
    print(f"URL: {url}")
    
    try:
        async with aiohttp.ClientSession() as session:
            # Test health check
            async with session.get(f"{url}/") as response:
                if response.status == 200:
                    data = await response.json()
                    print(f"[OK] Health check passed: {data}")
                else:
                    print(f"[ERROR] Health check failed: {response.status}")
                    return False
            
            # Test search endpoint
            search_data = {
                "query": "MCP architecture",
                "limit": 3
            }
            
            async with session.post(f"{url}/search", json=search_data) as response:
                if response.status == 200:
                    data = await response.json()
                    print(f"[OK] Search test passed: Found {data.get('total', 0)} results")
                else:
                    print(f"[ERROR] Search test failed: {response.status}")
                    return False
            
            print("[SUCCESS] MCP server is working correctly!")
            return True
            
    except Exception as e:
        print(f"[ERROR] Connection failed: {e}")
        return False

if __name__ == "__main__":
    asyncio.run(test_mcp_server())