start-mcp.ps1 861 B

1234567891011121314151617181920212223242526272829
  1. $ErrorActionPreference = "Stop"
  2. $root = Split-Path -Parent $PSScriptRoot
  3. $mcpDir = Join-Path $root "smqjh-mcp-server"
  4. $runScript = Join-Path $mcpDir "run.ps1"
  5. $logsDir = Join-Path $root "logs"
  6. if (-not (Test-Path $runScript)) {
  7. throw "MCP run script not found: $runScript"
  8. }
  9. New-Item -ItemType Directory -Force -Path $logsDir | Out-Null
  10. $stamp = Get-Date -Format "yyyyMMdd-HHmmss"
  11. $stdout = Join-Path $logsDir "mcp-$stamp.out.log"
  12. $stderr = Join-Path $logsDir "mcp-$stamp.err.log"
  13. $command = "& '$runScript'"
  14. Start-Process `
  15. -FilePath "powershell" `
  16. -ArgumentList @("-NoProfile", "-ExecutionPolicy", "Bypass", "-Command", $command) `
  17. -WorkingDirectory $mcpDir `
  18. -WindowStyle Hidden `
  19. -RedirectStandardOutput $stdout `
  20. -RedirectStandardError $stderr
  21. Write-Host "MCP start requested."
  22. Write-Host "stdout: $stdout"
  23. Write-Host "stderr: $stderr"