Skip to content

MCP session is terminated before the request has been executed #472

@fchristophersen-adam

Description

@fchristophersen-adam

I have been working with the Sample Cupcake Server and tried to call it using the OpenAI API. However, no request can be made. I noticed that the session is terminated before the request is made. This only occurs when establishing a session-based connection. In https://community.openai.com/t/openai-mcp-client-starts-to-fail-when-moving-from-sse-to-streamable-http/1275728, the problem was solved with a workaround by no longer allowing the server to work with sessions (Add stateless_http=True to your FastMCP initialization: mcp = FastMCP(“bloomy-mcp”, stateless_http=True)). However, this does not solve the actual problem.

log cupcake-server:
INFO: 52.255.109.109:0 - "GET /mcp/ HTTP/1.0" 200 OK
INFO: 52.255.109.109:0 - "POST /mcp/ HTTP/1.0" 202 Accepted
INFO: 52.255.109.101:0 - "POST /mcp/ HTTP/1.0" 200 OK
session gets terminated here********
INFO: 52.255.109.97:0 - "DELETE /mcp/ HTTP/1.0" 200 OK
*request after session gets terminated
INFO: 52.255.109.102:0 - "POST /mcp/ HTTP/1.0" 404 Not Found
truncated response from server:
"type": "mcp_call",
"error": {
"type": "mcp_protocol_error",
"code": 32600,
"message": "Session terminated"

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions