2
0

1 Commits

Author SHA1 Message Date
4eb7f78b6b fix(mcp): restore Content-Length framing for MCP stdio
All checks were successful
Release / build (amd64, windows) (push) Successful in 39s
Release / build (arm64, darwin) (push) Successful in 40s
Release / build (amd64, linux) (push) Successful in 52s
Release / build (amd64, darwin) (push) Successful in 1m27s
Release / build (arm64, linux) (push) Successful in 1m38s
Release / release (push) Successful in 24s
Revert to LSP-style Content-Length framing for MCP stdio transport. Testing confirmed that MCP clients (Claude Code) do expect Content-Length headers, not raw NDJSON. The earlier NDJSON change was based on incorrect assumption about the protocol.
2026-04-15 03:46:17 -04:00

View File

@@ -246,10 +246,7 @@ func writeResponse(resp interface{}) {
}
func writeFramed(data []byte) {
// MCP stdio transport uses newline-delimited JSON (NDJSON), not LSP-style
// Content-Length framing. Claude Code and other MCP clients reject
// Content-Length headers on stdio, so we emit one JSON object per line.
fmt.Fprintf(os.Stdout, "%s\n", data)
fmt.Fprintf(os.Stdout, "Content-Length: %d\r\n\r\n%s", len(data), data)
}
func debugLog(format string, args ...interface{}) {