/** * Server lifecycle subcommands — run the Streamable HTTP server like a * daemon (iMCP-style always-on), so the IMAP watcher and verification * catcher keep working without any MCP client holding a stdio session open. * * - server start [--attach] [http flags] — start detached (default) or foreground * - server stop [--force] — stop the detached server * - server status — pid, address, health, uptime * - server restart [http flags] — stop + start (reuses previous flags) * - server logs [-n N] — tail the daemon log * * Detached state lives in $XDG_STATE_HOME/email-mcp/daemon.json; stdout and * stderr go to server.log next to it. All subcommands are non-interactive * and script-friendly (status exits 1 when the server is not running). */ import type { ServerConfig } from '../types/index.js'; export interface ServerArgs { attach: boolean; force: boolean; lines: number; /** Effective bind address (flags > EMAIL_MCP_HTTP_* env > defaults). */ host: string; port: number; /** Flags forwarded verbatim to the `http` entry point. */ passthrough: string[]; } /** * Server-level flags are consumed; everything else forwards to `http`. * host/port resolve with the same precedence the http entry uses: * flags → EMAIL_MCP_HTTP_* env → [settings.server] → defaults. */ export declare function parseServerArgs(argv: string[], env?: Record, serverConfig?: ServerConfig): ServerArgs; /** * PID-reuse guard: only ever signal a process whose command line looks like * this server. An unknown or unreadable command line is treated as NOT ours. */ export declare function looksLikeOurServer(cmdline: string | undefined): boolean; /** Last `n` lines of `text`, ignoring a trailing newline. */ export declare function tailLines(text: string, n: number): string; /** * How to re-invoke this CLI in a child process or launchd item: * `[node, entry.js]` when running as a script, `[execPath]` alone when * running as a compiled single binary (bun/SEA — argv[1] is virtual or * absent), and `undefined` in a TS dev checkout (a spawned copy could not * resolve TypeScript — use --attach there). */ export declare function selfCommand(execPath: string, entry: string | undefined): string[] | undefined; /** * launchd login item: RunAtLoad + KeepAlive make the server start at login * and restart on crash — the config file (not flags) is its source of truth, * so passthrough is normally empty. */ export declare function buildLaunchdPlist(command: string[], passthrough: string[]): string; /** * A systemd --user unit that runs `email-mcp http` and keeps it up. Mirrors the * launchd plist: RunAtLoad≈WantedBy=default.target, KeepAlive≈Restart=on-failure. * ExecStart needs an absolute command (systemd does not resolve PATH the way a * login shell does); the installer passes `selfCommand(...)` which is absolute. */ export declare function buildSystemdUnit(command: string[], passthrough: string[]): string; /** * Usage for one server subcommand, or the overview when none is given. * `install`/`uninstall` describe the per-OS service manager so the help is * accurate on whatever platform the user is on. */ export declare function serverUsage(subcommand?: string): string; export default function runServerCommand(argv: string[]): Promise; //# sourceMappingURL=server-commands.d.ts.map