-
Notifications
You must be signed in to change notification settings - Fork 38
fix(ibac): Bypass MCP session-terminate DELETE as transport_stream #451
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
huang195
merged 3 commits into
rossoctl:main
from
huang195:fix/ibac-mcp-session-terminate
Jun 1, 2026
Merged
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🧩 Analysis chain
🌐 Web query:
MCP Streamable HTTP Mcp-Session-Id header specification💡 Result:
The Model Context Protocol (MCP) has undergone a significant architectural change regarding session management. As of the current date (May 2026), the
Mcp-Session-Idheader has been deprecated and removed from the protocol specification [1][2][3]. Historical Context and Specification: Prior to this change (notably in specifications from 2025 and early 2026), the Streamable HTTP transport utilized theMcp-Session-Idheader to maintain session state [2][3][4]. Under that previous model: 1. Initialization: The client performed aninitializerequest [2][3]. 2. Session Assignment: The server generated a unique session ID and returned it in theMcp-Session-Idresponse header [5][6][7]. 3. Session Persistence: Clients were required to include thisMcp-Session-Idheader in all subsequent HTTP requests [5][8][4]. The server used this identifier to associate requests with specific session state, capabilities, and negotiated protocol versions [3][7]. Current Status (Sessionless Architecture): The protocol has shifted to a stateless architecture [1][2]. The updated specification removes both theinitialize/initializedhandshake and theMcp-Session-Idheader entirely [2][3]. Requests are now designed to be independent and self-contained; any state required by the server must be managed explicitly by the client and included within request parameters (e.g., using explicit state handles) [1][3]. Consequently, any existing reliance onMcp-Session-Idfor routing or stateful behavior is no longer supported in the current MCP specification [2][3].Citations:
🏁 Script executed:
Repository: kagenti/kagenti-extensions
Length of output: 1940
🌐 Web query:
site:modelcontextprotocol.io Mcp-Session-Id streamable HTTP💡 Result:
In the Model Context Protocol (MCP), Mcp-Session-Id is an HTTP header used specifically within the Streamable HTTP transport to manage session state between a client and server [1][2][3]. Key details regarding its usage include: Initialization: A server MAY assign a session ID during initialization by including the Mcp-Session-Id header in the HTTP response that contains the InitializeResult [1][3]. Client Requirements: If a server provides an Mcp-Session-Id during initialization, the client MUST include this header in all subsequent HTTP requests made to that server for the duration of the session [1][3]. Validation: Servers that require a session ID SHOULD return an HTTP 400 Bad Request status for any non-initialization requests that do not include the header [1][3]. If a server receives a request with an invalid or expired session ID, it MUST respond with HTTP 404 Not Found, prompting the client to re-initialize [1][3]. Termination: Clients can explicitly terminate a session by sending an HTTP DELETE request to the MCP endpoint, including the Mcp-Session-Id header [1][4][3]. This header facilitates stateful communication in environments where multiple clients may connect to the same server, allowing the server to maintain distinct sessions [5][6]. Note that in some newer protocol revisions, the Streamable HTTP transport architecture has evolved, and users should always refer to the specific version of the specification they are implementing [7].
Citations:
🌐 Web query:
modelcontextprotocol.io transports streamable HTTP sessionless Mcp-Session-Id💡 Result:
In MCP Streamable HTTP, the header is indeed
Mcp-Session-Id, but whether it’s required depends on which Streamable HTTP protocol revision you’re targeting. 1) Streamable HTTP revisions that useMcp-Session-Id(stateful protocol layer) - In the older Streamable HTTP revisions (e.g., protocol version 2025-03-26), servers MAY assign a session ID by including anMcp-Session-Idheader on the HTTP response containing theInitializeResult. [1] - If the server returns anMcp-Session-Idduring initialization, clients using Streamable HTTP MUST include that sameMcp-Session-Idheader on all subsequent HTTP requests to that server. [2][1] - Session termination/behavior is also defined: servers can terminate sessions; clients receiving 404 for a request withMcp-Session-Idmust start a new session by sending a newInitializeRequestwithout a session ID; and clients SHOULD send an HTTP DELETE withMcp-Session-Idto explicitly terminate. [2][1] 2) 2026-07-28 revision (“stateless” protocol layer):Mcp-Session-Idremoved - The MCP Transport documentation’s draft “Transports” page describes a 2026-07-28 change where Streamable HTTP behavior was revised and specifically notes removal of “protocol-level sessions” and that requests/streams resumability mechanisms from earlier revisions are no longer part of this revision. [3] - The MCP release candidate blog post for 2026-07-28 states both that theMcp-Session-Idheader and the protocol-level session are removed, and that with both gone, any MCP request can go to any server instance (i.e., no sticky routing / shared session store needed at the protocol layer). [4] - SEP-2567 (“Sessionless MCP via Explicit State Handles”) further explains the intent: it removes the protocol-level session concept and theMcp-Session-Idheader, making the protocol sessionless. [5] So, for “modelcontextprotocol.io transports streamable HTTP sessionless Mcp-Session-Id”: - If you’re building against the sessionful Streamable HTTP revision, you must propagateMcp-Session-Idon subsequent requests after it’s returned withInitializeResult. [2][1] - If you’re building against the 2026-07-28 (sessionless) revision, the protocol removesMcp-Session-Id; you should not rely on it for request routing or continuity—use explicit state handles (per SEP-2567) or whatever mechanism the newer spec provides for carrying state. [3][5][4]Citations:
Validate MCP Streamable HTTP spec revision for
Mcp-Session-IdterminationIn
authbridge/authlib/plugins/ibac/plugin.go(lines 644-655), the header nameMcp-Session-Idmatches the Streamable HTTP transport in the sessionful protocol revisions (used to scope session state and used for explicit termination viaDELETE). If this code is meant to target the sessionless 2026-07-28/SEP-2567 revision,Mcp-Session-Idis removed from the protocol, so theDELETE+Mcp-Session-Idcheck should be updated accordingly.🤖 Prompt for AI Agents