Problem
The logger in utils/logger.js uses console.info() for INFO-level messages. In Node.js, console.info() writes to stdout, which is the same channel used for JSON-RPC communication in stdio MCP servers.
This means the MCP client receives a mix of:
INFO: Starting MCP Gemini Server with model: gemini-3-pro-preview
INFO: Logging mode: normal
INFO: Output directory: /Users/...
INFO: Connecting to Gemini API (attempt 1/3)...
INFO: Successfully connected to Gemini API
INFO: MCP Gemini Server running
{"result":{"protocolVersion":"2024-11-05","capabilities":{"tools":{"listChanged":true}},...},"jsonrpc":"2.0","id":1}
Some MCP clients (Claude Code) appear to handle this gracefully by finding JSON lines among the noise, but this violates the MCP stdio transport spec which expects only valid JSON-RPC messages on stdout.
Suggested fix
Change console.info() and console.warn() to console.error() (which writes to stderr), or use process.stderr.write() for all non-JSON-RPC output. This is the standard pattern for stdio MCP servers.
// Before
info: (message, ...args) => {
console.info(`INFO: ${message}`, ...args); // writes to stdout
},
// After
info: (message, ...args) => {
console.error(`INFO: ${message}`, ...args); // writes to stderr
},
Environment
@rlabs-inc/gemini-mcp v0.8.1
- MCP protocol 2024-11-05
- Claude Code as MCP client
Problem
The logger in
utils/logger.jsusesconsole.info()for INFO-level messages. In Node.js,console.info()writes to stdout, which is the same channel used for JSON-RPC communication in stdio MCP servers.This means the MCP client receives a mix of:
Some MCP clients (Claude Code) appear to handle this gracefully by finding JSON lines among the noise, but this violates the MCP stdio transport spec which expects only valid JSON-RPC messages on stdout.
Suggested fix
Change
console.info()andconsole.warn()toconsole.error()(which writes to stderr), or useprocess.stderr.write()for all non-JSON-RPC output. This is the standard pattern for stdio MCP servers.Environment
@rlabs-inc/gemini-mcpv0.8.1