← All guides

How Does a Reverse Proxy With Basic Auth Protect a Home MCP Server?

Published November 14, 2026 · Reviewed November 14, 2026 · Ingenious AI team

The short answer: A reverse proxy protects a home MCP server by standing between the internet and the server, on the public port, and refusing to forward any request that does not carry the right credentials. The MCP server moves to a private port bound to localhost, where only the proxy can reach it. A stranger now meets the proxy's 401 instead of your tool list — which is why the pattern turns an EXPOSED verdict into COVERED in HomeShield's free check. HomeShield's guided fix recipes include exactly this pattern (a Caddy site block) for exposed servers. It fails in predictable ways — a server still listening publicly on its old port is the classic — and this guide names them.

Check my endpoint now — free

What is a reverse proxy?

A program that accepts connections on behalf of another program. Visitors talk to the proxy; the proxy, after applying its rules — authentication, https, logging — passes approved requests to the real server behind it and returns the answers. Caddy and nginx are the two names home labs usually run. 'Reverse' because it fronts a server you own, rather than fronting you as a client.

The pattern, piece by piece

Three pieces move when you adopt the pattern. First, the MCP server's bind: it stops listening on all interfaces and binds to 127.0.0.1 on an internal port, so nothing off the machine can address it directly. Second, the proxy takes the public-facing port — the one your router forward or tunnel points at — and terminates https there. Third, the proxy's rule for your site: demand basic-auth credentials, and only then forward to the server's localhost port. HomeShield's recipe for an exposed FastMCP server spells the sequence with the exact Caddyfile block to copy, including the line that generates the hashed password.

Notice what the pattern does to your exposure arithmetic. Before: one service, publicly reachable, offering tools to anyone. After: one service publicly reachable that offers nothing but a password prompt, and the tool-bearing service reachable only from its own machine. The probe sees the difference immediately, because it grades the first response — and the first response is now the proxy's 401.

Why Caddy shows up in the recipes

Caddy earns its place in home setups for two practical reasons: it obtains and renews https certificates automatically, removing the expired-certificate finding from your life, and its configuration for this pattern is a handful of lines — an address, an auth block, a reverse-proxy line. nginx does the same job with more ceremony and more examples online. Either is fine; what matters is the shape, not the brand. The local-scan guide names the same pair when it tells you to put auth in front of anything public.

Whichever you run, the proxy is now part of your security surface: keep it updated like you would the server, and keep its own admin interface — Caddy has one, bound to localhost by default — off the public port list. The companion script will show both processes listening, which is how the setup should look: proxy on the public port, server on localhost.

The three ways the pattern silently fails

Failure one: the server still listens publicly somewhere. You bound the new instance to localhost but the old process never restarted, or a second start method (a service file, a Docker publish) still maps the raw port to the world. The companion script's listener list is the audit — every listener on all interfaces needs a name and a reason. Failure two: the forward points at the wrong port. The router rule still delivers visitors to the MCP server's old port, and the proxy guards a port nobody external can reach — test from outside, not from your desk.

Failure three: a variant slips past. The proxy guards the https address while the plain-http form or a second hostname reaches the server directly. HomeShield's auth-consistency check exists for exactly this: it probes the trailing-slash and other-scheme forms of your URL and calls out a variant that answers without the credentials the main address demands. The side-door guide explains that failure in full.

What basic auth does and does not buy you

Basic auth buys a real gate: a long, unique password, demanded before any MCP traffic flows, with the credential travelling inside https. It does not buy per-user accounts, so a household shares one credential — acceptable for most homes, worth knowing. It does not rate-limit a determined guesser by itself, which is another reason the password must be long rather than clever. And it does not shrink what an authorised caller can do: the tool surface behind the proxy is unchanged, which is why tool trimming remains its own task.

It also buys you logs with meaning. The proxy's access log now distinguishes refused strangers (401s) from your own successful sessions — the first place to look when you wonder whether anyone has been knocking, a theme the logs guide develops.

Proving the pattern with the paired recheck

The verification sequence is short and non-negotiable. One: from your own client, with credentials, confirm the server works as before. Two: run the free check on the public URL and confirm the verdict moved from EXPOSED to COVERED, with the auth-consistency lines clean. Three: run the companion on the host and confirm the listener list matches the design — proxy public, server localhost. A logged-in report's paired recheck then records the before-and-after pair, which is the difference between 'we fixed it in November' and being able to show it.

Revisit after any proxy or server update: a configuration reload that fails can leave the proxy serving a default site or, worse, the server restarted with its original bind. Scheduled re-scans on a paid plan watch the verdict so a quiet regression becomes an alert rather than a discovery.

The 5-action reverse-proxy pass

  1. Bind the MCP server to 127.0.0.1 on an internal port and restart it; confirm the old public listener is gone in the companion's list.
  2. Install the proxy on the public port using the Caddy block from your HomeShield fix recipe, with a freshly generated password hash.
  3. Point the forward or tunnel at the proxy's port — not the server's — and confirm https works.
  4. Re-check from outside: verdict COVERED, slash and scheme variants demanding credentials, your own client still working.
  5. Save the paired recheck and re-verify after every proxy or server update.

Worked example: the Alvarez household and the port that stayed open

Example — fictional, for illustration. The Alvarez household adds Caddy in front of their Node MCP server, which tracks their smallholding's equipment maintenance. The proxy goes in cleanly, the password is set, and from a phone browser the address now demands a login. Job done — except their next HomeShield check still grades the server EXPOSED. The report's path sweep finds the MCP service answering on its original port: the server had been started twice, once by a service file with the old all-interfaces bind, once by hand with the new one. Caddy was guarding a door; the original door stood next to it, open.

They stop the duplicate service, disable its autostart, and confirm with the companion: two listeners remain, Caddy on the public port and the MCP server on localhost only. The re-check grades COVERED, with the path sweep finding no second MCP answer. Before: 3 listeners on the host, 2 of them public, 1 offering tools without auth. After: 2 listeners, 1 public (the proxy, demanding credentials), 0 open variants. Their note from the evening: adding a doorman does not help if the old door is still on its hinges — count the listeners, not the intentions.

Related guides and the standing invitation

Companion reading for this topic: How Do You Put Authentication in Front of a Home MCP Server? · What Is the Difference Between Binding to 127.0.0.1 and 0.0.0.0? · Why Does the Plain HTTP Version of Your Server Count as a Side Door? · How Do You Harden a FastMCP Server That Faces the Internet?.

Whatever this guide led you to change, prove it the way every guide in this series ends: re-run the free check on the same address and compare the result with the one you started from, work through the local-scan guide for the inside of the house, and see plans if you want the watching done on a schedule. A change you have not re-measured is a hope, not a fix.

Run the free check · All guides

Sources

Frequently asked questions

Do I need Caddy specifically, or will nginx do?

Either. The pattern is what protects you: proxy on the public port demanding credentials, server bound to localhost behind it. Caddy appears in HomeShield's fix recipes because its https handling is automatic and its config for this pattern is a few lines; an nginx setup with the same shape grades identically — COVERED — because the probe grades the response, not the brand.

Where should the proxy run?

On the same machine as the MCP server, in the usual home setup. The proxy then forwards over localhost, and the server never needs a network-facing bind at all. Running the proxy on a different box works too, but then the server's bind must be limited to that box — a wider target for mistakes.

What password should the proxy demand?

A long, unique one — generated, stored in a password manager, never reused from another service. This single credential guards every tool the server offers. Basic auth sends it with each request inside the https connection, so the https part is not optional decoration.

The proxy is up but the check still says EXPOSED. What is wrong?

Almost always one of three things: the MCP server still listens publicly on another port or in a duplicate process, the router forward still points at the server's port instead of the proxy's, or a variant address bypasses the proxy. The companion's listener list plus the report's auth-consistency and path-sweep sections will show which.

Does the proxy slow my server down noticeably?

For household MCP traffic — requests from your own assistant, not a public workload — the proxy's overhead is not something you will feel. What you will feel is the benefit the first time the report shows a clean COVERED with your own access unchanged.