38 lines
1.3 KiB
PowerShell
38 lines
1.3 KiB
PowerShell
try {
|
|
Write-Host "Gracefully shutting down server..."
|
|
$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."
|
|
}
|
|
|
|
$binaries = @('mcp-memory-server.exe', 'mcp-memory-stub.exe', 'mcp-memory-win-nvim.exe')
|
|
$timestamp = (Get-Date -UFormat "%s") -replace "\.",""
|
|
|
|
foreach ($b in $binaries) {
|
|
$s = "target\release\$b"
|
|
$d = "C:\Users\reazul.ashraf\.local\bin\$b"
|
|
|
|
if (Test-Path $d) {
|
|
$backupName = "$b.$timestamp.bak"
|
|
Write-Host "Renaming $b to $backupName to avoid file locks..."
|
|
Rename-Item $d $backupName -Force -ErrorAction SilentlyContinue
|
|
}
|
|
|
|
if (Test-Path $s) {
|
|
Write-Host "Deploying new $b..."
|
|
Copy-Item $s $d -Force
|
|
} else {
|
|
Write-Host "Warning: $s not found, skipping."
|
|
}
|
|
}
|
|
|
|
Write-Host "Starting new mcp-memory-server daemon..."
|
|
Start-Process -FilePath "C:\Users\reazul.ashraf\.local\bin\mcp-memory-server.exe" -WindowStyle Hidden
|
|
Write-Host "Deployment complete."
|