949 B
949 B
1. Configuration
- 1.1 Add
KB_MCP_ALLOWED_HOSTStomcp/config.py— read from env, default empty string - 1.2 Add host-parsing helper that splits the comma-separated value, strips whitespace, and filters empty entries
2. Transport security
- 2.1 Build
TransportSecuritySettingsinmcp/server.py— merge localhost defaults with parsedKB_MCP_ALLOWED_HOSTS, derive allowed origins from allowed hosts - 2.2 Pass
transport_security=to theFastMCP()constructor
3. Compose files
- 3.1 Add
KB_MCP_ALLOWED_HOSTS=${KB_MCP_ALLOWED_HOSTS:-}to the kb-mcp environment block incompose.cpu.yaml,compose.nvidia.yaml, andcompose.rocm.yamlwith a comment explaining the format
4. Verification
- 4.1 Test: unset
KB_MCP_ALLOWED_HOSTS— confirm localhost connects, remote host gets 421 - 4.2 Test: set
KB_MCP_ALLOWED_HOSTSto the server IP — confirm remote host connects successfully