File tree Expand file tree Collapse file tree 1 file changed +6
-1
lines changed
Expand file tree Collapse file tree 1 file changed +6
-1
lines changed Original file line number Diff line number Diff line change 1919import qrcode
2020import uvicorn
2121from mcp .server .fastmcp import FastMCP
22+ from mcp .server .transport_security import TransportSecuritySettings
2223from mcp import types
2324from starlette .middleware .cors import CORSMiddleware
2425
@@ -161,7 +162,11 @@ def view() -> str:
161162 mcp .run (transport = "stdio" )
162163 else :
163164 # HTTP mode for basic-host (default) - with CORS
164- app = mcp .streamable_http_app (stateless_http = True )
165+ # Allow Docker bridge IP for container-to-host communication
166+ security = TransportSecuritySettings (
167+ allowed_hosts = ["127.0.0.1:*" , "localhost:*" , "[::1]:*" , "172.17.0.1:*" ]
168+ )
169+ app = mcp .streamable_http_app (stateless_http = True , transport_security = security )
165170 app .add_middleware (
166171 CORSMiddleware ,
167172 allow_origins = ["*" ],
You can’t perform that action at this time.
0 commit comments