Skip to content

fix: prevent streamable HTTP session leak#934

Merged
DaleSeo merged 1 commit into
mainfrom
fix/streamable-http-session-leak
Jun 27, 2026
Merged

fix: prevent streamable HTTP session leak#934
DaleSeo merged 1 commit into
mainfrom
fix/streamable-http-session-leak

Conversation

@DaleSeo

@DaleSeo DaleSeo commented Jun 26, 2026

Copy link
Copy Markdown
Member

Motivation and Context

The stateful Streamable HTTP server could allocate a local session before rejecting an invalid initial POST. This change validates that an initial stateful POST is an initialize request, checks the MCP-Protocol-Version header against the initialize body, and only creates a session after those checks pass. That keeps rejected pre-initialize requests from leaving entries behind in LocalSessionManager.

How Has This Been Tested?

Added tests

Breaking Changes

None.

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Documentation update

Checklist

  • I have read the MCP Documentation
  • My code follows the repository's style guidelines
  • New and existing tests pass locally
  • I have added appropriate error handling
  • I have added or updated documentation as needed

@github-actions github-actions Bot added T-test Testing related changes T-core Core library changes T-transport Transport layer changes labels Jun 26, 2026
@DaleSeo DaleSeo marked this pull request as ready for review June 26, 2026 21:37
@DaleSeo DaleSeo requested a review from a team as a code owner June 26, 2026 21:37
@DaleSeo DaleSeo self-assigned this Jun 27, 2026
@DaleSeo DaleSeo merged commit dfa7fd6 into main Jun 27, 2026
19 checks passed
@DaleSeo DaleSeo deleted the fix/streamable-http-session-leak branch June 27, 2026 01:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

T-core Core library changes T-test Testing related changes T-transport Transport layer changes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants