Skip to content

mcp: correctly disallow GET requests on stateless servers#407

Merged
findleyr merged 1 commit intomodelcontextprotocol:mainfrom
findleyr:streamable-get
Sep 3, 2025
Merged

mcp: correctly disallow GET requests on stateless servers#407
findleyr merged 1 commit intomodelcontextprotocol:mainfrom
findleyr:streamable-get

Conversation

@findleyr
Copy link
Copy Markdown
Contributor

@findleyr findleyr commented Sep 3, 2025

The condition sessionID == "" was not quite right for disallowing GET requests. Since we decided to differentiate "stateless" vs "sessionless" servers, we need to disallow GET requests for both.

For #393

The condition sessionID == "" was not quite right for disallowing GET
requests. Since we decided to differentiate "stateless" vs "sessionless"
servers, we need to disallow GET requests for both.

For modelcontextprotocol#393
@findleyr findleyr requested a review from jba September 3, 2025 20:11
@findleyr findleyr merged commit a1eb484 into modelcontextprotocol:main Sep 3, 2025
5 checks passed
Comment thread mcp/streamable.go
switch req.Method {
case http.MethodPost, http.MethodGet:
if req.Method == http.MethodGet && sessionID == "" {
if req.Method == http.MethodGet && (h.opts.Stateless || sessionID == "") {
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!!! Looks good!

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants