diff --git a/stub/src/main.rs b/stub/src/main.rs index fd51603..d4f9884 100644 --- a/stub/src/main.rs +++ b/stub/src/main.rs @@ -80,7 +80,12 @@ fn main() -> Result<(), Box> { let _ = shutdown_tx.send(()).await; }); - let target_url = cli.target; + let target_url = if cli.target != "http://localhost:3000" { + cli.target + } else { + let port = std::env::var("MCP_PORT").unwrap_or_else(|_| "3000".to_string()); + format!("http://127.0.0.1:{}", port) + }; let ws_url = target_url.replace("http://", "ws://").replace("https://", "wss://"); let ws_url = format!("{}/ws?client=proxy", ws_url); let msg_rx = Arc::new(tokio::sync::Mutex::new(msg_rx));