Unable to bind / run uvicorn on 0.0.0.0 resulting in failure of starting of remote MCP server

I tried to deploy an MCP server remotely with transport of sse.

In some documentation on mcp I see mention of host=‘0.0.0.0’ as an argument to mcp.run but it gives an error of:

mcp.run(host=‘0.0.0.0’, transport=‘sse’)
TypeError: FastMCP.run() got an unexpected keyword argument ‘host’

I also tried specifying PORT explicitly to be 10000 in the environment.

What I notice in the log on render.com deployment is:

INFO: Uvicorn running on 127.0.0.1:10000 (Press CTRL+C to quit)

which makes me believe that somehow render is binding my server to localhost rather than 0.0.0.0 which eventually gives an error of:

==> Port scan timeout reached, no open ports detected on 0.0.0.0. Detected open ports on localhost – did you mean to bind one of these to 0.0.0.0?

When I run the same code locally I get something like:

INFO: Uvicorn running on 0.0.0.0:10000 (Press CTRL+C to quit)

How do I make uvicorn run / bind on 0.0.0.0 during render deployment?

1 Like

Edit: Faced the same issue, was resolved by moving the host to FastMCP instantiation, i.e.;

mcp = FastMCP(“My MCP”, host=“0.0.0.0”)

mcp.run(transport=“sse”)