For AI agents: the complete documentation index is available at https://scriptedalchemy.github.io/agent-bundle/llms.txt, the full documentation bundle is available at https://scriptedalchemy.github.io/agent-bundle/llms-full.txt, and this page is available as Markdown at https://scriptedalchemy.github.io/agent-bundle/api/functions/mcp-entry.redirectConsoleToStderr.md.
  • English
  • Function: redirectConsoleToStderr()

    redirectConsoleToStderr(): StdoutProtocolGuard

    stdout carries JSON-RPC framing on a stdio server: a stray console.log (or direct process.stdout.write) from any imported module would corrupt the protocol stream. Install this guard before evaluating server modules, then call restoreProtocolStdout() right before serving. Console methods stay on stderr forever; only the raw process.stdout.write is restored for protocol frames.

    Returns

    StdoutProtocolGuard