OpenAI MCP client starts to fail when moving from SSE to Streamable HTTP

I am working on develop my own MCP server and trying to invoke some tools using the Responses API.
I am using FastMCP python package for the server which supports SSE and Streamable HTTP transport protocols.
My server is deployed locally and i’ve been using ngrok so the OpenAI client will be able to connect to it.
With SSE - Everything was working as expected. The problem is that it’s being noted as legacy in FastMCP documentation (can’t provide a link but it’s pretty easy to find).
I was trying to move to Streamable HTTP option which should be relatively simple but every tool invocation failed with session terminated error. This is what I get in the response object:
{"error":{"type":"mcp_protocol_error","code":32600,"message":"Session terminated"}}.

This is how I configured my client:

from typing import Optional

import openai

allowed_tools = [
    "generate_deals_list",
    "generate_company_list",
    "ask_general_question",
    "hello_world"
]

server_url = "{ngrok_url}/mcp"
token = "{some_token}"


class MCPClient:
    def __init__(self, model: str = "gpt-4o"):
        self.client = openai.OpenAI()
        self.model = model
        self.allowed_tools = allowed_tools

    def ask(
        self,
        user_input: str,
        system_prompt: Optional[str] = None
    ) -> str:
        messages = []
        if system_prompt:
            messages.append({"role": "system", "content": system_prompt})
        messages.append({"role": "user", "content": user_input})

        response = self.client.responses.create(
            model=self.model,
            input=messages,
            tools=[
                {
                    "type": "web_search_preview"
                },
                {
                    "type": "mcp",
                    "server_url": server_url,
                    "server_label": "assistant-orchestrator",
                    "allowed_tools": allowed_tools,
                    "require_approval": "never",
                    "headers": {
                        "Authorization": f"Bearer {token}"
                    }
                }
            ],
        )

        return response.output

On MCP Inspect, the tool call works with Streamable HTTP option so I think there is the issue with OpenAI.
I looked at my server logs, and I think the issue is because premature DELETE operation invoked by the client.
These are the logs when using OpenAI client:

INFO:     20.161.76.57:0 - "POST /mcp HTTP/1.1" 307 Temporary Redirect
INFO:     20.161.76.57:0 - "POST /mcp/ HTTP/1.1" 200 OK
INFO:     20.161.76.55:0 - "POST /mcp HTTP/1.1" 307 Temporary Redirect
INFO:     20.161.76.55:0 - "POST /mcp/ HTTP/1.1" 200 OK
INFO:     20.161.76.62:0 - "GET /mcp HTTP/1.1" 307 Temporary Redirect
INFO:     20.161.76.53:0 - "POST /mcp HTTP/1.1" 307 Temporary Redirect
INFO:     20.161.76.53:0 - "POST /mcp/ HTTP/1.1" 202 Accepted
INFO:     20.161.76.62:0 - "GET /mcp/ HTTP/1.1" 200 OK
INFO:     20.161.76.55:0 - "POST /mcp HTTP/1.1" 307 Temporary Redirect
INFO:     20.161.76.55:0 - "POST /mcp/ HTTP/1.1" 200 OK
**** DELETE Operation? ****
INFO:     20.161.76.59:0 - "DELETE /mcp HTTP/1.1" 307 Temporary Redirect
INFO:     20.161.76.59:0 - "DELETE /mcp/ HTTP/1.1" 200 OK
**** Tool Invocation Results in 404 ****
INFO:     20.161.76.55:0 - "POST /mcp HTTP/1.1" 307 Temporary Redirect
INFO:     20.161.76.55:0 - "POST /mcp/ HTTP/1.1" 404 Not Found

And these are the logs when using MCP Inspector:

INFO:     2a06:c701:468f:600:75d0:56e0:1bd7:4d1:0 - "POST /mcp HTTP/1.1" 307 Temporary Redirect
INFO:     2a06:c701:468f:600:75d0:56e0:1bd7:4d1:0 - "POST /mcp/ HTTP/1.1" 200 OK
INFO:     2a06:c701:468f:600:75d0:56e0:1bd7:4d1:0 - "POST /mcp HTTP/1.1" 307 Temporary Redirect
INFO:     2a06:c701:468f:600:75d0:56e0:1bd7:4d1:0 - "POST /mcp/ HTTP/1.1" 202 Accepted
INFO:     2a06:c701:468f:600:75d0:56e0:1bd7:4d1:0 - "GET /mcp HTTP/1.1" 307 Temporary Redirect
INFO:     2a06:c701:468f:600:75d0:56e0:1bd7:4d1:0 - "GET /mcp/ HTTP/1.1" 200 OK
**** Tool Invocation Results in 200 ****
INFO:     2a06:c701:468f:600:75d0:56e0:1bd7:4d1:0 - "POST /mcp HTTP/1.1" 307 Temporary Redirect
INFO:     2a06:c701:468f:600:75d0:56e0:1bd7:4d1:0 - "POST /mcp/ HTTP/1.1" 200 OK

I don’t have anything to do except to go back to SSE transport protocol, but I do think this issue should be solved because it probably won’t last long.

Let me know if anyone experience similar issue and if my analysis is correct.

We are also experiencing this issue, the server logs look essentially identical.

I’m also encountering the same behavior. Same server logs as well. Is there any fix? @Matan_Noach @alanjlaser

I am having the exact same issue. It made my demo rather embarassing

Noticed this as well, but only with my Python MCP servers. Oddly my TypeScript MCP servers running with a Cloudflare Worker runtime (locally) does not have this issue.

Python lib work with streamable http.
I open an answered on another issue title: it-can-perform-only-one-call-to-mcp and I saw this one, I took my whole day to fix it, maybe it was just stupid idk, I fix it in my way.

I have VPS google, then I redirect https signed SSL etc, on another port where is my MCP server, but my Apache2 didnt config the redirect with SSE buffer / reload then I think I lose data on this redirect. So I fix it, maybe I change my code then reply here if needed. But the biggest part look just the redirection https → service MCP server.

I change some redirect config from my Apache2, to handle SSE,
Because Http contain SSE and JSON, then check if you redirect the SSE request to your port of your service. My certificate was already good.

Good luck other dev, I stay online to answer questions if needed.