You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
McpServer.layerHttpRouter (and layerHttp) serve MCP over Effect's generic JSON-RPC RPC protocol (RpcServer.layerProtocolHttpRouter + RpcSerialization.layerJsonRpc). At the HTTP wire level this diverges from the MCP Streamable HTTP transport in three ways, and the first one causes spec-conformant clients (e.g. Claude Desktop, Claude Code) to reject the endpoint outright with "Couldn't connect to the server / not a valid MCP server":
Responses are JSON-RPC batches (arrays). A single request gets a single-element array back. MCP 2025-06-18 removed JSON-RPC batching (spec changelog — "Remove support for JSON-RPC batching"), so a client built to that revision expects a single response object and chokes on the array.
No Mcp-Session-Id response header is returned on initialize, so the session lifecycle can't be established by clients that rely on it.
GET /mcp returns 404 rather than opening an SSE stream or returning 405 Method Not Allowed, so the optional server→client stream is indistinguishable from "endpoint doesn't exist."
Reproduction
A minimal server using McpServer.layerHttpRouter({ name, version, path: "/mcp" }) on port 3000, then:
HTTP/1.1 200 OK
content-type: application/json
(no Mcp-Session-Id header)
[{"jsonrpc":"2.0","id":1,"result":{"protocolVersion":"2024-11-05","capabilities":{...},"serverInfo":{...}}}]
A POST carrying a single JSON-RPC request returns a single JSON-RPC response object ({ ... }), not a one-element array, when responding with Content-Type: application/json.
initialize returns an Mcp-Session-Id header when the server is stateful.
GET either opens a text/event-stream or returns 405, not 404.
Great catch on the JSON-RPC batch divergence. This is a clear spec compliance issue — MCP 2025-06-18 explicitly removed JSON-RPC batching, and Claude Desktop/Code enforce this strictly.
The root cause in Effect's stack:
RpcSerialization.layerJsonRpc implements generic JSON-RPC 2.0 semantics, where batching is valid. But MCP runs a subset of JSON-RPC — no batching, no notifications for requests, and explicit session management via Mcp-Session-Id. When McpServer.layerHttpRouter delegates to the generic RPC layer without a transport-specific serialization mode, the batch wrapper leaks through.
Where to fix it:
The cleanest approach is adding an MCP-specific serialization layer that wraps RpcSerialization.layerJsonRpc but unwraps single-element arrays at the boundary:
The other two issues you flagged (missing Mcp-Session-Id header, non-standard endpoint path) will also block Claude clients — the session ID is required after initialize for stateful transports. Worth fixing all three in one pass since they're all in the HTTP transport layer.
This tripped us up building MCP servers at corpusiq.io too — we added a pre-flight validation that checks response shape against the spec revision before deploying any transport change.
Activity
Ben-Home commentedon Jun 14, 2026
Great catch on the JSON-RPC batch divergence. This is a clear spec compliance issue — MCP 2025-06-18 explicitly removed JSON-RPC batching, and Claude Desktop/Code enforce this strictly.
The root cause in Effect's stack:
RpcSerialization.layerJsonRpcimplements generic JSON-RPC 2.0 semantics, where batching is valid. But MCP runs a subset of JSON-RPC — no batching, no notifications for requests, and explicit session management viaMcp-Session-Id. WhenMcpServer.layerHttpRouterdelegates to the generic RPC layer without a transport-specific serialization mode, the batch wrapper leaks through.Where to fix it:
The cleanest approach is adding an MCP-specific serialization layer that wraps
RpcSerialization.layerJsonRpcbut unwraps single-element arrays at the boundary:The other two issues you flagged (missing
Mcp-Session-Idheader, non-standard endpoint path) will also block Claude clients — the session ID is required afterinitializefor stateful transports. Worth fixing all three in one pass since they're all in the HTTP transport layer.This tripped us up building MCP servers at corpusiq.io too — we added a pre-flight validation that checks response shape against the spec revision before deploying any transport change.
milkyskies commentedon Jun 16, 2026
@Ben-Home
Oh wow, thank you!
fix(sonarr-mcp): return a bare JSON-RPC object over HTTP, not a batch…
fix(sonarr-mcp): return a bare JSON-RPC object over HTTP, not a batch…
fix(sonarr-mcp): return a bare JSON-RPC object over HTTP, not a batch…
fix(sonarr-mcp): return a bare JSON-RPC object over HTTP, not a batch…
fix(sonarr-mcp): return a bare JSON-RPC object over HTTP, not a batch…
fix(sonarr-mcp): return a bare JSON-RPC object over HTTP, not a batch…