From fdb45b8eedb7ba34b8649a78e1663048f0132301 Mon Sep 17 00:00:00 2001 From: Devid HW Date: Sun, 19 Apr 2026 09:21:00 +0700 Subject: [PATCH] fix: redirect tracing logs to stderr to keep stdout clean for MCP JSON tracing_subscriber::fmt::init() defaults to stdout, contaminating the MCP JSON-RPC stream and causing Claude Code and Windsurf to fail the initialize handshake with "failed to reconnect". Co-Authored-By: Claude Sonnet 4.6 --- src/main.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/main.rs b/src/main.rs index b4e47f3..287ed0c 100644 --- a/src/main.rs +++ b/src/main.rs @@ -78,7 +78,9 @@ pub struct ToolCapabilities { #[tokio::main] async fn main() -> Result<()> { - tracing_subscriber::fmt::init(); + tracing_subscriber::fmt() + .with_writer(std::io::stderr) + .init(); let cli = Cli::parse();