LearnNewsExamplesServices
Frontmatter
titlefix(ai): echo MCP startup failures to stderr (#13877)
authorneo-gpt
stateMerged
createdAtJun 22, 2026, 11:28 PM
updatedAtJul 27, 2026, 12:07 AM
closedAtJun 22, 2026, 11:40 PM
mergedAtJun 22, 2026, 11:40 PM
branchesdevcodex/13877-mcp-startup-stderr
urlhttps://github.com/neomjs/neo/pull/13878
contentTrust
projected
quarantined0
signals[]
Merged
neo-gpt
neo-gpt commented on Jun 22, 2026, 11:28 PM

Resolves #13877

Fatal startup failures in guarded MCP entrypoints now use the shared logger's fatalStartup() path, which preserves the existing per-server log sink and also forces one operator-visible line to stderr before the process exits. stdout remains untouched for stdio MCP protocol frames. This turns stale-config overlay crashes from a generic client-side Server disconnected into an actionable stderr message that includes the --migrate-config remediation already produced by assertConfigFresh().

Evidence: L2 (logger behavior unit coverage + cross-server guarded-entrypoint source invariant + reproduced local stale-overlay repair) -> L2 required (MCP startup diagnostics contract). No residuals.

Deltas from ticket

The implementation keeps the fix inside the existing shared MCP logger instead of adding one-off console.error() calls to each entrypoint. The entrypoints still call the shared fatal path explicitly, so normal runtime logging behavior is unchanged.

Test Evidence

  • Reproduced the original failure against current dev: Knowledge Base exited code 1 with empty stderr; repo log showed Stale config overlay and the npm run prepare -- --migrate-config fix.
  • Ran node ./ai/scripts/setup/initServerConfigs.mjs --migrate-config in the affected sibling checkouts; the same Knowledge Base and GitHub Workflow initialize probes then stayed alive after timeout.
  • npm run agent-preflight -- ai/mcp/server/shared/logger.mjs ai/mcp/server/memory-core/mcp-server.mjs ai/mcp/server/knowledge-base/mcp-server.mjs ai/mcp/server/github-workflow/mcp-server.mjs ai/mcp/server/gitlab-workflow/mcp-server.mjs ai/mcp/server/neural-link/mcp-server.mjs test/playwright/unit/ai/mcp/server/shared/logger.spec.mjs test/playwright/unit/ai/mcp/server/McpServerListToolsSmoke.spec.mjs passed.
  • npm run test-unit -- test/playwright/unit/ai/mcp/server/shared/logger.spec.mjs test/playwright/unit/ai/mcp/server/McpServerListToolsSmoke.spec.mjs passed after rebase: 37 tests.
  • git diff --cached --check passed before commit; git diff --check origin/dev..HEAD passed after rebase.

Post-Merge Validation

  • Restart a stale-overlay MCP server from a GUI client and confirm the client log includes the actionable stderr line rather than only Server disconnected.

Commit

  • cb9641351dfix(ai): echo MCP startup failures to stderr (#13877)

Authored by Euclid (GPT-5, Codex Desktop). Session db5b2ecf-db91-4b7d-9498-ccef00426a1c.

tobiu
tobiu APPROVED reviewed on Jun 22, 2026, 11:40 PM

No review body provided.