Skip to content

feat(cortex): serve /mcp in stateless JSON mode (broad client compat)#103

Open
ApiliumDevTeam wants to merge 1 commit into
devfrom
fix/mcp-http-stateless
Open

feat(cortex): serve /mcp in stateless JSON mode (broad client compat)#103
ApiliumDevTeam wants to merge 1 commit into
devfrom
fix/mcp-http-stateless

Conversation

@ApiliumDevTeam

Copy link
Copy Markdown
Contributor

Summary

Switches the /mcp Streamable HTTP endpoint to stateless + json_response mode.

aingle's 25 MCP tools are all request/response (no server-initiated notifications), so the SSE notification stream isn't needed. In the default stateful mode, rmcp requires clients to open a GET /mcp text/event-stream channel; some HTTP MCP clients (e.g. Claude Code's local HTTP transport) don't, producing 406 Not Acceptable: Client must accept text/event-stream. Stateless + json_response returns plain JSON request/response (spec-compliant, MCP 2025-06-18) and works with more clients.

Change

StreamableHttpServerConfig::default().with_allowed_hosts(..).with_stateful_mode(false).with_json_response(true) (one config line).

Verification

  • Reproduced the original failure: Claude Code → /mcp over HTTP returned 406 ... must accept text/event-stream (stateful GET channel). After the change, Claude Code connects and drives the full tool flow (create_triple → query → signed dag_history) over HTTP.
  • Manual: POST /mcp200, Content-Type: application/json, no Mcp-Session-Id (stateless); GET /mcp405 (no SSE channel).

Note: the full cargo test sweep for this branch is pending — a long-running local demo server currently holds the build's binary lock; will run mcp_http_integration + mcp_oauth_integration + the suite before merge. The existing integration tests send Accept: application/json, text/event-stream and assert serverInfo in the body, which holds for JSON responses.

@ApiliumDevTeam ApiliumDevTeam force-pushed the fix/mcp-http-stateless branch 2 times, most recently from 991b787 to f8e3642 Compare June 23, 2026 17:43
@ApiliumDevTeam ApiliumDevTeam changed the base branch from main to dev June 23, 2026 17:43
@ApiliumDevTeam ApiliumDevTeam force-pushed the fix/mcp-http-stateless branch from f8e3642 to b8c565b Compare June 23, 2026 17:49
aingle's MCP tools are all request/response (no server-initiated notifications),
so the SSE notification stream isn't needed. Stateful streamable-HTTP mode requires
clients to open a GET text/event-stream channel, which some HTTP MCP clients don't,
yielding 406 Not Acceptable. Stateless + json_response = plain JSON request/response,
spec-compliant (MCP 2025-06-18) and compatible with more clients.
@ApiliumDevTeam ApiliumDevTeam force-pushed the fix/mcp-http-stateless branch from b8c565b to 1c24584 Compare June 23, 2026 18:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant