fix(qr-server): pass host/port to FastMCP for Docker compatibility (#372)
When FastMCP is created with the default host=127.0.0.1, MCP SDK 1.26+ automatically enables DNS rebinding protection that only allows requests from localhost. This breaks Docker where requests come from host.docker.internal, causing 421 Invalid Host header errors. By passing host=HOST (0.0.0.0 for Docker), DNS rebinding protection is not auto-enabled, allowing requests from any host.
This commit is contained in:
parent
77b8daa1e8
commit
0b83679909
1 changed files with 1 additions and 1 deletions
|
|
@ -26,7 +26,7 @@ VIEW_URI = "ui://qr-server/view.html"
|
|||
HOST = os.environ.get("HOST", "0.0.0.0") # 0.0.0.0 for Docker compatibility
|
||||
PORT = int(os.environ.get("PORT", "3001"))
|
||||
|
||||
mcp = FastMCP("QR Code Server", stateless_http=True)
|
||||
mcp = FastMCP("QR Code Server", stateless_http=True, host=HOST, port=PORT)
|
||||
|
||||
# Embedded View HTML for self-contained usage (uv run <url> or unbundled)
|
||||
EMBEDDED_VIEW_HTML = """<!DOCTYPE html>
|
||||
|
|
|
|||
Loading…
Reference in a new issue