mirror of
https://github.com/ruvnet/ruflo.git
synced 2026-11-24 22:28:10 +09:00
Critical fix for MCP server stdio mode that prevents JSON-RPC protocol
corruption by routing all non-protocol output to stderr.
Changes:
- Added module-level isStdioMode flag for mode tracking
- Implemented smart logging helpers (log, success, error, warning)
- Replaced 150+ console.log/print* calls with smart helpers
- stdio mode: all output → stderr (stdout clean for JSON-RPC)
- HTTP mode: normal stdout behavior preserved (backward compatible)
Affected functions:
- startMcpServer() - startup messages
- stopMcpServer() - shutdown messages
- listMcpTools() - tool listing
- manageMcpAuth() - auth management
- showMcpConfig() - config display
- showMcpHelp() - help text
- showMcpStatus() - status display
Testing:
✅ Module structure verification
✅ Smart logging helpers present
✅ No direct stdout usage
✅ Build successful
✅ All automated tests pass
Impact:
- Before: MCP server unusable in stdio mode (protocol corruption)
- After: Fully compatible with standard MCP clients
Files changed:
- src/cli/simple-commands/mcp.js (complete logging rewrite)
- tests/test-mcp-stdio.js (new test suite)
- CHANGELOG.md (v2.7.5 entry)
- package.json (version bump to 2.7.5)
Fixes #835
Bug existed since: July 8, 2025 (commit 29800626c, PR #167)
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>