{
  "id": 2000175,
  "title": "MCP C# SDK Hybrid Sessions: Serve Old and New Clients on One Endpoint",
  "url": "https://urgent.news/2026/08/19/mcp-c-sdk-hybrid-sessions-serve-old-and-new-clients-on-one-endpoint",
  "topic": "tech",
  "section": "Tech",
  "published": "2026-08-19T18:47:30.000Z",
  "source": {
    "name": "Dev.to",
    "slug": "dev-to",
    "url": "https://dev.to/ssukhpinder/mcp-c-sdk-hybrid-sessions-serve-old-and-new-clients-on-one-endpoint-47hp"
  },
  "original_language": "en",
  "account": "MCP C# SDK hybrid sessions allow both legacy and modern clients to use a single ASP.NET Core endpoint without forcing modern clients to downgrade or stripping features from legacy clients. The stable C# SDK 2.2.0 introduced the HttpServerSessionMode.StatefulForInitializeClients option to enable this hybrid stateful/stateless serving.\n\nThe MCP revision from 2026-07-28 removed the initialize handshake and Mcp-Session-Id from the wire format, making clients self-describing. This change made the core stateless, but existing servers needed to handle both old and new clients. With HttpServerSessionMode.Stateful, legacy-era clients receive full sessions, while modern requests are refused to encourage a dual-path for clients to fall back to the older handshake. Stateless mode makes every request independent, which is the default for servers that don't need session state or older server-to-client flows.\n\nTo configure MCP C# SDK hybrid sessions, use the builder with Services.AddMcpServer().WithHttpTransport(options => { options.SessionMode = HttpServerSessionMode.StatefulForInitializeClients; }).WithTools(); Then map the endpoint with app.MapMcp(\"/mcp\");\n\nLegacy-era clients send an initialize request with protocolVersion: 2025-11-25, receiving a Mcp-Session-Id for later requests. Modern clients send server/discover or other operations with their metadata. They don't receive a session ID.\n\nThe test server configuration uses Microsoft.AspNetCore.TestHost to verify both protocol versions without running the model. It checks that a modern discovery succeeds without a Mcp-Session-Id, a modern echo tool call remains stateless, a legacy initialize succeeds and sets a non-empty session ID, and a legacy notification or tool call reuses that session. A modern DELETE returns 405 Method Not Allowed, while a legacy DELETE closes its session successfully. The key assertion is that each side gets the correct session semantics.\n\nThe hybrid mode is a bridge, not a universal default. If all clients speak 2026-07-28 and the server needs no session-only behavior, choose Stateless for simplicity and better scaling. Hybrid mode doesn't support unsolicited notifications or resource subscriptions and lacks per-client isolation. Moreover, it retains the operational costs of sessions on the server, such as memory usage and potential affinity issues across multiple instances.\n\nAuthentication and authorization are separate concerns; a session ID doesn't prove identity. Keep this regression test until the last initialize-era client is retired, then change the server and test together to the explicit stateless mode.",
  "summary": "The MCP C# SDK hybrid sessions option solves an awkward upgrade boundary: some clients still use the 2025-11-25 initialize handshake and depend on sessions, while clients on 2026-07-28 expect every HTTP request to stand alone. I want both groups to reach one ASP.NET Core endpoint without making modern clients downgrade or stripping useful behavior from legacy clients. The stable C# SDK 2.2.0…",
  "key_points": [],
  "editors_take": null,
  "illustration": null,
  "coverage": {
    "outlets": 1,
    "also_reported_by": []
  },
  "ai_generated": true,
  "disclaimer": "Summaries, key points and the editor’s take are written by software from other outlets’ reporting and may contain errors — always check the linked original."
}