@utcp/mcp _logInfo() writes log lines to stdout, corrupting stdio MCP protocol framing
Summary
@utcp/mcp's McpCommunicationProtocol._logInfo() writes operational log lines to stdout (console.log) while the bridge communicates MCP over stdio. During every manual registration, startup discovery lines such as:
[McpCommunicationProtocol] Registering MCP manual 'webtools' by discovering tools.
[McpCommunicationProtocol] Discovering tools from MCP server 'exa'...
interleave into the same stdout stream the MCP JSON-RPC server writes to, corrupting the stdio framing. Any strictly-framing MCP client fails to parse the first tools/list / initialize response when registration runs at bridge startup.
Steps to reproduce
npx -y @utcp/mcp-bridgewith anymanual_call_templatesentry that proxies a remote MCP server (call_template_type: "mcp")- Using a strict stdio MCP client, read raw stdout immediately after launching the bridge: JSON-RPC responses are preceded by
[McpCommunicationProtocol] ...log lines - urllib/stdlib clients fail JSON parsing on those lines
Fix source
typescript-utcp/packages/mcp/dist/index.js — _logInfo():
console.log(`[McpCommunicationProtocol] ${message}`); // stdout — corrupts stdio MCP framing
should be:
console.error(`[McpCommunicationProtocol] ${message}`);
_logError() already correctly uses console.error; only _logInfo() writes to stdout. I verified the patch locally — after the change the bridge's clean JSON-RPC handshake (initialize → tools/list → call_tool) parses without error against 4 remote MCP providers (3 Z.ai, 1 Exa), and registration output lands on stderr.
Environment
@utcp/mcp^1.1.2 (bundled with@utcp/mcp-bridge)- Node v26.13.0, Linux x64
- Consumed via
npx @utcp/mcp-bridge(stdio transport)