Problem
When starting kimi -C (or kimi --continue) with OAuth MCP servers configured (e.g., Todoist), verbose debug messages from the mcp-remote library are printed directly to the console during MCP server connection. These messages include protocol traces like:
[16850] Using existing client port: 39725
[16850] Discovering OAuth server configuration...
[16850] Connecting to remote server: https://ai.todoist.net/mcp
[16850] Using transport strategy: http-first
[16852] Connected to remote server using StreamableHTTPClientTransport
[Local→Remote] initialize
{"jsonrpc": "2.0", "id": 0, "method": "initialize", ...}
This is noisy and distracting for users.
How to Reproduce
-
Install the Todoist MCP server:
kimi mcp add --transport http --auth oauth todoist https://ai.todoist.net/mcp
-
Authorize the MCP server:
-
Start kimi with -C to continue a session (or start a new session):
-
The verbose debug messages will appear on startup.
Reference: https://developer.todoist.com/api/v1/#tag/Todoist-MCP
Root Cause
In src/kimi_cli/cli/__init__.py, the redirect_stderr_to_logger() call was placed after KimiCLI.create() (line 499), which meant:
- CLI parsing errors would be hidden if redirected too early
- But MCP loading happens inside
KimiCLI.create(), so the verbose messages printed before redirection
Proposed Fix
Move redirect_stderr_to_logger() to before KimiCLI.create() so MCP verbose messages are captured to the log file.
In src/kimi_cli/cli/__init__.py, change:
instance = await KimiCLI.create(
session,
...
)
# Install stderr redirection only after initialization succeeded...
redirect_stderr_to_logger()
To:
# Enable stderr redirection before MCP loading to capture verbose debug
# messages from mcp-remote library. CLI parsing is done by now, so startup
# errors would have already been shown.
redirect_stderr_to_logger()
instance = await KimiCLI.create(
session,
...
)
Problem
When starting
kimi -C(orkimi --continue) with OAuth MCP servers configured (e.g., Todoist), verbose debug messages from themcp-remotelibrary are printed directly to the console during MCP server connection. These messages include protocol traces like:This is noisy and distracting for users.
How to Reproduce
Install the Todoist MCP server:
Authorize the MCP server:
Start kimi with
-Cto continue a session (or start a new session):The verbose debug messages will appear on startup.
Reference: https://developer.todoist.com/api/v1/#tag/Todoist-MCP
Root Cause
In
src/kimi_cli/cli/__init__.py, theredirect_stderr_to_logger()call was placed afterKimiCLI.create()(line 499), which meant:KimiCLI.create(), so the verbose messages printed before redirectionProposed Fix
Move
redirect_stderr_to_logger()to beforeKimiCLI.create()so MCP verbose messages are captured to the log file.In
src/kimi_cli/cli/__init__.py, change:To: