Skip to content

Commit a799d7b

Browse files
authored
Add default port fallback to GetMcpPort() for HTTP-based transports (#2555)
return default mcp port when mcpport and target port are not set
1 parent 18fa987 commit a799d7b

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

cmd/thv-operator/api/v1alpha1/mcpserver_types.go

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -763,7 +763,13 @@ func (m *MCPServer) GetMcpPort() int32 {
763763

764764
// the below is deprecated and will be removed in a future version
765765
// we need to keep it here to avoid breaking changes
766-
return m.Spec.TargetPort
766+
if m.Spec.TargetPort > 0 {
767+
return m.Spec.TargetPort
768+
}
769+
770+
// Default to 8080 if no port is specified (matches GetProxyPort behavior)
771+
// This is needed for HTTP-based transports (SSE, streamable-http) which require a target port
772+
return 8080
767773
}
768774

769775
func init() {

0 commit comments

Comments
 (0)