summaryrefslogtreecommitdiff
path: root/scripts/Acquire-McpConformance.ps1
blob: f6fa38f94300cb7538ea4edd7e0d39aa5aad3eab (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
[CmdletBinding()]
param(
    [string]$EvidenceDirectory = "artifacts/evidence/mcp-2026-07-28/conformance-acquisition"
)

$ErrorActionPreference = "Stop"
$repository = (Resolve-Path (Join-Path $PSScriptRoot "..")).Path
$runnerDirectory = Join-Path $repository "build/conformance-runner"
$evidence = [IO.Path]::GetFullPath($EvidenceDirectory, $repository)
New-Item -ItemType Directory -Force -Path $runnerDirectory, $evidence | Out-Null

$package = "@modelcontextprotocol/conformance@0.2.0-alpha.11"
& npm install --prefix $runnerDirectory --package-lock=true --ignore-scripts --no-audit --no-fund $package 2>&1 |
    Tee-Object -FilePath (Join-Path $evidence "npm-install.txt")
if ($LASTEXITCODE -ne 0) { throw "npm install failed with exit code $LASTEXITCODE" }

$packageJson = Join-Path $runnerDirectory "node_modules/@modelcontextprotocol/conformance/package.json"
$metadata = Get-Content -Raw -LiteralPath $packageJson | ConvertFrom-Json
if ($metadata.version -ne "0.2.0-alpha.11") { throw "Unexpected conformance version: $($metadata.version)" }
$lockPath = Join-Path $runnerDirectory "package-lock.json"
$lock = Get-Content -Raw -LiteralPath $lockPath | ConvertFrom-Json -AsHashtable
$entry = $lock.packages["node_modules/@modelcontextprotocol/conformance"]
[ordered]@{
    package = $metadata.name
    version = $metadata.version
    integrity = $entry.integrity
    resolved = $entry.resolved
    acquired_at = [DateTimeOffset]::UtcNow.ToString("O")
    node = (& node --version)
    npm = (& npm --version)
} | ConvertTo-Json | Set-Content -Encoding utf8 -LiteralPath (Join-Path $evidence "package.json")

$bin = $metadata.bin.conformance
& node (Join-Path (Split-Path $packageJson) $bin) list --server --requirements 2026-07-28 2>&1 |
    Tee-Object -FilePath (Join-Path $evidence "server-scenarios.txt")
if ($LASTEXITCODE -ne 0) { throw "Conformance scenario listing failed with exit code $LASTEXITCODE" }