From 7a8b4aae1f74c1119bc94564049fcff39367aca6 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Mon, 4 Aug 2025 18:20:32 +0000 Subject: [PATCH 1/2] Initial plan From 000e11d28e52db89eb30c7e0e6f7f6f1d047e3a6 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Mon, 4 Aug 2025 18:40:53 +0000 Subject: [PATCH 2/2] Fix logging interference with MCP stdio transport - default to RUST_LOG=off for stdio Co-authored-by: Mossaka <5447827+Mossaka@users.noreply.github.com> --- src/main.rs | 32 +++++++++++++++++++++++++------- 1 file changed, 25 insertions(+), 7 deletions(-) diff --git a/src/main.rs b/src/main.rs index c791503b..894e49ba 100644 --- a/src/main.rs +++ b/src/main.rs @@ -180,20 +180,38 @@ Key points: #[tokio::main] async fn main() -> Result<()> { + let cli = Cli::parse(); + + // Initialize logging based on transport mode + // For stdio transport, default to "off" to avoid interfering with MCP protocol + // For HTTP transport, keep the existing default logging level + let default_log_level = match &cli.command { + Commands::Serve { stdio, http, .. } => { + match (*stdio, *http) { + (false, false) | (true, false) => { + // Using stdio transport (default or explicit) - disable logging by default + "off" + } + (false, true) => { + // Using HTTP transport - keep existing logging behavior + "info,cranelift_codegen=warn,cranelift_entity=warn,cranelift_bforest=warn,cranelift_frontend=warn" + } + (true, true) => { + // Invalid combination - will error later, but use "off" for now + "off" + } + } + } + }; + tracing_subscriber::registry() .with( tracing_subscriber::EnvFilter::try_from_default_env() - .unwrap_or_else(|_| { - "info,cranelift_codegen=warn,cranelift_entity=warn,cranelift_bforest=warn,cranelift_frontend=warn" - .to_string() - .into() - }), + .unwrap_or_else(|_| default_log_level.to_string().into()), ) .with(tracing_subscriber::fmt::layer()) .init(); - let cli = Cli::parse(); - match &cli.command { Commands::Serve { plugin_dir,