You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 41a758c
Browse filesBrowse the repository at this point in the historyBrowse files
feat(everything): bind the HTTP transports to loopback by default, with HOST to widen
The Streamable HTTP and HTTP+SSE transports called app.listen(port) with
no host, so they bound every interface and a non-browser client on the
local network (which sends no Origin) could reach the server's tools.
listenOrExit now takes the host to bind; both transports resolve it from
HOST, defaulting to 127.0.0.1, and the listening line and the port-in-use
message name the bound address.
The container image sets HOST=0.0.0.0, since loopback inside a container
is unreachable from a published port. The boot smoke pins HOST to the
loopback address it connects to. The README, the Dockerfile and the
local-dev and client-smoke skills document HOST and the new listening
line.
Based on the prototype in #3303 by TheodorNEngoy.
Closes#5371
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Signed-off-by: cliffhall <[email protected]>
The Streamable HTTP and HTTP+SSE transports now bind the loopback interface (`127.0.0.1`) by default instead of every interface, so a server started over HTTP is no longer reachable from other hosts on the network. Set the new `HOST` environment variable to widen the bind deliberately (`HOST=0.0.0.0`); the container image sets it. The listening line now names the bound address and port. Thanks to TheodorNEngoy for the prototype in #3303.
Copy file name to clipboardExpand all lines: src/everything/README.md
+8-1Lines changed: 8 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -127,6 +127,13 @@ npm run start:streamableHttp
127
127
128
128
The endpoint is `http://localhost:3001/mcp` (`PORT` overrides the port). It serves 2026-07-28 clients statelessly and 2025-era clients with sessions, from the same URL.
129
129
130
+
Both HTTP transports (Streamable HTTP and HTTP+SSE) listen on the loopback interface, `127.0.0.1`, by default, so only clients on the same machine can reach them. Set `HOST` to bind another address: `HOST=0.0.0.0` listens on every interface, which exposes the server's tools to every host that can reach the machine, so set it only on a network you trust. The listening line the server prints names the address and port it bound, such as `127.0.0.1:3001`.
131
+
132
+
| Variable | Default | Effect |
133
+
| --- | --- | --- |
134
+
|`PORT`|`3001`| The port the HTTP transport listens on |
135
+
|`HOST`|`127.0.0.1`| The address it binds; `0.0.0.0` (or `::`) for every interface |
136
+
130
137
Both HTTP transports (Streamable HTTP and HTTP+SSE) accept browser requests only from a localhost origin: an `Origin` header whose host is `localhost`, `127.0.0.1` or `[::1]`, on any port, such as the MCP Inspector's. A request carrying any other `Origin` is refused with `403 Forbidden`. Clients that send no `Origin` header, which is every non-browser client, are unaffected.
131
138
132
139
## Running from source with [HTTP+SSE Transport](https://modelcontextprotocol.io/specification/2024-11-05/basic/transports#http-with-sse) (deprecated as of [2025-03-26](https://modelcontextprotocol.io/specification/2025-03-26/basic/transports))
@@ -195,7 +202,7 @@ docker run -i --rm mcp/everything
195
202
docker run --rm -p 127.0.0.1:3001:3001 mcp/everything streamableHttp
196
203
```
197
204
198
-
The endpoint is `http://localhost:3001/mcp`. The server listens on port 3001 on every interface inside the container; `127.0.0.1:` publishes it on the host's loopback only. To use another port, set `PORT` and publish that one (`-e PORT=8080 -p 127.0.0.1:8080:8080`). The localhost-only `Origin` check described above applies inside the container too. `docker stop` ends the server cleanly.
205
+
The endpoint is `http://localhost:3001/mcp`. The image sets `HOST=0.0.0.0`, so the server listens on port 3001 on every interface inside the container, which is what lets a published port reach it; `127.0.0.1:` publishes it on the host's loopback only. To use another port, set `PORT` and publish that one (`-e PORT=8080 -p 127.0.0.1:8080:8080`). The localhost-only `Origin` check described above applies inside the container too. `docker stop` ends the server cleanly.
0 commit comments