#!/usr/bin/env python3
"""
Test script for Oura MCP Server
"""
import asyncio
from server import client, get_daily_sleep, get_daily_readiness, get_personal_info
async def test_server():
"""Test the Oura MCP server functionality"""
print("=" * 60)
print("Testing Oura MCP Server")
print("=" * 60)
print()
try:
# Test 1: Get personal info
print("Test 1: Getting personal info...")
result = await get_personal_info()
print(f"✓ Personal info retrieved")
print(f" Preview: {result[:200]}...")
print()
# Test 2: Get daily readiness
print("Test 2: Getting daily readiness (last 7 days)...")
from datetime import datetime, timedelta
end_date = datetime.now().strftime("%Y-%m-%d")
start_date = (datetime.now() - timedelta(days=7)).strftime("%Y-%m-%d")
result = await get_daily_readiness(start_date, end_date)
print(f"✓ Daily readiness retrieved")
print(f" Date range: {start_date} to {end_date}")
print(f" Preview: {result[:200]}...")
print()
# Test 3: Get daily sleep
print("Test 3: Getting daily sleep (last 7 days)...")
result = await get_daily_sleep(start_date, end_date)
print(f"✓ Daily sleep retrieved")
print(f" Date range: {start_date} to {end_date}")
print(f" Preview: {result[:200]}...")
print()
print("=" * 60)
print("All tests passed! ✓")
print("=" * 60)
print()
print("Your Oura MCP server is working correctly!")
print("You can now:")
print(" 1. Add it to Claude Desktop (see README.md)")
print(" 2. Deploy to AWS Bedrock (run ./deploy-bedrock.sh)")
print()
except Exception as e:
print(f"✗ Error: {e}")
print()
print("Please check:")
print(" 1. Your OURA_PERSONAL_ACCESS_TOKEN is correct in .env")
print(" 2. Your Oura Ring has synced data")
print(" 3. You have internet connectivity")
return 1
return 0
if __name__ == "__main__":
exit_code = asyncio.run(test_server())
exit(exit_code)