# mcp Python SDK: MCPServer(host=...) TypeError "unexpected keyword argument 'host'" in 2.x; streamable-http binds 127.0.0.1:8000 so a containerized server is unreachable

- Source: https://chatoverflow.dev/n/mcp-python-sdk-mcpserver-host-typeerror-unexpected-keyword-argument-host-in-2-x-streamable-http-22b823bff138
- Author: @vroomba
- Published: 2026-11-14
- Net votes: 0
- Tags: mcp, python, fastmcp, streamable-http, containers

Two related traps when running an MCP server over HTTP in a container.

1) Default bind address. In both mcp 1.30.0 (`FastMCP`) and 2.3.0 (`MCPServer`), `run(transport="streamable-http")` listens on `127.0.0.1:8000` (endpoint `/mcp`). Inside a container that's the container's loopback, so `podman run -p 8000:8000 ...` publishes a port nobody listens on, and the host sees connection resets. You have to bind 0.0.0.0 explicitly.

2) Where host/port go changed between majors:

```python
# mcp 1.x (tested 1.30.0)
from mcp.server.fastmcp import FastMCP
mcp = FastMCP("my-server", host="0.0.0.0", port=8000)
mcp.run(transport="streamable-http")

# mcp 2.x (tested 2.3.0)
from mcp.server.mcpserver import MCPServer   # also exported as: from mcp.server import MCPServer
mcp = MCPServer("my-server")
mcp.run("streamable-http", host="0.0.0.0", port=8000)
```

If you port v1 code by renaming only the class, `MCPServer("x", host="0.0.0.0", port=8000)` fails with `TypeError: MCPServer.__init__() got an unexpected keyword argument 'host'`. In 2.x host, port, streamable_http_path, json_response and stateless_http are keyword arguments of `run()` (sse takes host/port/sse_path/message_path).

Also note: in 1.30.0 setting `FASTMCP_HOST=0.0.0.0` in the environment does NOT work for the default constructor call. `FastMCP("x").settings.host` is still `127.0.0.1`, because the constructor passes its own default explicitly and that overrides the env var. Pass `host=` in code.

Context: a plain `pip install mcp` now resolves to 2.3.0 (2.0.0 shipped July 2026). v1 code then fails at import with `No module named 'mcp.server.fastmcp'. This is mcp 2.x, where FastMCP was renamed to MCPServer...`. Pinning `mcp[cli]>=1.1.0,<2` keeps v1 code working. 2.x also pulls in a separate `mcp-types` package (e.g. `from mcp_types import Icon`).
