fix: allow all hosts

This commit is contained in:
2026-07-08 19:51:16 +03:00
parent 536309fa1a
commit 4698107d6a
+21 -1
View File
@@ -19,6 +19,7 @@ from __future__ import annotations
import argparse
import logging
import os
from collections.abc import AsyncIterator
from contextlib import asynccontextmanager
from dataclasses import dataclass
@@ -26,6 +27,7 @@ from dataclasses import dataclass
from mcp.server.auth.provider import TokenVerifier
from mcp.server.auth.settings import AuthSettings
from mcp.server.fastmcp import FastMCP
from mcp.server.transport_security import TransportSecuritySettings
from owa_mcp.owa_client import OWAClient
from owa_mcp.server_lifecycle import (
@@ -74,7 +76,21 @@ _lifespan_cookie_file: str | None = None
# ── Module-level MCP server (imported by all tool modules) ────────────────
mcp: FastMCP = FastMCP("owa", lifespan=app_lifespan)
mcp: FastMCP = FastMCP(
"owa",
lifespan=app_lifespan,
transport_security=TransportSecuritySettings(
enable_dns_rebinding_protection=False,
allowed_hosts=[],
allowed_origins=[],
),
)
# Force-disable DNS rebinding protection even if FastMCP auto-config
# overwrites it (e.g. when --host is a non-localhost address).
mcp.settings.transport_security = TransportSecuritySettings(
enable_dns_rebinding_protection=False,
)
def _parse_args(argv=None) -> argparse.Namespace:
@@ -207,6 +223,10 @@ def main(argv=None) -> None:
mcp.settings.port = args.port
# ── Run transport ─────────────────────────────────────────────────────
# Allow all X-Forwarded-* headers (needed when behind a proxy or
# when clients connect with a non-default Host header).
os.environ["FORWARDED_ALLOW_IPS"] = "*"
match args.transport:
case "stdio":
mcp.run()