This example demonstrates exposing an MCP server through a gateway using the built-in httproute provider, which creates a Gateway API HTTPRoute.
- Kubernetes cluster
- Gateway API CRDs installed before the operator starts (the operator checks for HTTPRoute at startup and skips the controller if the CRD is absent)
- MCP Lifecycle Operator installed (install or restart after the Gateway API CRDs are in place)
- A Gateway resource deployed and managed by a gateway controller (e.g., Envoy Gateway, Istio, Cilium)
- Create the gateway configuration ConfigMap:
kubectl apply -f gateway-config.yaml- Deploy the MCPServer with gateway integration:
kubectl apply -f mcpserver-with-gateway.yaml# Check the MCPGatewayBinding is registered
kubectl get mcpgatewaybindings -n default
# Check the HTTPRoute was created
kubectl get httproutes -n default
# Verify the MCPServer address reflects the gateway URL
kubectl get mcpserver kubernetes-mcp-server -n default -o jsonpath='{.status.address.url}'Edit gateway-config.yaml to match your environment:
| Key | Description |
|---|---|
gateway-name |
Name of your Gateway resource |
gateway-namespace |
Namespace where the Gateway lives |
route-hostname |
Hostname to set on the HTTPRoute (optional) |
public-hostname |
Public hostname for the status URL (optional) |
kubectl delete -f mcpserver-with-gateway.yaml
kubectl delete -f gateway-config.yaml