Skip to content

Add configuration to enable/disable "transparent session re-init on HTTP 404" #755

Closed

Description

@glicht

Is your feature request related to a problem? Please describe.
#743 added transparent session re-init for the client.

This can be problematic when dealing with MCP servers that have session state. Simply re-init of the connection and sending transparently the last tried command can have un-expected results.

For example think of the Playwright MCP server which maintains a browser session. Transparent session re-init can lead to a new session and navigation with an unexpected result.

I can see other scenarios that this feature provides value, but I think there should be an option to control when this feature is enabled.

Describe the solution you'd like
I would like to request that this feature can be controled (enables/disabled) via a configuration option.

A configuration option can be added to StreamableHttpClientTransportConfig.

Not sure what should be the default value. I tend to recommend to have the default as disabled to remain with the same implementation as before the feature was added. Thus maintaining safe behavior with MCPs that keep session state.

Additional context
Haven't seen such an implementation in other sdks such as the typescript-sdk.

Happy to take this PR and add the configuration.

@DaleSeo FYI

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

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions