Files
flyer-crawler.projectium.com/plans/test-mcp-servers-clean.ps1
Torben Sorensen d356d9dfb6
Some checks failed
Deploy to Test Environment / deploy-to-test (push) Failing after 43s
claude 1
2026-01-08 07:47:29 -08:00

144 lines
7.1 KiB
PowerShell

# test-mcp-servers.ps1
# Automated testing script for all configured MCP servers
Write-Host "=== MCP Server Testing Suite ===" -ForegroundColor Cyan
Write-Host "Testing all configured MCP servers..." -ForegroundColor White
Write-Host ""
$results = @()
# Test 1: Chrome DevTools
Write-Host "[1/8] Testing Chrome DevTools..." -ForegroundColor Yellow
try {
$chromeProc = Start-Process -FilePath "npx" -ArgumentList "-y","chrome-devtools-mcp@latest","--headless","true" -PassThru -NoNewWindow -RedirectStandardOutput "$env:TEMP\chrome-test.log" -ErrorAction Stop
Start-Sleep -Seconds 5
if (!$chromeProc.HasExited) {
Write-Host " ✓ Chrome DevTools server started successfully" -ForegroundColor Green
$results += [PSCustomObject]@{Server="Chrome DevTools"; Status="PASS"; Details="Server started"}
Stop-Process -Id $chromeProc.Id -Force -ErrorAction SilentlyContinue
} else {
Write-Host " ✗ Chrome DevTools server exited immediately" -ForegroundColor Red
$results += [PSCustomObject]@{Server="Chrome DevTools"; Status="FAIL"; Details="Server exited"}
}
} catch {
Write-Host " ✗ Chrome DevTools failed: $($_.Exception.Message)" -ForegroundColor Red
$results += [PSCustomObject]@{Server="Chrome DevTools"; Status="FAIL"; Details=$_.Exception.Message}
}
# Test 2: Markitdown
Write-Host "`n[2/8] Testing Markitdown..." -ForegroundColor Yellow
$markitdownPath = "C:\Users\games3\.local\bin\uvx.exe"
if (Test-Path $markitdownPath) {
Write-Host " ✓ Markitdown executable found at: $markitdownPath" -ForegroundColor Green
$results += [PSCustomObject]@{Server="Markitdown"; Status="PASS"; Details="Executable exists"}
} else {
Write-Host " ✗ Markitdown executable not found at: $markitdownPath" -ForegroundColor Red
$results += [PSCustomObject]@{Server="Markitdown"; Status="FAIL"; Details="Executable not found"}
}
# Test 3: Gitea Torbonium
Write-Host "`n[3/8] Testing Gitea Torbonium (gitea.torbonium.com)..." -ForegroundColor Yellow
try {
$headers = @{Authorization="token 391c9ddbe113378bc87bb8184800ba954648fcf8"}
$response = Invoke-RestMethod -Uri "https://gitea.torbonium.com/api/v1/user" -Headers $headers -TimeoutSec 10
Write-Host " ✓ Gitea Torbonium authenticated as: $($response.login)" -ForegroundColor Green
$results += [PSCustomObject]@{Server="Gitea Torbonium"; Status="PASS"; Details="Authenticated as $($response.login)"}
} catch {
Write-Host " ✗ Gitea Torbonium failed: $($_.Exception.Message)" -ForegroundColor Red
$results += [PSCustomObject]@{Server="Gitea Torbonium"; Status="FAIL"; Details=$_.Exception.Message}
}
# Test 4: Gitea LAN
Write-Host "`n[4/8] Testing Gitea LAN (gitea.torbolan.com)..." -ForegroundColor Yellow
Write-Host " âš  Token needs replacement - SKIPPING" -ForegroundColor Yellow
$results += [PSCustomObject]@{Server="Gitea LAN"; Status="SKIP"; Details="Token placeholder needs update"}
# Test 5: Gitea Projectium
Write-Host "`n[5/8] Testing Gitea Projectium (gitea.projectium.com)..." -ForegroundColor Yellow
try {
$headers = @{Authorization="token c72bc0f14f623fec233d3c94b3a16397fe3649ef"}
$response = Invoke-RestMethod -Uri "https://gitea.projectium.com/api/v1/user" -Headers $headers -TimeoutSec 10
Write-Host " ✓ Gitea Projectium authenticated as: $($response.login)" -ForegroundColor Green
$results += [PSCustomObject]@{Server="Gitea Projectium"; Status="PASS"; Details="Authenticated as $($response.login)"}
} catch {
Write-Host " ✗ Gitea Projectium failed: $($_.Exception.Message)" -ForegroundColor Red
$results += [PSCustomObject]@{Server="Gitea Projectium"; Status="FAIL"; Details=$_.Exception.Message}
}
# Test 6: Podman/Docker
Write-Host "`n[6/8] Testing Docker/Podman..." -ForegroundColor Yellow
try {
$dockerOutput = & docker version 2>$null
if ($LASTEXITCODE -eq 0 -and $dockerOutput) {
Write-Host " ✓ Docker daemon accessible" -ForegroundColor Green
$results += [PSCustomObject]@{Server="Docker/Podman"; Status="PASS"; Details="Docker daemon running"}
} else {
Write-Host " ✗ Docker daemon not accessible" -ForegroundColor Red
$results += [PSCustomObject]@{Server="Docker/Podman"; Status="FAIL"; Details="Cannot connect to daemon"}
}
} catch {
Write-Host " ✗ Docker not available: $($_.Exception.Message)" -ForegroundColor Red
$results += [PSCustomObject]@{Server="Docker/Podman"; Status="FAIL"; Details="Docker not installed"}
}
# Test 7: Filesystem
Write-Host "`n[7/8] Testing Filesystem..." -ForegroundColor Yellow
$projectPath = "D:\gitea\flyer-crawler.projectium.com\flyer-crawler.projectium.com"
if (Test-Path $projectPath) {
$fileCount = (Get-ChildItem $projectPath -File -Recurse -ErrorAction SilentlyContinue | Measure-Object).Count
Write-Host " ✓ Project directory accessible ($fileCount files)" -ForegroundColor Green
$results += [PSCustomObject]@{Server="Filesystem"; Status="PASS"; Details="Path accessible, $fileCount files"}
} else {
Write-Host " ✗ Project directory not accessible" -ForegroundColor Red
$results += [PSCustomObject]@{Server="Filesystem"; Status="FAIL"; Details="Path not accessible"}
}
# Test 8: Fetch MCP Server
Write-Host "`n[8/8] Testing Fetch MCP Server..." -ForegroundColor Yellow
try {
# Test by attempting to fetch a simple public API
$testUrl = "https://api.github.com/zen"
$response = Invoke-RestMethod -Uri $testUrl -TimeoutSec 10 -ErrorAction Stop
if ($response) {
Write-Host " ✓ Fetch server prerequisites met (network accessible)" -ForegroundColor Green
$results += [PSCustomObject]@{Server="Fetch"; Status="PASS"; Details="Network accessible, can fetch data"}
} else {
Write-Host " ✗ Fetch server test failed" -ForegroundColor Red
$results += [PSCustomObject]@{Server="Fetch"; Status="FAIL"; Details="Could not fetch test data"}
}
} catch {
Write-Host " ✗ Fetch server test failed: $($_.Exception.Message)" -ForegroundColor Red
$results += [PSCustomObject]@{Server="Fetch"; Status="FAIL"; Details=$_.Exception.Message}
}
# Display Results Summary
Write-Host "`n`n=== Test Results Summary ===" -ForegroundColor Cyan
Write-Host ""
$results | Format-Table -AutoSize
# Count results
$passed = ($results | Where-Object Status -eq "PASS").Count
$failed = ($results | Where-Object Status -eq "FAIL").Count
$skipped = ($results | Where-Object Status -eq "SKIP").Count
$total = $results.Count
Write-Host "`nOverall Results:" -ForegroundColor White
Write-Host " Total Tests: $total" -ForegroundColor White
Write-Host " Passed: $passed" -ForegroundColor Green
Write-Host " Failed: $failed" -ForegroundColor Red
Write-Host " Skipped: $skipped" -ForegroundColor Yellow
# Exit code based on results
if ($failed -gt 0) {
Write-Host "`n⚠️ Some tests failed. Review the results above." -ForegroundColor Yellow
exit 1
} elseif ($passed -eq ($total - $skipped)) {
Write-Host "`n✓ All tests passed!" -ForegroundColor Green
exit 0
} else {
Write-Host "`n⚠️ Tests completed with warnings." -ForegroundColor Yellow
exit 0
}