feat: Require UUID token authorization for /shutdown endpoint

This commit is contained in:
Riz Ashraf committed 2026-09-19 06:02:02 +01:00
1 parent 53dce890ec
commit ce17ffcf42
3 files changed
+69 -32

No files matched your search

+6 -1
View File
@@ -1,6 +1,11 @@
try {
Write-Host "Gracefully shutting down server..."
Invoke-RestMethod -Method Post -Uri "http://127.0.0.1:3000/shutdown" -ErrorAction SilentlyContinue
$tokenPath = "C:\Users\reazul.ashraf\.gemini\mcp_memory\admin.token"
$headers = @{}
if (Test-Path $tokenPath) {
$headers["Authorization"] = "Bearer $(Get-Content -Path $tokenPath -Raw)".Trim()
}
Invoke-RestMethod -Method Post -Uri "http://127.0.0.1:3000/shutdown" -Headers $headers -ErrorAction SilentlyContinue | Out-Null
Start-Sleep -Seconds 2
} catch {
Write-Host "Server might already be down or unreachable."