File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 44import uvicorn
55from contextlib import contextmanager
66from mcp .server .fastmcp import FastMCP
7- from starlette . middleware . trustedhost import TrustedHostMiddleware
7+ from mcp . server . transport_security import TransportSecuritySettings
88
9- # Initialize MCP Server
10- mcp = FastMCP ("DuckDB-S3-Geo-Isolated" )
9+ # Initialize MCP Server with disabled DNS rebinding protection
10+ # (we're behind a k8s ingress with its own security)
11+ mcp = FastMCP (
12+ "DuckDB-S3-Geo-Isolated" ,
13+ transport_security = TransportSecuritySettings (
14+ enable_dns_rebinding_protection = False
15+ )
16+ )
1117
1218# -------------------------------------------------------------------------
1319# 1. LOAD CONFIG (Read-Only Global State)
@@ -99,10 +105,6 @@ def query(sql_query: str) -> str:
99105 # It supports both GET (handshake) and POST (messages) on the same URL.
100106 app = mcp .streamable_http_app ()
101107
102- # Disable host header validation for k8s ingress
103- # The app has built-in host validation that needs to be disabled
104- app .allowed_hosts = ["*" ]
105-
106108 uvicorn .run (
107109 app ,
108110 host = "0.0.0.0" ,
You can’t perform that action at this time.
0 commit comments