Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,9 @@ bld/
# Visual Studio 2017 auto generated files
Generated\ Files/

# Local validation logs
**/.validation/

# MSTest test Results
[Tt]est[Rr]esult*/
[Bb]uild[Ll]og.*
Expand Down
3 changes: 2 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"githubPullRequests.ignoredPullRequestBranches": [
"main"
]
],
"files.eol": "\n"
}
3 changes: 3 additions & 0 deletions AI/mcp-server/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

73 changes: 73 additions & 0 deletions AI/mcp-server/validate-sample.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
param(
[switch]$SkipInstall,
[switch]$SkipTests,
[switch]$SkipBrowser,
[switch]$KeepProcesses,
[switch]$Headed,
[int]$TimeoutSec = 90
)

Set-StrictMode -Version Latest
$ErrorActionPreference = 'Stop'

. (Join-Path $PSScriptRoot '../../Tools/powershell/SampleValidation.ps1')

$appRoot = $PSScriptRoot
$envFile = Join-Path $appRoot '.env'
$nodeEnvironment = Get-ValidationNodeEnvironment
$runtimeHandle = $null

try {
Write-Step 'Preflight checks'
Assert-CommandExists 'node'
Assert-CommandExists 'npm'

if (-not $SkipInstall) {
Write-Step 'Installing dependencies'
Invoke-ExternalCommand -FilePath 'npm' -Arguments @('install') -WorkingDirectory $appRoot -Environment $nodeEnvironment
}

Write-Step 'Building MCP server'
Invoke-ExternalCommand -FilePath 'npm' -Arguments @('run', 'build') -WorkingDirectory $appRoot -Environment $nodeEnvironment

if ($SkipTests) {
Write-Host 'Skipping tests because -SkipTests was specified.' -ForegroundColor Yellow
}
else {
Write-Host 'No automated test script is defined for this sample.' -ForegroundColor Yellow
}

if (-not (Test-Path $envFile)) {
Write-Host 'Skipping runtime smoke check because .env is missing.' -ForegroundColor Yellow
Write-ValidationSummary -Status 'SKIP_CONFIG' -Message 'Build validation passed; runtime smoke skipped because .env is missing.'
return
}

$environment = Get-DotEnvMap -Path $envFile
if (-not $environment.ContainsKey('PORT')) {
$environment['PORT'] = '3100'
}

Write-Step 'Starting MCP server'
$logPath = New-ValidationLogPath -WorkingDirectory $appRoot -Name 'mcp-server'
$runtimeHandle = Start-LoggedProcess -FilePath 'npm' -Arguments @('run', 'start') -WorkingDirectory $appRoot -LogPath $logPath -Environment (Merge-EnvironmentTables @($nodeEnvironment, $environment))

$healthUrl = "http://localhost:$($environment['PORT'])/health"
$healthResponse = Wait-ForHttpEndpoint -Url $healthUrl -TimeoutSec $TimeoutSec -AllowedStatusCodes @(200) -ProcessHandle $runtimeHandle
$body = [string]$healthResponse.Content
if ($body -notmatch '"status"\s*:\s*"ok"') {
throw "Health endpoint returned an unexpected response: $body"
}

Write-Host "Runtime smoke check passed at $healthUrl" -ForegroundColor Green
Write-ValidationSummary -Status 'PASS' -Message "Build and runtime smoke checks passed at $healthUrl."
}
catch {
Write-ValidationSummary -Status 'FAIL' -Message $_.Exception.Message
throw
}
finally {
if ($null -ne $runtimeHandle -and -not $KeepProcesses) {
Stop-LoggedProcess -Handle $runtimeHandle
}
}
2 changes: 2 additions & 0 deletions AI/ocr/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@

# production
/build
**/.dist/*.js
**/.dist/**/*.js

# misc
.DS_Store
Expand Down
Loading