[CmdletBinding()] param( [Parameter(Mandatory)] [uri]$Url, [string]$EvidenceDirectory = "artifacts/evidence/mcp-2026-07-28/conformance-tasks" ) $ErrorActionPreference = "Stop" if (-not $Url.IsLoopback) { throw "Conformance target must be loopback." } $repository = (Resolve-Path (Join-Path $PSScriptRoot "..")).Path $packageJson = Join-Path $repository "build/conformance-runner/node_modules/@modelcontextprotocol/conformance/package.json" if (-not (Test-Path -LiteralPath $packageJson)) { throw "Offline runner is absent. Run scripts/Acquire-McpConformance.ps1 first." } $metadata = Get-Content -Raw -LiteralPath $packageJson | ConvertFrom-Json if ($metadata.version -ne "0.2.0-alpha.11") { throw "Unexpected conformance version: $($metadata.version)" } $cli = Join-Path (Split-Path $packageJson) $metadata.bin.conformance $evidence = [IO.Path]::GetFullPath($EvidenceDirectory, $repository) New-Item -ItemType Directory -Force -Path $evidence | Out-Null $scenarios = @( "tasks-lifecycle", "tasks-capability-negotiation", "tasks-wire-fields", "tasks-request-state-removal", "tasks-mrtr-input", "tasks-request-headers", "tasks-dispatch-and-envelope", "tasks-status-notifications", "tasks-required-task-error", "tasks-mrtr-composition" ) $applicationFailures = @() $runnerLimitations = @() foreach ($scenario in $scenarios) { $output = Join-Path $evidence $scenario & node $cli server --url $Url.AbsoluteUri --scenario $scenario --spec-version 2026-07-28 --force --output-dir $output 2>&1 | Tee-Object -FilePath (Join-Path $evidence "$scenario.txt") $runnerExitCode = $LASTEXITCODE $resultDirectory = Get-ChildItem -LiteralPath $output -Directory | Sort-Object LastWriteTimeUtc -Descending | Select-Object -First 1 if ($null -eq $resultDirectory) { $runnerLimitations += "$scenario`:runner_exit_$runnerExitCode`:no_result_directory" continue } $checksPath = Join-Path $resultDirectory.FullName "checks.json" if (-not (Test-Path -LiteralPath $checksPath)) { $runnerLimitations += "$scenario`:runner_exit_$runnerExitCode`:checks_missing" continue } foreach ($check in (Get-Content -Raw -LiteralPath $checksPath | ConvertFrom-Json)) { if ($check.status -ne "FAILURE") { continue } if ($check.id -eq "wire-schema-valid" -and $check.errorMessage -match "CallToolResult: must have required property 'content'.*resultType.*task") { $runnerLimitations += "$scenario`:$($check.id)" } else { $applicationFailures += "$scenario`:$($check.id) - $($check.errorMessage)" } } } [ordered]@{ runner_version = $metadata.version scenarios = $scenarios application_failure_count = $applicationFailures.Count application_failures = $applicationFailures runner_limitation_count = $runnerLimitations.Count runner_limitations = $runnerLimitations } | ConvertTo-Json -Depth 5 | Set-Content -Encoding utf8 -LiteralPath (Join-Path $evidence "summary.json") if ($applicationFailures.Count -ne 0) { throw "$($applicationFailures.Count) application Tasks conformance check(s) failed." }