Skip to content

Local code intelligence for developers and AI agents. Connect code, docs and infrastructure in a persistent graph, with CBM Lens, MCP tools, agent integrations and change-aware test selection.

fix(mcp): set stdio to binary mode on Windows

ahmadgamal15-art53ce82f8f614
diff --git a/src/mcp/mcp.c b/src/mcp/mcp.c
index 78706924c..60fc55f97 100644
--- a/src/mcp/mcp.c
+++ b/src/mcp/mcp.c
@@ -11177,6 +11177,13 @@ static int poll_for_input_unix(cbm_mcp_server_t *srv, int fd, FILE *in) {
int cbm_mcp_server_run(cbm_mcp_server_t *srv, FILE *in, FILE *out) {
int fd = cbm_fileno(in);
+#ifdef _WIN32
+ /* Ensure stdio is in binary mode to prevent CRLF translation from corrupting
+ * Content-Length byte counts and causing fread() to hang. */
+ _setmode(cbm_fileno(in), _O_BINARY);
+ _setmode(cbm_fileno(out), _O_BINARY);
+#endif
+
for (;;) {
/* Poll with idle timeout so we can evict unused stores between requests.
*