Parent: #1287 (Slice B decomposition)
This is Slice B-3 of the MCP 2026-07-28 stateless migration. Depends on #1511 (B-1) and #1512 (B-2).
Scope (this issue — ≤200 lines)
Add a mock stateless MCP server and comprehensive integration tests that validate the stateless request path end-to-end. This closes the verification gap — Slices B-1 and B-2 add the code paths, this issue proves they work.
Specific changes
-
Mock stateless server fixture: a test helper that simulates a stateless MCP server (responds to server/discover, does NOT implement initialize/initialized, routes via _meta inline). Can be a lightweight unittest.mock or asyncio test server.
-
Test: capability detection — verify _detect_stateless_support() correctly identifies stateless vs stateful servers.
-
Test: synthesize_capabilities flow — verify synthesize_capabilities() produces a valid InitializeResult from a server/discover response that downstream consumers accept.
-
Test: stateless call_tool — verify the hot path (line ~4263) routes correctly in stateless mode and returns tool results.
-
Test: flag-off regression — verify the existing stateful path is 100% unchanged when HERMES_MCP_STATELESS is not set.
-
Test: session-id absence — verify Mcp-Session-Id header is NOT sent in stateless mode.
What this issue does NOT do
Success criteria
Dependencies
Audit reference
Full call-site map: docs/mcp/2026-07-28-stateless-migration-audit.md
Parent: #1287 (Slice B decomposition)
This is Slice B-3 of the MCP 2026-07-28 stateless migration. Depends on #1511 (B-1) and #1512 (B-2).
Scope (this issue — ≤200 lines)
Add a mock stateless MCP server and comprehensive integration tests that validate the stateless request path end-to-end. This closes the verification gap — Slices B-1 and B-2 add the code paths, this issue proves they work.
Specific changes
Mock stateless server fixture: a test helper that simulates a stateless MCP server (responds to
server/discover, does NOT implementinitialize/initialized, routes via_metainline). Can be a lightweightunittest.mockorasynciotest server.Test: capability detection — verify
_detect_stateless_support()correctly identifies stateless vs stateful servers.Test: synthesize_capabilities flow — verify
synthesize_capabilities()produces a validInitializeResultfrom aserver/discoverresponse that downstream consumers accept.Test: stateless call_tool — verify the hot path (line ~4263) routes correctly in stateless mode and returns tool results.
Test: flag-off regression — verify the existing stateful path is 100% unchanged when
HERMES_MCP_STATELESSis not set.Test: session-id absence — verify
Mcp-Session-Idheader is NOT sent in stateless mode.What this issue does NOT do
Success criteria
pytest tests/ -x -qDependencies
Audit reference
Full call-site map:
docs/mcp/2026-07-28-stateless-migration-audit.md