You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
CLI mode builds an unused stdio server and installs server exit handlers #289
src/index.ts creates the MCP server at module load before the CLI branch, and its stdout/exception/signal handlers also run in CLI mode.
Where
src/index.ts:22 (createServer() at module load)
src/index.ts:73-87, 128-135 (handlers)
src/cli.ts:337 (CLI creates its own server)
Details
An unknown SCREENCAST_TOOLSETS warning prints twice. The process.stdout.on("error") handler calls the server shutdown()/process.exit in CLI mode too (e.g. screencast-mcp record ... | head), bypassing the CLI's exit code.
Impact
Duplicate warnings and a wrong exit code when CLI stdout closes early.
Suggested fix
Create the server inside main() and register the stdout/uncaughtException/signal handlers only on the server path.
Acceptance criteria
CLI invocations never construct the stdio server
Toolset warning prints once
CLI exit code preserved on EPIPE
Getting started
Relevant files: src/index.ts, src/cli.ts
How to run tests: npm run build && npm test (also npm run typecheck and npm run lint)
Fixed in 1f72479: the stdio server and its process handlers are created in main() only; the CLI path just ignores EPIPE on stdout so it keeps its own exit code. Verified with a new test that runs the built entry with --help and an unknown SCREENCAST_TOOLSETS (exit 0, no warning) plus build/typecheck/lint.
Activity
TMHSDigital commentedon Nov 10, 2026
Fixed in 1f72479: the stdio server and its process handlers are created in
main()only; the CLI path just ignores EPIPE on stdout so it keeps its own exit code. Verified with a new test that runs the built entry with--helpand an unknown SCREENCAST_TOOLSETS (exit 0, no warning) plus build/typecheck/lint.chore: release 0.48.2