perf: eliminate loop string allocations and proxy mem spikes
This commit is contained in:
1 parent
d5a05f8416
commit
dc59aa9238
5 files changed
+30
-24
No files matched your search
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user