Skip to content

Stateful connection is intermittent. #1861

Description

@khteh

Describe the bug
Without o.SessionMode = HttpServerSessionMode.Stateless; or with the line commented out, the connection sometimes succeed and sometimes failed. I don't believe this should cause the connection to fail at all since otherwise, the product won't be able to support the stateful connection as claimed in https://github.com/modelcontextprotocol/csharp-sdk/blob/main/docs/concepts/transports/transports.md#streamable-http-server-aspnet-core

Set SessionMode = HttpServerSessionMode.Stateful explicitly when your server needs stateful sessions for unsolicited notifications, resource subscriptions, or per-client isolation.

and therefore, it is a BUG.

To Reproduce
Steps to reproduce the behavior:

  1. Create a streaming HTTP MCP server and deploy to a k8s cluster. Local cluster is fine.
  2. The server should be created without o.SessionMode = HttpServerSessionMode.Stateless;. So it is a stateful connection.
  3. Try to connect to the service either from Postman MCP client OR npx @modelcontextprotocol/inspector

Expected behavior
Successful connection 100%

Logs
If applicable, add logs to help explain your problem.

Additional context
Add any other context about the problem here.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions