Files
mcp-memory/deploy.ps1
T

33 lines
1.1 KiB
PowerShell

try {
Write-Host "Gracefully shutting down server..."
Invoke-RestMethod -Method Post -Uri "http://127.0.0.1:3000/shutdown" -ErrorAction SilentlyContinue
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."