I have a simple issue, but can’t find a solution.
My remote MCP server is up and running. It has a single tool (hello world) which can be invoked by MCP client.
The MCP client is the openai Responses. It successfully retrieves the list of tools and it calls correct tool, but before calling the tool, the Responses terminates a session.
Logs from my MCP server (the first log is request body and the second is session ID used for a request). As you can see, the session is terminated and after that the MCP client tries to call the tool with the same session ID:
I figured out how to fix this. The issue was with not sending the complete expected return message. So when performing an mcp tool call an approval request will be returned, since I had store: False. When doing the second call I included the approval referencing the approval request id and the approval request object from the first call. I learned I also had to include the tool definitions that came back from the first call. Once I included these objects it consistently works.
So as you can see… DELETE is called before the tools/call method… this causes the following tools/call to have a 400 bad request error result…
If I remove the DELETE (which is for removing sessions) handling, it works fine.
This is my dependencies… (Node JS)
“@modelcontextprotocolmodelcontextprotocolmodelcontextprotocolmodelcontextprotocol/sdk”: “^1.17.3”,
“express”: “^5.1.0”,
“openai”: “^5.13.1”,
“selfsigned”: “^3.0.1”
Still trying to figure out how not to have the early DELETE call…
@OpenAI_Support can you please share an update? Using MCP servers like GitHub’s always results in errors after the 1st interaction with “session_terminated”.
It looks like it’s an API issue specifically with MCP servers that use sessions. The session ID returned from the initial initialization/list_tools is not added to the existing headers.