Skip to content

[MCP Stateless] Slice B-3: Mock stateless server + integration tests for the stateless path #1513

Description

@Lexus2016

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

  1. 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.

  2. Test: capability detection — verify _detect_stateless_support() correctly identifies stateless vs stateful servers.

  3. Test: synthesize_capabilities flow — verify synthesize_capabilities() produces a valid InitializeResult from a server/discover response that downstream consumers accept.

  4. Test: stateless call_tool — verify the hot path (line ~4263) routes correctly in stateless mode and returns tool results.

  5. Test: flag-off regression — verify the existing stateful path is 100% unchanged when HERMES_MCP_STATELESS is not set.

  6. Test: session-id absence — verify Mcp-Session-Id header is NOT sent in stateless mode.

What this issue does NOT do

Success criteria

  • Mock stateless server fixture created
  • Capability detection test passes
  • synthesize_capabilities flow test passes
  • Stateless call_tool integration test passes
  • Flag-off regression test confirms zero behavioral change
  • Session-id absence test passes
  • All tests pass with pytest tests/ -x -q
  • Fits ≤200-line self-merge cap

Dependencies

Audit reference

Full call-site map: docs/mcp/2026-07-28-stateless-migration-audit.md

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requestmcpMCP adapter / protocolneeds-splitWanted, but exceeds one cycle — needs decompositionresearch-drivenCreated by the evolution research cycle

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions