From 1c245849e4c62f758b5157c44c46af890467b142 Mon Sep 17 00:00:00 2001 From: ApiliumDevTeam Date: Tue, 23 Jun 2026 12:44:24 +0200 Subject: [PATCH] feat(cortex): serve /mcp in stateless JSON mode for broad client compat 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. --- crates/aingle_cortex/src/mcp/http.rs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/crates/aingle_cortex/src/mcp/http.rs b/crates/aingle_cortex/src/mcp/http.rs index fd4a2926..65a6ac52 100644 --- a/crates/aingle_cortex/src/mcp/http.rs +++ b/crates/aingle_cortex/src/mcp/http.rs @@ -80,7 +80,14 @@ pub fn mcp_http_router( allowed_hosts.extend(public_hosts.clone()); // StreamableHttpServerConfig is #[non_exhaustive]; build via Default + builder. - let config = StreamableHttpServerConfig::default().with_allowed_hosts(allowed_hosts); + // Stateless JSON request/response mode: aingle's tools are all request/response + // (no server-initiated notifications), so we don't need the SSE notification + // stream. This also maximizes client compatibility — clients that don't open a + // GET text/event-stream channel (e.g. some HTTP MCP clients) work without 406s. + let config = StreamableHttpServerConfig::default() + .with_allowed_hosts(allowed_hosts) + .with_stateful_mode(false) + .with_json_response(true); let service = StreamableHttpService::new( move || Ok(AingleMcp::new(factory_state.clone())), Arc::new(LocalSessionManager::default()),