# Test MCP Server
$process = Start-Process -FilePath ".\target\release\sqlx-mcp.exe" -NoNewWindow -PassThru -RedirectStandardInput -RedirectStandardOutput
# Initialize
$init = '{"jsonrpc": "2.0", "id": 1, "method": "initialize", "params": {"protocolVersion": "2024-11-05", "capabilities": {}, "clientInfo": {"name": "test", "version": "1.0"}}}'
$process.StandardInput.WriteLine($init)
# Wait a bit
Start-Sleep 1
# Test without database URL
$testNoUrl = '{"jsonrpc": "2.0", "id": 2, "method": "tools/call", "params": {"name": "get_database_info", "arguments": {}}}'
$process.StandardInput.WriteLine($testNoUrl)
# Wait a bit
Start-Sleep 1
# Test with database URL
$testWithUrl = '{"jsonrpc": "2.0", "id": 3, "method": "tools/call", "params": {"name": "get_database_info", "arguments": {"database_url": "postgresql://test_user:test_password@localhost:15432/test_db"}}}'
$process.StandardInput.WriteLine($testWithUrl)
# Wait for responses
Start-Sleep 2
# Read output
$output = $process.StandardOutput.ReadToEnd()
Write-Host $output
$process.Kill()