Skip to content

Commit 5cd3e3d

Browse files
committed
install files
1 parent d250653 commit 5cd3e3d

1 file changed

Lines changed: 106 additions & 43 deletions

File tree

install.ps1

Lines changed: 106 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -3,27 +3,27 @@
33
One-shot installer for the TestOps MCP server (per-user / stdio mode).
44
55
.DESCRIPTION
6-
Downloads the right binary for your OS/arch from GitHub Releases, asks for your
7-
Allure TestOps URL + API token, and registers the server in BOTH:
6+
Downloads the right binary for the current OS/arch from GitHub Releases into a
7+
PERMANENT per-user folder (%LOCALAPPDATA%\TestOpsMCP, not Downloads/Temp which can
8+
be auto-cleaned), asks the user for the Allure TestOps URL + API token with detailed
9+
in-console guidance, and registers the server in BOTH:
810
* Claude Desktop (claude_desktop_config.json)
911
* Claude Code (via `claude mcp add -s user`, if the CLI is installed)
1012
11-
Re-running the script is safe — it overwrites the existing "testops" entry.
13+
Re-running is safe: it overwrites the existing "testops" entry. Config files are
14+
backed up to *.bak before being modified.
1215
1316
.EXAMPLE
14-
# Interactive (asks for URL + token):
1517
powershell -ExecutionPolicy Bypass -File .\install.ps1
1618
1719
.EXAMPLE
18-
# Non-interactive:
19-
powershell -ExecutionPolicy Bypass -File .\install.ps1 `
20-
-AllureBaseUrl https://your-testops.com -AllureToken xxxxxxxx
20+
powershell -ExecutionPolicy Bypass -File .\install.ps1 -AllureBaseUrl https://allure.acme.com -AllureToken xxxx
2121
#>
2222
[CmdletBinding()]
2323
param(
2424
[string]$AllureBaseUrl = $env:ALLURE_BASE_URL,
2525
[string]$AllureToken = $env:ALLURE_TOKEN,
26-
[string]$Version = "latest", # e.g. v2.0.3 ; "latest" = newest release
26+
[string]$Version = "latest",
2727
[string]$ServerName = "testops",
2828
[switch]$NoClaudeCode,
2929
[switch]$NoClaudeDesktop
@@ -32,12 +32,14 @@ param(
3232
$ErrorActionPreference = "Stop"
3333
$Repo = "MimoJanra/TestOpsMCP"
3434

35-
# TestOps MCP supports older Windows that default to TLS 1.0/1.1.
35+
# Allow HTTPS downloads on older Windows that still default to TLS 1.0/1.1.
3636
try { [Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12 } catch {}
3737

38-
function Write-Step($msg) { Write-Host "`n==> $msg" -ForegroundColor Cyan }
39-
function Write-Ok($msg) { Write-Host " OK $msg" -ForegroundColor Green }
40-
function Write-Warn2($msg) { Write-Host " ! $msg" -ForegroundColor Yellow }
38+
function Write-Line($msg) { Write-Host $msg }
39+
function Write-Head($msg) { Write-Host ""; Write-Host $msg -ForegroundColor Cyan }
40+
function Write-Ok($msg) { Write-Host " [OK] $msg" -ForegroundColor Green }
41+
function Write-Bad($msg) { Write-Host " [!] $msg" -ForegroundColor Red }
42+
function Write-Hint($msg) { Write-Host $msg -ForegroundColor DarkGray }
4143

4244
function Update-DesktopConfig {
4345
param([string]$Path, [string]$Name, [string]$Command, [hashtable]$EnvVars)
@@ -74,81 +76,142 @@ function Update-DesktopConfig {
7476
[System.IO.File]::WriteAllText($Path, $json, $utf8NoBom)
7577
}
7678

77-
Write-Host "TestOps MCP installer" -ForegroundColor White
78-
79-
# --- 1. Detect platform ---------------------------------------------------
80-
Write-Step "Detecting platform"
79+
Write-Host "============================================================" -ForegroundColor White
80+
Write-Host " TestOps for Claude - Installer" -ForegroundColor White
81+
Write-Host "============================================================" -ForegroundColor White
82+
Write-Line ""
83+
Write-Line "This wizard will do everything for you:"
84+
Write-Line " - download the program,"
85+
Write-Line " - ask you for 2 things (your Allure URL and an access token),"
86+
Write-Line " - configure Claude automatically."
87+
Write-Line "You do not have to edit any files by hand. Just follow the prompts."
88+
89+
# --- Step 1: platform -------------------------------------------------------
90+
Write-Head "[Step 1 of 4] Detecting your system..."
8191
$arch = if ($env:PROCESSOR_ARCHITECTURE -eq 'ARM64' -or $env:PROCESSOR_ARCHITEW6432 -eq 'ARM64') { 'arm64' } else { 'amd64' }
8292
$asset = "testops-mcp-windows-$arch.exe"
83-
Write-Ok "windows / $arch -> $asset"
93+
Write-Ok "Windows ($arch)"
8494

85-
# --- 2. Download binary ----------------------------------------------------
86-
Write-Step "Downloading binary ($Version)"
95+
# --- Step 2: download -------------------------------------------------------
96+
Write-Head "[Step 2 of 4] Downloading the program from GitHub..."
8797
if ($Version -eq "latest") {
8898
$url = "https://github.com/$Repo/releases/latest/download/$asset"
8999
} else {
90100
$url = "https://github.com/$Repo/releases/download/$Version/$asset"
91101
}
92-
102+
# Permanent per-user folder - survives clearing Downloads / Temp.
93103
$installDir = Join-Path $env:LOCALAPPDATA "TestOpsMCP"
94104
if (-not (Test-Path $installDir)) { New-Item -ItemType Directory -Force -Path $installDir | Out-Null }
95105
$binPath = Join-Path $installDir "testops-mcp.exe"
96106

97107
try {
98108
Invoke-WebRequest -Uri $url -OutFile $binPath -UseBasicParsing
99109
} catch {
100-
throw "Download failed from $url`n$($_.Exception.Message)`nCheck the version tag or download manually from https://github.com/$Repo/releases"
110+
Write-Bad "Could not download the program."
111+
Write-Line ""
112+
Write-Line "Possible reasons:"
113+
Write-Line " - no internet, or a corporate proxy/VPN is blocking GitHub;"
114+
Write-Line " - GitHub is temporarily unavailable."
115+
Write-Line ""
116+
Write-Line "What to do: check your internet connection and run the installer again."
117+
Write-Line "If it still fails, send a screenshot of this window to whoever gave you the installer."
118+
Write-Hint "Technical details: $url"
119+
Write-Hint $_.Exception.Message
120+
exit 1
101121
}
102122
if (-not (Test-Path $binPath) -or (Get-Item $binPath).Length -eq 0) {
103-
throw "Downloaded file is empty: $binPath"
123+
Write-Bad "The downloaded file is empty. Please run the installer again."
124+
exit 1
104125
}
105-
Write-Ok "saved to $binPath"
126+
Write-Ok "Done. Saved to a permanent folder (will NOT be deleted when you clear Downloads):"
127+
Write-Hint " $binPath"
128+
129+
# --- Step 3: Allure credentials --------------------------------------------
130+
Write-Head "[Step 3 of 4] Enter your 2 details from Allure TestOps"
131+
Write-Line "------------------------------------------------------------"
106132

107-
# --- 3. Collect Allure credentials ----------------------------------------
108-
Write-Step "Allure TestOps credentials"
133+
# (1) URL
109134
if (-not $AllureBaseUrl) {
110-
$AllureBaseUrl = Read-Host "Allure TestOps URL (e.g. https://your-testops.com)"
135+
Write-Line ""
136+
Write-Line "(1) ALLURE URL"
137+
Write-Line " This is the link you use to open Allure in your browser."
138+
Write-Line " Example: https://allure.yourcompany.com"
139+
Write-Line " Just the site address (no /login, no trailing slash)."
140+
Write-Line ""
141+
$AllureBaseUrl = Read-Host " Enter your Allure URL and press Enter"
111142
}
112143
$AllureBaseUrl = $AllureBaseUrl.Trim().TrimEnd('/')
113144
if ($AllureBaseUrl -notmatch '^https?://') { $AllureBaseUrl = "https://$AllureBaseUrl" }
114145

146+
# (2) Token
115147
if (-not $AllureToken) {
116-
$sec = Read-Host "Allure API token (input hidden)" -AsSecureString
148+
Write-Line ""
149+
Write-Line "(2) ALLURE API TOKEN"
150+
Write-Line " Where to get it (takes about 30 seconds):"
151+
Write-Line " 1. Open Allure in your browser and sign in."
152+
Write-Line " 2. Click your avatar / name in the TOP-RIGHT corner."
153+
Write-Line " 3. Go to 'Settings' -> 'API tokens'"
154+
Write-Line " (it may be called 'Tokens' or 'Integration tokens')."
155+
Write-Line " 4. Click 'Create' / 'Generate' / '+ Create token'."
156+
Write-Line " 5. Give it a name, e.g. 'Claude', and confirm."
157+
Write-Line " 6. Copy the token NOW - it is shown only ONCE!"
158+
Write-Line " 7. Paste it below (right-click in this window = paste)."
159+
Write-Line ""
160+
Write-Hint " NOTE: the token will NOT show on screen while you paste - that is normal"
161+
Write-Hint " (it is hidden for security). Just paste it and press Enter."
162+
Write-Line ""
163+
$sec = Read-Host " Paste your token and press Enter" -AsSecureString
117164
$AllureToken = [Runtime.InteropServices.Marshal]::PtrToStringAuto(
118165
[Runtime.InteropServices.Marshal]::SecureStringToBSTR($sec))
119166
}
120167
$AllureToken = $AllureToken.Trim()
121-
if (-not $AllureBaseUrl -or -not $AllureToken) { throw "Both URL and token are required." }
122-
Write-Ok "URL: $AllureBaseUrl"
168+
169+
Write-Line "------------------------------------------------------------"
170+
if (-not $AllureBaseUrl -or -not $AllureToken) {
171+
Write-Bad "Both the URL and the token are required. Please run the installer again."
172+
exit 1
173+
}
174+
Write-Ok "URL accepted: $AllureBaseUrl"
175+
Write-Ok ("Token accepted (length: {0} characters)" -f $AllureToken.Length)
123176

124177
$envVars = @{ ALLURE_BASE_URL = $AllureBaseUrl; ALLURE_TOKEN = $AllureToken }
125178

126-
# --- 4. Claude Desktop -----------------------------------------------------
179+
# --- Step 4: configure Claude ----------------------------------------------
180+
Write-Head "[Step 4 of 4] Configuring Claude..."
127181
if (-not $NoClaudeDesktop) {
128-
Write-Step "Configuring Claude Desktop"
129182
$desktopCfg = Join-Path $env:APPDATA "Claude\claude_desktop_config.json"
130183
Update-DesktopConfig -Path $desktopCfg -Name $ServerName -Command $binPath -EnvVars $envVars
131-
Write-Ok "updated $desktopCfg"
184+
Write-Ok "Claude Desktop configured."
185+
Write-Hint " (file: $desktopCfg)"
132186
}
133-
134-
# --- 5. Claude Code (CLI) --------------------------------------------------
135187
if (-not $NoClaudeCode) {
136-
Write-Step "Configuring Claude Code"
137188
$claude = Get-Command claude -ErrorAction SilentlyContinue
138189
if ($claude) {
139190
& claude mcp remove -s user $ServerName *> $null
140191
& claude mcp add -s user $ServerName $binPath `
141192
-e "ALLURE_BASE_URL=$AllureBaseUrl" `
142193
-e "ALLURE_TOKEN=$AllureToken"
143-
if ($LASTEXITCODE -eq 0) { Write-Ok "registered '$ServerName' in Claude Code (user scope)" }
144-
else { Write-Warn2 "claude CLI returned exit code $LASTEXITCODE" }
194+
if ($LASTEXITCODE -eq 0) { Write-Ok "Claude Code configured too." }
195+
else { Write-Bad "Claude Code: command returned code $LASTEXITCODE (not critical)." }
145196
} else {
146-
Write-Warn2 "claude CLI not found on PATH — skipped. Run this later if you use Claude Code:"
147-
Write-Host " claude mcp add -s user $ServerName `"$binPath`" -e ALLURE_BASE_URL=$AllureBaseUrl -e ALLURE_TOKEN=<token>"
197+
Write-Ok "Claude Code not found - skipping (that's fine if you don't use it)."
148198
}
149199
}
150200

151-
# --- Done ------------------------------------------------------------------
152-
Write-Host "`nDone." -ForegroundColor Green
153-
Write-Host " * Claude Desktop: fully restart it (quit from the tray, not just close the window)."
154-
Write-Host " * Then ask Claude: `"List all projects in Allure`""
201+
# --- Done -------------------------------------------------------------------
202+
Write-Line ""
203+
Write-Host "============================================================" -ForegroundColor Green
204+
Write-Host " DONE! Just 2 simple steps left:" -ForegroundColor Green
205+
Write-Host "============================================================" -ForegroundColor Green
206+
Write-Line ""
207+
Write-Line " 1) RESTART Claude Desktop completely:"
208+
Write-Line " - find the Claude icon in the system tray (bottom-right, near the clock);"
209+
Write-Line " - right-click it -> 'Quit';"
210+
Write-Line " - open Claude again."
211+
Write-Line " IMPORTANT: closing the window with the X is NOT enough."
212+
Write-Line ""
213+
Write-Line " 2) TEST it: send this message to Claude:"
214+
Write-Host " List all projects in Allure" -ForegroundColor White
215+
Write-Line ""
216+
Write-Line "If something went wrong, send a screenshot of this window to"
217+
Write-Line "whoever gave you the installer."

0 commit comments

Comments
 (0)