openai / openai/openai-openapi

MCP session is terminated before the request has been executed

Open
#472 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

upstream
Dominant language
No language data
Stars
2.5k
Forks
527
Avg merge
1h 46m
Merged PRs (30d)
2

Description

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"

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the reported session-based flow and inspect the GET, POST, and DELETE /mcp/ sequence in the logs. The fix is done when the request executes after session establishment without premature termination or a subsequent 404 Session terminated response.

Written by the indexing model from the issue text.

Assessment

Domain
api
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
28/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.