Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions deploy/deploy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,16 @@ cmd_apply() {
if [[ -n "$EFFECTIVE_IMAGE" ]]; then
mv "$KUSTOMIZE_DIR/kustomization.yaml.bak" "$KUSTOMIZE_DIR/kustomization.yaml"
fi

# Inject route hostname into ALLOWED_HTTP_HOSTS for DNS rebinding protection
if [[ "$OVERLAY" == "openshift" ]]; then
local ROUTE_HOST
ROUTE_HOST=$($KUBECTL -n "$NAMESPACE" get route gps-mcp-server -o jsonpath='{.spec.host}' 2>/dev/null || true)
if [[ -n "$ROUTE_HOST" ]]; then
echo "=== Setting ALLOWED_HTTP_HOSTS=$ROUTE_HOST ==="
$KUBECTL -n "$NAMESPACE" set env deployment/gps-mcp-server "ALLOWED_HTTP_HOSTS=$ROUTE_HOST"
fi
fi
echo ""
echo "=== Waiting for rollout ==="
$KUBECTL -n "$NAMESPACE" rollout status deployment/gps-mcp-server --timeout=120s
Expand Down
6 changes: 6 additions & 0 deletions mcp_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@

import argparse
import json
import os
import re
import sqlite3
from datetime import date, datetime
Expand Down Expand Up @@ -667,6 +668,11 @@ def get_gps_version() -> str:
"host.docker.internal:*",
]

# Extra hosts from env (comma-separated), e.g. OpenShift route hostnames
_extra = os.environ.get("ALLOWED_HTTP_HOSTS", "")
if _extra:
ALLOWED_HTTP_HOSTS.extend(h.strip() for h in _extra.split(",") if h.strip())


def _configure_http(port: int = 8000) -> None:
"""Configure MCP server for HTTP transport with DNS rebinding protection."""
Expand Down