import asyncio
import httpx

async def test_mcp_endpoint():
    print("测试LiteLLM的MCP端点...")
    
    # Test different endpoints
    endpoints = [
        "http://localhost:4000/health",
        "http://localhost:4000/v1/models", 
        "http://localhost:4000/mcp/",
        "http://localhost:4000/mcp"
    ]
    
    async with httpx.AsyncClient() as client:
        for endpoint in endpoints:
            try:
                print(f"\n测试端点: {endpoint}")
                response = await client.get(
                    endpoint,
                    headers={
                        "Authorization": "Bearer sk-1234567890abcdef",
                        "Accept": "text/event-stream"
                    },
                    timeout=5.0
                )
                print(f"状态码: {response.status_code}")
                print(f"响应头: {dict(response.headers)}")
                if response.status_code == 200:
                    content = response.text[:500]  # 只显示前500字符
                    print(f"响应内容: {content}")
                else:
                    print(f"错误响应: {response.text}")
                    
            except Exception as e:
                print(f"请求失败: {type(e).__name__}: {e}")

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