fix(mcp): use NDJSON instead of LSP framing for MCP stdio
All checks were successful
Release / build (amd64, windows) (push) Successful in 43s
Release / build (arm64, linux) (push) Successful in 1m0s
Release / build (amd64, linux) (push) Successful in 1m10s
Release / build (amd64, darwin) (push) Successful in 1m19s
Release / build (arm64, darwin) (push) Successful in 1m46s
Release / release (push) Successful in 21s
All checks were successful
Release / build (amd64, windows) (push) Successful in 43s
Release / build (arm64, linux) (push) Successful in 1m0s
Release / build (amd64, linux) (push) Successful in 1m10s
Release / build (amd64, darwin) (push) Successful in 1m19s
Release / build (arm64, darwin) (push) Successful in 1m46s
Release / release (push) Successful in 21s
Replace Content-Length framing with newline-delimited JSON (NDJSON) for MCP stdio transport. MCP clients like Claude Code expect one JSON object per line, not LSP-style Content-Length headers. The previous framing caused clients to reject responses.
This commit is contained in:
5
main.go
5
main.go
@@ -215,7 +215,10 @@ func writeResponse(resp interface{}) {
|
||||
}
|
||||
|
||||
func writeFramed(data []byte) {
|
||||
fmt.Fprintf(os.Stdout, "Content-Length: %d\r\n\r\n%s", len(data), data)
|
||||
// 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)
|
||||
}
|
||||
|
||||
func debugLog(format string, args ...interface{}) {
|
||||
|
||||
Reference in New Issue
Block a user