SWI-Prolog MCP server and service - Reply # 01

It doesn’t work with Codex:

MCP client for `SWI-Prolog` failed to start: MCP startup failed: handshaking with MCP server failed: Send message error Transport
  [rmcp::transport::worker::WorkerTransport<rmcp::transport::streamable_http_client::StreamableHttpClientWorker<codex_rmcp_client::http_client_adapte
  r::StreamableHttpClientAdapter>>] error: Transport channel closed, when send initialized notification

MCP startup incomplete (failed: SWI-Prolog)

Its analysis:

The actual failure is a protocol bug in the SWI-Prolog MCP server.

  Evidence:

  - Codex is configured correctly at /home/XXXX/.codex/config.toml:70.
  - The MCP initialize request succeeds and returns a session ID.
  - On notifications/initialized, the server returns:

  HTTP/1.1 200 OK
  Content-Type: application/json
  Content-Length: 0

  For a notification with no response body, Streamable HTTP requires 202 Accepted with no body. Returning 200 application/json with an empty body
  likely makes Codex’s RMCP worker attempt to parse nonexistent JSON, terminate, and report “Transport channel closed.” MCP transport specification
  (https://modelcontextprotocol.io/specification/2025-03-26/basic/transports#sending-messages-to-the-server)

  The proper server response is:

  HTTP/1.1 202 Accepted
  Mcp-Session-Id: ...
  Content-Length: 0

  There is also a version smell: the server identifies itself as swipl-help 0.1.0 and negotiates protocol 2024-11-05, despite serving the newer
  Streamable HTTP endpoint. That may indicate an older or incomplete implementation, though version downgrade itself is permitted. MCP
  lifecycle/version negotiation (https://modelcontextprotocol.io/specification/2025-03-26/basic/lifecycle#version-negotiation)