요약
kmsg 0.3.0의 mcp-server는 LSP 스타일 Content-Length: 헤더 프레이밍으로만 요청을 수신/응답하여, MCP 2024-11-05 stdio transport 표준(newline-delimited JSON)을 쓰는 Claude Code 등 표준 클라이언트와 연결되지 않습니다.
재현
실패하는 케이스 (MCP 표준, ndjson)
$ echo '{"jsonrpc":"2.0","id":1,"method":"initialize","params":{"protocolVersion":"2024-11-05","capabilities":{},"clientInfo":{"name":"t","version":"1"}}}' | kmsg mcp-server
# (응답 없음, 조용히 종료)
정상 동작하는 케이스 (LSP-style Content-Length)
$ BODY='{"jsonrpc":"2.0","id":1,"method":"initialize","params":{"protocolVersion":"2024-11-05","capabilities":{},"clientInfo":{"name":"t","version":"1"}}}'
$ printf "Content-Length: %d\r\n\r\n%s" "${#BODY}" "$BODY" | kmsg mcp-server
Content-Length: 438
{"id":1,"jsonrpc":"2.0","result":{...,"serverInfo":{"version":"0.3.0","name":"openclaw-kmsg-mcp"}}}
원인
Sources/kmsg/Commands/MCPServerCommand.swift
readMessage() — Content-Length 헤더 파싱 후 readExact()로 본문 수신
writeMessage() — Content-Length: N\r\n\r\n 헤더 + 본문 출력
MCP stdio transport 현 표준(2024-11-05 ~ 2025-06-18)은 줄바꿈 구분 JSON입니다.
참고: https://modelcontextprotocol.io/docs/concepts/transports#stdio
영향
- Claude Code:
✗ Failed to connect (설정 경로에 kmsg mcp-server 등록 시)
- 기타 표준 MCP 클라이언트(Cursor 등) 연결 불가
기대 동작
mcp-server가 ndjson 프레이밍을 지원하도록 수정 (기본값) 또는 --transport ndjson|lsp 플래그 추가.
환경
- kmsg 0.3.0 (Homebrew, channprj/tap)
- macOS 25.4.0 (Darwin)
- Node 24.15.0 / Claude Code 최신
요약
kmsg 0.3.0의mcp-server는 LSP 스타일Content-Length:헤더 프레이밍으로만 요청을 수신/응답하여, MCP 2024-11-05 stdio transport 표준(newline-delimited JSON)을 쓰는 Claude Code 등 표준 클라이언트와 연결되지 않습니다.재현
실패하는 케이스 (MCP 표준, ndjson)
정상 동작하는 케이스 (LSP-style Content-Length)
원인
Sources/kmsg/Commands/MCPServerCommand.swiftreadMessage()—Content-Length헤더 파싱 후readExact()로 본문 수신writeMessage()—Content-Length: N\r\n\r\n헤더 + 본문 출력MCP stdio transport 현 표준(2024-11-05 ~ 2025-06-18)은 줄바꿈 구분 JSON입니다.
참고: https://modelcontextprotocol.io/docs/concepts/transports#stdio
영향
✗ Failed to connect(설정 경로에kmsg mcp-server등록 시)기대 동작
mcp-server가 ndjson 프레이밍을 지원하도록 수정 (기본값) 또는--transport ndjson|lsp플래그 추가.환경