[Prompt] I built Canopy, a self-hosted MCP gateway and skills catalogue that runs at home. I'm considering the inverse: the main AI gateway on a cloud VPS, which I think is more reliable, and a small local gateway at home that exposes LAN tools like Home Assistant and keeps one persistent connection up to the cloud one, with an anti-hairpin rule so a client at home goes straight to the local gateway for local tools. What does that persistent link between the remote and local gateways look like, with real examples of the pattern? What's the best way to peer a cloud host with a self-hosted one for this: is there something purpose-built, or is Tailscale the best choice for keeping latency down? And how big is the trade-off? If I'm out in my own city and the hub is in Frankfurt, I go to Frankfurt instead of to my house a few miles away. That feels slower, but one end is a professionally run data centre and the other is a house, so how does it actually work out?
[Response] Corn: Two hundred and eighty-two milliseconds. That's the worst ping in the example runs on Tailscale's own documentation, a connection that never found a direct path and got shoved through a relay. Further down the same page, a relay you run yourself comes in at three to five.
Herman: Same software, same two machines, a swing of about fifty to one, and the only variable is whether they can find each other. Daniel's question lives inside that swing.
Corn: He built Canopy, the self-hosted MCP gateway with the skills catalogue and progressive discovery, and it runs at home. Now he's weighing the inverse. Put the main gateway on a VPS, because a data centre stays up and a house has a router that occasionally needs a talking-to. Then a small gateway at home exposing Home Assistant and the other LAN tools, holding one persistent connection up to the big one. At home, clients skip the cloud and talk to the local gateway directly. Out in his own city, a call to a lamp a few miles away goes to Frankfurt and back. What does that link look like, who already does it, and how much does the detour cost him?
Herman: Everyone has built the edge half, which surprised me. Home Assistant's own cloud, Nabu Casa, has your instance hold an outbound connection open to their server. When you visit your remote URL, they push the browser's requests back down it. No port forwarding, and the URL works only while the instance is connected.
Corn: Home calls out, nobody calls in. Which is the only arrangement that survives a consumer router whose address changes when it feels like it.
Herman: Pangolin's agent, Newt, does the same dial-out. It opens a WebSocket to Pangolin for its configuration, then runs WireGuard in user space, and it reconnects by itself after an outage. Cloudflare Tunnel opens four outbound connections to at least two of their data centres, so one dying doesn't take you down, and you can run up to twenty-five copies of the connector for the same tunnel.
Corn: Twenty-five copies of a connector for a house with one cable. Daniel's ambitions are, I think, smaller.
Herman: The transport choice is the interesting bit for him, though. The connector can use QUIC, which is UDP, or fall back to HTTP two over TCP, and it picks automatically. That matters because some networks quietly eat UDP. Anthropic's tunnel docs make the same point in firewall terms: outbound on the tunnel port, both TCP and UDP, and nothing inbound.
Corn: So the whole house-side firewall policy is one outbound rule. My kind of security model, since I'd have to get up to change it.
Herman: Fair. But it's now arriving for MCP specifically. Anthropic's MCP tunnels, a research preview with no uptime promise, run cloudflared and a proxy inside your network, outbound only. The inner encryption ends at your proxy, so Cloudflare sees metadata and not content. Cloudflare's own MCP portals can now reach servers that exist only on a private network, through a tunnel or their mesh.
Corn: That's Canopy's own plan seen from the vendor side. The docs already describe Cloud Canopy, a local proxy that dials out from home and registers on the hub as one upstream. The anti-hairpin part, where the connector adds a second connection straight to the proxy when it can see it on the LAN, isn't built yet.
Herman: The idea is sound, though. A client on the LAN sees the proxy, opens a second connection to it, and calls to the lamp never leave the building.
Corn: So for now it's a rule that lives in a document.
Herman: Written down is the cheapest stage of any feature, Corn. What I couldn't find is the specific shape he wants. Nobody ships "my edge MCP gateway registers with my hub as an upstream" as a product. IBM's ContextForge had a design where gateways found each other over mDNS. That design was marked deprecated in January, and now you register peers by hand through the API.
Corn: A data centre discovering a house over multicast. Multicast doesn't leave the building, so that was always going to be a short ADR.
Herman: The other open-source gateways take a remote server by URL, with a bearer token or custom headers, so an edge gateway is registerable in principle. I haven't seen anyone document one gateway chained behind another, and I won't pretend I have. TrueFoundry describes a federated design on paper where each server names the gateway plane that can reach it, requests hop between gateways, access is checked at both ends, and a dead remote gateway shows up as unreachable.
Corn: Daniel's been near this already. The cheap-VPS-as-middleman setup with Pangolin is this, except the middleman gets promoted to boss. And his earlier arrangement had a remote-site gateway sitting as a single upstream on the primary.
Herman: So he's run the shape, just with the primary at home. The inversion changes who owns the public address, and that decides everything about the peering. Let me ask you something. You've got a VPS with a fixed public IP and a box behind a home router. What do you reach for to join them?
Corn: Plain WireGuard, and I'd be unbearable about it. Two config files, one UDP port open on the VPS, done before the kettle boils.
Herman: You'd be right, and the reason is the part people skip. Tailscale's own writing on NAT traversal says the hard case is both ends behind difficult NAT, and that nearly always needs a relay. Here only the home end is behind NAT and the VPS has an address anyone can reach. My inference from their table, not a sentence anyone wrote, is that this is the easy case. Home sends outward, a hole opens in the router, traffic flows direct.
Corn: Then Tailscale isn't buying him speed.
Herman: It buys management. Access rules, name resolution, key rotation you never think about, a phone that joins in two taps. For the link itself, WireGuard with a keepalive every twenty-five seconds or so from the home side holds the hole open. Tailscale is the nicer cockpit, and it won't make the plane faster.
Corn: If he does go Tailscale, what's the worst that happens to the link?
Herman: Every Tailscale connection starts out through their relay servers, called DERP, and upgrades to a direct path once the two sides punch through. Tailscale says direct succeeds well north of ninety percent of the time in typical conditions, which is their own internal metric. When it doesn't, you're on DERP, which their docs call generally slower and a common source of performance complaints. There's also a newer option, peer relays, where a machine you run with one open UDP port carries the traffic, and it usually beats DERP at the cost of one extra hop. A VPS is the obvious candidate.
Corn: So the VPS he's renting anyway could be both the hub and the safety net.
Herman: Yes. If he used Headscale, the self-hosted control server, it has no relay of its own and borrows Tailscale's DERP unless he configures one. NetBird has its own relay. The comparison pages are mostly promotional, and only one academic paper actually benchmarks them, so I'd pick on features.
Corn: People say WireGuard costs nothing in latency, though.
Herman: It's closer to a millisecond or two. One five-G testbed measured about two point two milliseconds added on a baseline near eight. IPsec added about ten and a half in the same test. That's a testbed, not a house to a VPS, so treat it as the shape. The framing overhead is about sixty bytes on IP version four, and that bites on packet size, not on time. If large responses stall while small ones work, that's the tunnel's MTU, and it is the classic first bug.
Corn: A tunnel that's fine until something big goes through it. Very on brand for a home network.
Herman: Compare the Cloudflare route. You skip opening any port on the VPS, and you get their edge in front, but the traffic now crosses a Cloudflare data centre on both legs. I couldn't find a published per-request cost for that hop. It's probably small, and I'd still want to measure it before I trusted it. Pangolin's agent gets a mention here too. People report lower throughput from its user-space WireGuard than from the kernel version, though those are user reports and not benchmarks.
Corn: Throughput on a gateway that carries small JSON messages. I'd lose sleep over other things.
Herman: Nobody is streaming video through a lamp tool, so fair. Where does the overlay start to matter, then? I'd say the phone.
Corn: I'd still want Tailscale on my phone, yes. But the phone doesn't need it to reach the hub, does it? It does ordinary HTTPS to a public address.
Herman: That's the point. A phone out in the city sits behind carrier-grade NAT, which is the restrictive kind, and two phones on different carriers often land on a relay. So if the anti-hairpin plan were "the phone reaches the house directly over the tailnet", my guess is it ends up on a relay a fair amount of the time. I haven't seen that measured for one city, so call it reasoning. The hub route sidesteps the whole question.
Corn: Before we get into latency, Hilbert has his segment.
Hilbert: Hilbert's Anteater Trivia. A giant anteater can flick its tongue up to about one hundred sixty times a minute. I have timed myself against that figure and I am not going to share the result.
Herman: Nobody was going to ask.
Corn: So, latency. Pick a European city thirteen milliseconds from Frankfurt, London say. At home, anti-hairpin sends the client down the LAN and the penalty is a millisecond or two. Out on the street, the call goes phone to Frankfurt, Frankfurt down the tunnel to the house, and the answer retraces it. Two trips to Frankfurt, and one of them ends in a house.
Herman: And you pay the house's last mile on top of that. Fibre idles somewhere around three to twelve milliseconds, cable and DSL more, though that table comes from a vendor and I'd call it rough. My arithmetic puts the detour at thirty to forty milliseconds over going straight to the house. Say thirty-five.
Corn: Thirty-five milliseconds. I've lost more than that deciding whether to answer.
Herman: The phone's own last mile is identical either way. In the UK regulator's figures, a five G response runs fifteen to twenty-one milliseconds and four G eighteen to twenty-three, with older three G around forty, so that part is a wash. And all of it sits next to a model that takes seconds to think. Even if an agent chains twenty local tool calls one after another, you've added about three quarters of a second to a job that already took a minute.
Corn: So the house being a few miles away buys him nothing he'd notice.
Herman: Nothing he'd feel on a lamp. And it's worth knowing how the distance scales. From Frankfurt, Amsterdam is about six milliseconds, Paris about eight, London thirteen or fourteen, Marseille sixteen or so, and Moscow roughly thirty-six. Those are single third-party measurements between cities, so the real numbers add last miles. The tax grows with how far you are from the hub, and he picks the hub's location. Put it in the nearest big exchange point and the numbers shrink.
Corn: What would you do, Herman, if the lamp took a hundred milliseconds? Would you move the hub?
Herman: I'd stop counting before then. It's all sequential, so only a long chain of calls would make me care, and for those I'd rather batch the calls at the edge than shave the hub's distance. But I'm asking you the harder question. Which end is going to break first, the data centre or the house?
Corn: The house. Obviously the house.
Herman: In the old design, when it did, everything went with it, the whole catalogue and every remote tool. In the new one, when the house link drops, the lamp stops answering and the hub, the login flow and the cloud tools keep going. The latency tax buys that, and I'd pay it.
Corn: Though the data centre is the one he can't walk over to and kick.
Herman: And I'll admit the word professional is doing some work in the pitch. The building is professionally run. The one rented virtual machine inside it is as reliable as its provider's reboot schedule, and a hub with a single process on it has its own bad nights. The gain is real, but it's mostly the power, the cooling and the uplink, and it stops at the edge of that one machine.
Corn: So he swaps a router he understands for a hypervisor he doesn't.
Herman: With a better uplink and a provider that emails him when something's wrong. Most of the time I'd take that. The Cloudflare connector's copies are the pattern worth stealing, though, which is two ways in for anything that matters. A second small edge in the house is a cheap hedge, and so is a second path from the VPS.
Corn: A spare for the lamp tool. I'd say the lamp tool can be dark for an afternoon.
Herman: Depends whether it's the lamp or the front door lock.
Corn: Fine. The lock gets two.
Herman: There's a worse enemy than distance, and it lives in the house. A saturated upload looks like downtime. The FCC's broadband measurements found DSL upstream latency under load averaging six hundred and fifty-six milliseconds. A backup running overnight, a tool call crossing the same pipe, and from the hub's side the house has simply gone.
Corn: A working connection that behaves like a dead one. Worse than dead, since you can't even blame anybody.
Herman: Smart queue management on the router fixes most of it, and a faster uplink doesn't particularly. That belongs on the shopping list before any tunnel software does.
Corn: Let me go at the protocol side, because Daniel said persistent connection and I'd pictured some long-lived MCP session held open for ever.
Herman: That used to be true. The July revision of the spec removed protocol-level sessions and the GET stream. Every JSON-RPC message is its own POST now, so the persistent part is mostly HTTP keep-alive and the tunnel underneath. The edge drops, comes back, the hub sends the next POST, and there's no session to rebuild. Under the older spec, session reuse mattered a lot. One benchmark, a local cluster so relative only, got about three hundred requests a second reusing sessions and about thirty-five opening a new one each time.
Corn: Stateless reconnect, then. That's the good news. What's the bad news?
Herman: List changes. When a tool appears or disappears, the notification rides one long-lived streaming connection, and that dies with the link. On reconnect the hub shouldn't assume it heard everything, so it re-lists. ContextForge polls the tool list on every upstream anyway, because its refresh connections are short-lived.
Corn: Which suggests the polite design is polling and treating the stream as a bonus.
Herman: One more thing in that spec helps. It adds two headers carrying the method and the tool name, copied from the body, so a hub can route without parsing the JSON. For a hub deciding "this tool name lives behind the edge", that's useful.
Corn: Daniel's anti-hairpin rule also means the home client carries two connections, one to each gateway. Is that where the complexity creeps in?
Herman: It's one of the places. The client has to know it's home, and two answers to the same tool name can't disagree. The spec change helps there too, because there's no session pinning a client to one gateway. Each request is its own POST, so a client can send lamp calls to the local gateway and everything else to the hub with nothing to unwind.
Corn: So the tax at home is zero because the hub isn't in the path at all, apart from the millisecond or two.
Herman: Right, and I'd say that clean split is the stronger argument for the design than latency is.
Corn: Now the question I care about. The link drops. Does the hub keep advertising the lamp tool or throw it away?
Herman: I don't know what Canopy does today, but I'd keep it, and I'd like your view. What would you do?
Corn: Keep it, flagged as unavailable. If the lamp tool vanishes, the model decides there are no lamps and cheerfully says so. If it's there with an error that says home is offline, the model can tell the user something true.
Herman: One gateway vendor fixed a bug where a single failing upstream wiped the merged tool map for everyone. That's the throw-it-away policy turning up by accident. And for progressive discovery it falls out neatly. The hub keeps its own cached catalogue of the edge's tools, so search never crosses the link and only the actual call does.
Corn: So with the house offline, searching for a lamp still works. It's the lamp that doesn't.
Herman: And the health model stays simple. The tunnel being up tells the hub the edge is alive. Tunnel up, edge up, tunnel down, mark the lot unavailable.
Hilbert: You're right about that. Dunstan Orrey next door never accepted it. He ran the club's message board off a spare-room machine with a modem the size of a breadbox, and I'd ring it from the hall. Engaged tone, and he'd say the line was fine. Nineteen eighty-six, and he told the whole close again last month on his step.
Herman: A busy signal, so the line is demonstrably working.
Hilbert: It was always working. The machine had hung. Herman, you gave the keepalive to the second and I like that in a man, but it only tells you about the cable. Dunstan could dial the board in nine seconds on his rotary phone. He still has the date written down.
Corn: Nine seconds to reach a machine that isn't listening.
Hilbert: Eleven pence a minute off-peak to find that out, too. What fixed it was walking across and pulling the plug out for ten seconds. Four minutes there and back.
Herman: Then the hub shouldn't watch the tunnel at all. It should make a cheap real call on the edge, a tiny status tool, say, and let the answer decide whether the lamp is marked unavailable. The tunnel tells you about the cable. The call tells you the gateway answered.
Hilbert: That works. Better than the plug.
Corn: Something that fell out of the research and didn't fit. Even for a fully private MCP server behind Cloudflare, the OAuth authorization and token endpoints still have to be publicly reachable. The tunnel hides the tools and leaves the front door where it was.
Herman: Which is one more reason the hub's login belongs in a data centre rather than behind a house.
Corn: What stays with me is the status call. The first time the house goes quiet, the hub should ask the gateway a question and not the cable.
Herman: Thank you to our producer, Hilbert Flumingtop, for keeping the desk running.
Corn: This has been My Weird Prompts. You can find every episode at my weird prompts dot com.
Herman: See you tomorrow.