424 error code on MCP server connection

Hi,
We’ve been working on MCP implementation; after intensive testing, we came with a simple server running a streamable-http transport type server.
We can successfully inspect the serve using npx @modelcontextprotocol/inspector (listing tools, calling tools, fetching resources …)
and we can also successfully connect and execute tools via LLM using the Github Copilot tool implementation in VSCode.

All we need is the ‘connection json’:

            "my-sse-server": {
                "type": "http",
                "url": "http://machine-ip:3000/mcp/",
            }

We successfully made a similar server MCP of type SSE with similar results.

But, when trying to feed an Agent with our MCP server via the following code:

response = client.responses.create(
    model="gpt-4.1-mini",
    input=[{
        "role": "user",
        "content": "read wiki about redis and summarize it"
    }],
    instructions="You are a helpful assistant. Use the MCP server(s) to retrieve useful tools and use them in case you need them.",
    reasoning=None,
    tools=[
        # {
        #     "type": "mcp",
        #     "server_label": "deepwiki",
        #     "server_url": "https://mcp.deepwiki.com/mcp",
        #     "allowed_tools": [
        #         "read_wiki_structure",
        #         "read_wiki_contents",
        #         "ask_question"
        #     ],
        #     "require_approval": "never"
        # },
        {
            "type": "mcp",
            "server_label": "custom_mcp",
            "server_url": "http://machine-ip:3000/mcp/",
            "require_approval": "never"
        }
    ],
    temperature=0.8,
    max_output_tokens=2048,
)

we get an 424 error: the server does not print any log, like if the OpenAI never tried to send a request.

As shown in the code above, if we use the (commented) deepwiki MCP server, the call to responses.create works perfectly!

Any help on this? Thanks

PS: our first guess is that we are running the server over http instead of https

I had this problem too and I figured out, as you guessed, that it works when I use https on my server.

2 Likes

Just one question here, the use of this type of mcp (close to the hostedMCP tool) is only possible against a server that is publicly accessible (in the internet)?
Or we can do our private mcp-server and the Agent will reach it like this also?

1 Like

So yes you can build easily your mcp server via, e.g., some python code.
But you must run it over https for OpenAI to even consider it

1 Like

Is it possible to run the MCP through http instead of https, for development purposes, using the openai sdk?

1 Like

OpenAI access internet exposed mcp servers. So you have to expose your local machine using ngrok or similar router

I am trying to have a similar setup. If possible, could you share the client setup info? Please refer to my post