diff --git a/pkg/ingress/kube/annotations/mcpserver.go b/pkg/ingress/kube/annotations/mcpserver.go index 7812780c5..cd0ab5270 100644 --- a/pkg/ingress/kube/annotations/mcpserver.go +++ b/pkg/ingress/kube/annotations/mcpserver.go @@ -53,7 +53,8 @@ func (a mcpServer) Parse(annotations Annotations, config *Ingress, globalContext var matchRuleDomains []string rawMatchRuleDomains, _ := annotations.ParseStringASAP(mcpServerMatchRuleDomains) if rawMatchRuleDomains == "" || rawMatchRuleDomains == "*" { - // Match all domains. Leave an empty slice. + // Use wildcard to match all domains so we don't rely on the default behavior of empty domain list + matchRuleDomains = []string{"*"} } else if strings.Contains(rawMatchRuleDomains, ",") { matchRuleDomains = strings.Split(rawMatchRuleDomains, ",") } else { diff --git a/pkg/ingress/kube/annotations/mcpserver_test.go b/pkg/ingress/kube/annotations/mcpserver_test.go index b9a8b669b..1e7d6cf38 100644 --- a/pkg/ingress/kube/annotations/mcpserver_test.go +++ b/pkg/ingress/kube/annotations/mcpserver_test.go @@ -132,7 +132,7 @@ func TestMCPServer_Parse(t *testing.T) { }, expect: &mcpserver.McpServer{ Name: "default/route", - Domains: nil, + Domains: []string{"*"}, PathMatchType: "prefix", PathMatchValue: "/mcp", UpstreamType: "rest", @@ -153,7 +153,7 @@ func TestMCPServer_Parse(t *testing.T) { }, expect: &mcpserver.McpServer{ Name: "default/route", - Domains: nil, + Domains: []string{"*"}, PathMatchType: "prefix", PathMatchValue: "/mcp", UpstreamType: "rest",