Checked Who Can Reach My Local AI Stack: No-Auth MCP on the LAN Address, and 'Localhost-Only' Ollama Open to Containers
Since Entry 14 the MCP search server has run over SSE, bound to 0.0.0.0 on port 8090 with no authentication. I made that choice so the n8n container could reach it, and never went back to check what else could. This entr
Since Entry 14 the MCP search server has run over SSE, bound to 0.0.0.0 on port 8090 with no authentication. I made that choice so the n8n container could reach it, and never went back to check what else could. This entry checks: what's listening, who can reach it, and what it takes to narrow that down without breaking n8n.
The server wasn't running when I started, and the saved mcp_search_server.py still had the mcp.run(host=...) line that Entry 14 found doesn't work with this SDK. So I made a copy, mcp_search_server_sse.py, with Entry 14's fix: host and port on the FastMCP() constructor, set from environment variables so I could start several versions side by side. Started it the way Entry 14 runs it, on 0.0.0.0:8090.
What's listening:
$ lsof -nP -iTCP -sTCP:LISTEN | grep -E "8090|11434|5678"
ollama 2350 flyers 4u IPv4 ... TCP 127.0.0.1:11434 (LISTEN)
Python 17604 flyers 14u IPv4 ... TCP *:8090 (LISTEN)
Ollama only listens on loopback. The MCP server listens on every interface (*). n8n wasn't running, but podman inspect n8n shows its port published as "HostIp":"0.0.0.0","HostPort":"5678", so whenever it runs, it's on every interface too.
Then, from the Mac, using its own Wi-Fi address instead of localhost (<mac-ip> below):
$ curl -sN --max-time 3 -o /dev/null -w "%{http_code}\n" http://<mac-ip>:8090/sse
200
$ curl -s --max-time 3 -o /dev/null -w "%{http_code}\n" http://<mac-ip>:11434/api/tags
000 # connection refused, curl exit 7
The MCP server answered on the LAN address and Ollama didn't. A 200 on an SSE endpoint only means a stream opened, so I went one step further and used the MCP Python client against the LAN address to list the tools and call one:
tools: ['search_notes']
[secrets-management-multi-cloud-pipelines_chunk8] (distance: 277.3)
above proves one thing: secret management is a routing problem ...
No credentials, no handshake beyond the protocol itself. Anything that can reach that address and port can search the index.
I couldn't test from a second device, so the honest claim is narrower than "the whole Wi-Fi can reach it." But nothing I found would stop it. The macOS firewall is on, and it has an explicit "Allow incoming connections" rule for the Homebrew Python.app that runs the server, plus "automatically allow signed software" enabled for both built-in and downloaded apps:
$ /usr/libexec/ApplicationFirewall/socketfilterfw --listapps
1 : /opt/homebrew/Cellar/[email protected]/.../Python.app (Allow incoming connections)
8 : /Applications/Ollama.app/Contents/Resources/ollama (Allow incoming connections)
Containers were the more surprising part. From a throwaway Podman container:
$ podman run --rm docker.io/curlimages/curl -s --max-time 3 http://host.containers.internal:11434/api/tags
{"models":[{"name":"llama3.2-vision:latest", ...
Ollama, bound to 127.0.0.1 only, answered a container with the full model list. Podman's VM forwards host.containers.internal traffic onto the Mac's loopback, so "localhost only" here means "this machine and every container on it." The same unauthenticated API has endpoints to pull and delete models. I didn't try those. The MCP server answered the container too, as it does for n8n.
So the first fix to try was binding the MCP server to 127.0.0.1. That closed the LAN address and broke the container:
$ curl -sN --max-time 3 -o /dev/null -w "%{http_code}\n" http://<mac-ip>:8091/sse
000 # refused
$ podman run --rm docker.io/curlimages/curl -s --max-time 3 http://host.containers.internal:8091/sse
Invalid Host header
The connection got through, and the server log recorded it as coming from 127.0.0.1, for the same forwarding reason as Ollama. It was rejected with 421 Misdirected Request. The MCP SDK turns on DNS-rebinding protection automatically when you bind to loopback, and it only accepts requests addressed to localhost, 127.0.0.1 or [::1]. A container asks for host.containers.internal, so it's refused. The flip side, which I hadn't known: with host="0.0.0.0" the SDK sets that protection to None. Entry 14's setup had no host checking at all.
The version that did what I wanted binds to loopback and adds the two container hostnames to the allow-list:
from mcp.server.transport_security import TransportSecuritySettings
security = TransportSecuritySettings(
enable_dns_rebinding_protection=True,
allowed_hosts=["127.0.0.1:*", "localhost:*", "[::1]:*",
"host.containers.internal:*", "host.docker.internal:*"],
allowed_origins=["http://127.0.0.1:*", "http://localhost:*", "http://[::1]:*"],
)
mcp = FastMCP("today-i-ran-notes", host="127.0.0.1", port=8092, transport_security=security)
| Request to port 8092 | Result |
|---|---|
| Mac's LAN address | refused |
Container, host.containers.internal
|
200 |
Container, host.docker.internal
|
200 |
Mac, loopback, with Host: evil.example
|
421 |
One loose end from the history closed along the way. Running bare ollama once printed a launcher menu naming third-party agents, and I never looked into it. ollama --help on 0.40.16 lists it: launch β Launch the Ollama menu or an integration, and ollama launch --help lists the integrations (Claude Code, Codex, OpenCode and others). /usr/local/bin/ollama is a symlink into the signed /Applications/Ollama.app. It's a built-in feature, not something that got onto the machine.
Some limits. I tested from the Mac and from containers, not from another device, so LAN reachability is inferred from the bind address and the firewall rule. The fix narrows who can connect. It doesn't add authentication: any process on this Mac and any container can still call search_notes. What it exposes is a search over articles that are already public, so the real-world risk was low. The Ollama exposure to containers is the bigger one, and binding to loopback doesn't fix it under Podman. I haven't switched n8n or Claude Code over to the fixed server yet. Claude Code's registration from Entry 15 points at port 8090 and needs updating once it moves.
The pattern from this pass is that "bound to localhost" means less on a Mac running a container VM than it sounds. Loopback-only Ollama was reachable from every container, and the MCP server I'd opened up for one container was reachable on the LAN address without credentials. Closing it properly took a bind address plus a host allow-list, and the next step is deciding whether this stack needs real authentication or just fewer listeners.
Originally published by Dev.to Security. Aggregated on AIWithGhost for educational purposes β full credit and traffic to the original publisher.