Pulse/scripts/install-mcp.ps1
rcourtman 3da835c5bc Publish a distribution path for pulse-mcp
The MCP adapter shipped in slice 51 with one install option:
clone the repo and go build. This slice integrates pulse-mcp
into Pulse's existing governed release pipeline so a Pulse
release publishes a pulse-mcp binary alongside the unified agent
and the install scripts that bring it home in one command.

What ships:

  - scripts/build-release.sh extended to build pulse-mcp for
    the same multi-OS matrix as the unified agent, package
    per-platform tarballs and zips, and copy bare binaries to
    RELEASE_DIR for /releases/latest/download/ redirect
    compatibility.
  - .github/workflows/create-release.yml extended to upload
    the bare pulse-mcp binaries plus install-mcp.sh and
    install-mcp.ps1 as release assets.
  - scripts/install-mcp.sh: bash one-line installer that
    detects platform/arch, downloads the matching binary from
    the configured release (latest by default), verifies SHA256
    against the published checksums.txt, places at
    ~/.local/bin/pulse-mcp (or /usr/local/bin if not writable).
    Honors PULSE_MCP_VERSION, PULSE_MCP_BIN_DIR, PULSE_MCP_REPO,
    PULSE_MCP_NO_VERIFY env vars; declines Windows shells with
    a pointer at the .ps1 sibling.
  - scripts/install-mcp.ps1: PowerShell installer for Windows,
    placing pulse-mcp.exe at $LOCALAPPDATA\pulse-mcp.

Documentation aligned:

  - cmd/pulse-mcp/README.md gains an Install section above
    Quick start with three options: one-line installer,
    GitHub Release download, go install. Documents the macOS
    Gatekeeper bypass since v1 is unnotarized by design.
  - The Settings -> API Access agent-integrations panel now
    surfaces the curl|bash command above the config snippet so
    operators see "install pulse-mcp" before "configure your
    MCP client."
  - docs/releases/AGENT_PARADIGM.md drops the "no published
    distribution path" item from "what it does not do yet" and
    documents the Gatekeeper / Homebrew gaps as next-tier
    follow-ups.

Trade-offs surfaced and chosen:

  - Same cadence as Pulse: pulse-mcp ships per Pulse release,
    not on its own track. The MCP server reads the manifest
    from the Pulse it talks to, so version alignment is the
    natural model.
  - No Homebrew tap or core formula in v1. Maintaining a tap
    is real ongoing work; foundation supports adding Homebrew
    later as a layer.
  - No Docker image. Stdio JSON-RPC fights Docker's stdin
    /stdout pattern.
  - No notarization in v1. SHA256 verification through the
    installer preserves the audit trail; README documents the
    Gatekeeper bypass.

Subsystem contract: deployment-installability.md gains
scripts/install-mcp.sh, scripts/install-mcp.ps1, and
cmd/pulse-mcp/ in canonical files (mid-list entries
renumbered) plus a paragraph documenting the new MCP entry
point alongside the existing installer family.

Verification artifacts:

  - scripts/installtests/build_release_assets_test.go gains
    TestBuildReleasePackagesPulseMcpForAllPlatforms which pins
    the build/package/copy wiring and the load-bearing
    install-mcp.sh helpers (platform detection, SHA256
    verification, install-dir resolution).
  - scripts/release_control/render_release_body_test.py gains
    test_agent_paradigm_release_notes_blurb_documents_-
    distribution_path which pins the AGENT_PARADIGM.md draft's
    install-mcp.sh reference and the four-axis frame so a
    future edit cannot regress the install story silently.

Smoke-tested install-mcp.sh locally on darwin-arm64: platform
detection, install-dir resolution, URL building, and 404 error
handling all correct. The full end-to-end install path becomes
live the moment a Pulse release ships pulse-mcp binaries; the
next RC cut will exercise it.
2026-05-10 17:04:49 +01:00

129 lines
4.6 KiB
PowerShell

# Pulse MCP Server Adapter Installer (Windows)
#
# Detects the local architecture, downloads the matching pulse-mcp.exe
# from the latest GitHub Release, verifies SHA256 against the published
# checksums file, and places the binary on PATH.
#
# Usage:
# irm https://github.com/rcourtman/Pulse/releases/latest/download/install-mcp.ps1 | iex
#
# Options (env vars):
# PULSE_MCP_VERSION Override the version to install. Default: latest.
# PULSE_MCP_BIN_DIR Where to install. Default: $env:LOCALAPPDATA\pulse-mcp.
# PULSE_MCP_REPO GitHub repo. Default: rcourtman/Pulse.
# PULSE_MCP_NO_VERIFY If "1", skip SHA256 verification (not recommended).
#
# After install, configure your MCP client per the README:
# https://github.com/rcourtman/Pulse/blob/main/cmd/pulse-mcp/README.md
param (
[string]$Version = $env:PULSE_MCP_VERSION,
[string]$BinDir = $env:PULSE_MCP_BIN_DIR,
[string]$Repo = $env:PULSE_MCP_REPO,
[switch]$NoVerify
)
$ErrorActionPreference = 'Stop'
if (-not $Version) { $Version = 'latest' }
if (-not $Repo) { $Repo = 'rcourtman/Pulse' }
if (-not $BinDir) { $BinDir = Join-Path $env:LOCALAPPDATA 'pulse-mcp' }
if ($env:PULSE_MCP_NO_VERIFY -eq '1') { $NoVerify = $true }
function Write-Log($message) {
Write-Host "[install-mcp] $message"
}
function Resolve-Architecture {
$arch = $env:PROCESSOR_ARCHITECTURE
switch ($arch) {
'AMD64' { return 'amd64' }
'ARM64' { return 'arm64' }
'X86' { return '386' }
default {
throw "Unsupported architecture: $arch. Build from source: go install github.com/rcourtman/pulse-go-rewrite/cmd/pulse-mcp@latest"
}
}
}
function Resolve-ReleaseBase {
if ($Version -eq 'latest') {
return "https://github.com/$Repo/releases/latest/download"
}
return "https://github.com/$Repo/releases/download/$Version"
}
function Get-RemoteChecksum($base, $binaryName) {
$checksumsUrl = "$base/checksums.txt"
try {
$response = Invoke-WebRequest -Uri $checksumsUrl -UseBasicParsing -ErrorAction Stop
} catch {
Write-Log "warning: could not fetch checksums.txt; skipping verification"
return $null
}
foreach ($line in $response.Content -split "`n") {
$parts = $line.Trim() -split '\s+', 2
if ($parts.Length -eq 2 -and $parts[1] -eq $binaryName) {
return $parts[0]
}
}
Write-Log "warning: $binaryName not listed in checksums.txt; skipping verification"
return $null
}
function Main {
$arch = Resolve-Architecture
$platform = "windows-$arch"
$binaryName = "pulse-mcp-$platform.exe"
$base = Resolve-ReleaseBase
$url = "$base/$binaryName"
Write-Log "platform: $platform"
Write-Log "install dir: $BinDir"
Write-Log "downloading: $url"
if (-not (Test-Path $BinDir)) {
New-Item -ItemType Directory -Force -Path $BinDir | Out-Null
}
$tmp = [System.IO.Path]::GetTempFileName()
try {
try {
Invoke-WebRequest -Uri $url -UseBasicParsing -OutFile $tmp -ErrorAction Stop
} catch {
throw "download failed: $url`nIf a release exists for this version, the binary may not yet be published for $platform.`nBuild from source: go install github.com/rcourtman/pulse-go-rewrite/cmd/pulse-mcp@latest"
}
if (-not $NoVerify) {
$expected = Get-RemoteChecksum $base $binaryName
if ($expected) {
$actual = (Get-FileHash -Path $tmp -Algorithm SHA256).Hash.ToLower()
if ($actual -ne $expected.ToLower()) {
throw "sha256 mismatch for ${binaryName}: expected $expected, got $actual"
}
Write-Log 'sha256 verified'
}
}
$dest = Join-Path $BinDir 'pulse-mcp.exe'
Move-Item -Path $tmp -Destination $dest -Force
Write-Log "installed: $dest"
} finally {
if (Test-Path $tmp) { Remove-Item -Force $tmp -ErrorAction SilentlyContinue }
}
$userPath = [Environment]::GetEnvironmentVariable('Path', 'User')
if (-not ($userPath -split ';' | Where-Object { $_ -eq $BinDir })) {
Write-Log "note: $BinDir is not on your user PATH. To add it, run:"
Write-Log " [Environment]::SetEnvironmentVariable('Path', `"`$BinDir;`$env:Path`", 'User')"
}
Write-Log ''
Write-Log 'next steps:'
Write-Log ' 1. Mint a Pulse API token in Settings -> API Access (with monitoring:read,'
Write-Log ' and monitoring:write if you want the operator-state write tools).'
Write-Log ' 2. Wire pulse-mcp into your MCP client per:'
Write-Log " https://github.com/$Repo/blob/main/cmd/pulse-mcp/README.md"
}
Main