Skip to content

Add Windows Task Scheduler deployment guide for persistent daemon #394

Description

@RCrushMe

Summary

The official documentation covers Linux/macOS systemd deployment (docs/en/guide/getting-started.md) and the --background detached mode, but has zero guidance for running 1MCP as a persistent daemon on Windows.

Windows is a first-class platform for 1MCP (the npm package ships Windows binaries, 1mcp.cmd is the entry point), yet users must figure out daemon lifecycle management entirely on their own.

What's missing

  1. No Windows Task Scheduler section in any of the 78 English docs or the README
  2. No recommended schtasks / New-ScheduledTaskAction example for boot-persistent deployment
  3. No guidance on RestartOnFailure, BootTrigger delay, or MultipleInstancesPolicy settings that matter for a reliable daemon
  4. No post-boot verification checklist for Windows (the systemd section has systemctl status; Windows users get nothing equivalent)

Real-world configuration that works

This is a production-proven Windows Task Scheduler setup (running since 2026-07, survives reboots, auto-recovers on failure):

$node = "D:\nodejs\node.exe"
$entry = "$env:APPDATA\npm\node_modules\@1mcp\agent\build\index.js"
$workdir = "$env:APPDATA\npm\node_modules\@1mcp\agent"
$logfile = "$env:APPDATA\1mcp\logs\server.log"

$args = "$entry serve --transport http --host 127.0.0.1 --port 3100 " +
  "--enable-async-loading --async-min-servers 20 --async-timeout 120000 " +
  "--async-batch-notifications --enable-config-reload " +
  "--config-reload-debounce 500 --log-level info --log-file `"$logfile`""

$action   = New-ScheduledTaskAction -Execute $node -Argument $args -WorkingDirectory $workdir
$trigger  = New-ScheduledTaskTrigger -AtStartup
$settings = New-ScheduledTaskSettingsSet `
  -AllowStartIfOnBatteries -DontStopIfGoingOnBatteries `
  -ExecutionTimeLimit (New-TimeSpan) `
  -RestartCount 5 -RestartInterval (New-TimeSpan -Minutes 2) `
  -StartWhenAvailable -MultipleInstances IgnoreNew

Register-ScheduledTask -TaskName '1mcp-daemon' `
  -Action $action -Trigger $trigger -Settings $settings `
  -Description '1MCP aggregated runtime' -RunLevel Highest

Post-boot verification

schtasks /query /tn '\1mcp-daemon' /fo LIST /v   # Status: Running
1mcp --status                                     # running (ready)
Get-NetTCPConnection -LocalPort 3100 -State Listen
Invoke-WebRequest http://127.0.0.1:3100/health/ready -UseBasicParsing | Select StatusCode  # 200

Why this matters

  • Without async loading, serve blocks the HTTP port for 10-12s with many backends; Task Scheduler's health/restart logic can misinterpret this as a crash
  • MultipleInstancesPolicy IgnoreNew prevents duplicate daemons after fast reboots
  • BootTrigger delay (30s) gives the network stack time to initialize before upstream MCP connections are attempted
  • The server.pid file in the user-scope config dir is what 1mcp proxy reads to discover the daemon - this interaction is undocumented for Windows

Proposed solution

Add a ### Windows: Task Scheduler section to the deployment docs (parallel to the existing systemd section), covering:

  1. Full Register-ScheduledTask script with recommended flags
  2. Key settings explained (RestartOnFailure, BootTrigger delay, MultipleInstancesPolicy)
  3. Post-boot verification commands
  4. server.pid / Runtime Scope interaction note

Related: #393 (async sub-parameters also undocumented)

Metadata

Metadata

Assignees

No one assigned

    Labels

    documentationImprovements or additions to documentationready-for-humanRequires human implementation or environment validation

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions