perf: eliminate loop string allocations and proxy mem spikes

This commit is contained in:
Riz Ashraf committed 2026-09-21 09:40:37 +01:00
1 parent d5a05f8416
commit dc59aa9238
5 files changed
+30 -24

No files matched your search

+2 -2
View File
@@ -37,9 +37,9 @@ pub async fn send_response(response: JsonRpcResponse) {
// The MCP StdioTransport MUST use Newline-Delimited JSON (NDJSON).
// Do NOT use LSP-style HTTP headers (e.g. Content-Length).
// See MCP protocol spec (SEP-2575) and mcp-go-sdk bufio.Scanner implementation.
let payload = format!("{}\n", msg);
let mut stdout = tokio::io::stdout();
let _ = stdout.write_all(payload.as_bytes()).await;
let _ = stdout.write_all(msg.as_bytes()).await;
let _ = stdout.write_all(b"\n").await;
let _ = stdout.flush().await;
}