Checking who can reach a local Ollama and no-auth MCP stack
- Models & engines
- Mac running Ollama 0.40.16 on 127.0.0.1:11434
macOS firewall on, with allow rules for the Homebrew Python.app and Ollama - Key gotcha
- With host="0.0.0.0" the MCP SDK sets DNS-rebinding protection to None, so there was no host checking at all
What they built
Nerav Doshi's MCP search server had run over SSE, bound to 0.0.0.0 on port 8090 with no authentication, so the n8n container could reach it. This entry checks what is listening, who can reach it, and what it takes to narrow that down without breaking n8n.
From the Mac's own Wi-Fi address the MCP server answered and an MCP client could list and call its search_notes tool with no credentials, while Ollama refused. From a throwaway Podman container, Ollama, bound to 127.0.0.1 only, returned its full model list, because Podman forwards host.containers.internal traffic onto the Mac's loopback.
Setup
- Mac running Ollama 0.40.16 on 127.0.0.1:11434
- Python MCP search server (FastMCP over SSE) on port 8090
- n8n in Podman, published on 0.0.0.0:5678
- macOS firewall on, with allow rules for the Homebrew Python.app and Ollama
How it works
- lsof -nP -iTCP -sTCP:LISTEN to see what is listening and on which interface
- curl against the Mac's LAN address for each port
- The MCP Python client against the LAN address to list tools and call one
- curl from a throwaway curlimages/curl Podman container to host.containers.internal
Results & numbers
- Final version: LAN address refused, both container hostnames 200, loopback with Host: evil.example gets 421
- Binding to 127.0.0.1 alone closed the LAN address but broke the container with Invalid Host header (421)
- The ollama launch menu turned out to be a built-in feature of the signed Ollama.app, not something that got onto the machine
Gotchas
- With host="0.0.0.0" the MCP SDK sets DNS-rebinding protection to None, so there was no host checking at all
- "Localhost only" with Podman means this machine and every container on it; Ollama's unauthenticated API also has endpoints to pull and delete models
- The fix narrows who can connect but adds no authentication; testing was from the Mac and containers, not from another device
“Ollama, bound to 127.0.0.1 only, answered a container with the full model list.”— Nerav Doshi
Do it yourself
- Run lsof to list listening ports and their bind addresses
- Curl each service from the machine's LAN address and from a throwaway container
- Bind the MCP server to 127.0.0.1
- Turn on DNS-rebinding protection and allow localhost plus host.containers.internal and host.docker.internal
- Re-test from the LAN address, the containers and with a fake Host header
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)Similar setups
MapNet: permission-aware local RAG over your folders on a CPU laptop with Ollama
Gal built MapNet, an MIT research prototype that keeps a live map of folders, files and sections so a small Ollama model only reads the few passages it needs, and published where it loses to embedding everything.
A local news-reading agent on Ollama that loses internet access while it thinks
A developer built News Scout, a Qwen3 14B agent on Ollama that picks IT stories from five RSS feeds, then split each run so the model reads the cached feeds inside a macOS sandbox with no internet.
Ollama next to n8n on a CPU-only VPS: measured speed and RAM
A developer measured how fast Ollama runs Llama 3.x models on an 8-vCPU VPS with no GPU, and how much RAM a self-hosted n8n really uses beside it, and published the raw numbers.
A read-only Gemma 4 agent on Ollama that explains what fills a Mac's disk
A sysadmin's one-file Python agent lets Gemma 4 on Ollama dig through his home folder and write a Markdown report on disk usage, while code and a four-line macOS sandbox-exec profile make sure it can only look.