Skip to content

[codex] keep direct CLI serve alive for Claude MCP#35

Merged
stevenobiajulu merged 1 commit intomainfrom
fix/main-checkout-mcp-runtime
Apr 16, 2026
Merged

[codex] keep direct CLI serve alive for Claude MCP#35
stevenobiajulu merged 1 commit intomainfrom
fix/main-checkout-mcp-runtime

Conversation

@stevenobiajulu
Copy link
Copy Markdown
Member

What changed

The direct node .../dist/cli.js serve entrypoint now routes through a small runCliDirect() adapter that sets process.exitCode on success instead of calling process.exit(code) immediately.

A regression test was added to verify the direct serve path does not force-process-exit after the MCP stdio transport starts.

Why

Claude MCP health checks were failing when pointed directly at packages/email-mcp/dist/cli.js serve from the main checkout.

Root cause: the direct CLI auto-run path awaited runCli() and then unconditionally called process.exit(code). For serve, runCli() resolves after stdio transport setup, so the process exited right after startup and before Claude could complete its handshake.

Impact

This makes the main checkout usable as a direct Claude MCP runtime target without relying on a separate wrapper or alternate runtime worktree.

Validation

  • npm run test:run -w @usejunior/email-mcp
  • npm run build -w @usejunior/email-mcp
  • claude mcp get email-agent-mcp-worktree-test -> Status: ✓ Connected
  • manual runtime check: node packages/email-mcp/dist/cli.js serve stayed alive after startup

@codecov
Copy link
Copy Markdown

codecov Bot commented Apr 16, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ All tests successful. No failed tests found.

📢 Thoughts on this report? Let us know!

@stevenobiajulu stevenobiajulu marked this pull request as ready for review April 16, 2026 04:52
@stevenobiajulu stevenobiajulu force-pushed the fix/main-checkout-mcp-runtime branch from 2fefedc to b876254 Compare April 16, 2026 12:59
@stevenobiajulu stevenobiajulu enabled auto-merge (squash) April 16, 2026 13:01
@stevenobiajulu stevenobiajulu merged commit 4c8280e into main Apr 16, 2026
13 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant