From 8cf31a28b5ca5e528c2e1e263b65bcae2687a854 Mon Sep 17 00:00:00 2001 From: Achmad Date: Sun, 17 May 2026 05:26:33 +0000 Subject: [PATCH] Fix transport_security blocking non-localhost bindings When binding to a non-localhost host, FastMCP's auto-set restrictive transport_security causes external connections to be rejected with 421. Reset it to None so hosts like host.docker.internal are accepted. --- server.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/server.py b/server.py index 26772d4..49ff2bb 100644 --- a/server.py +++ b/server.py @@ -532,6 +532,11 @@ if __name__ == "__main__": args = parser.parse_args() if args.host: mcp.settings.host = args.host + if args.host not in ("127.0.0.1", "localhost", "::1"): + # FastMCP auto-sets restrictive transport_security for localhost at init time. + # Reset it when binding to a non-localhost address so external hosts + # (e.g. host.docker.internal) are not rejected with 421. + mcp.settings.transport_security = None if args.port: mcp.settings.port = args.port mcp.run(transport=args.transport)