Skip to content
Open
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
8 changes: 7 additions & 1 deletion api/v1alpha1/mcpserver_types.go
Original file line number Diff line number Diff line change
Expand Up @@ -196,9 +196,14 @@ type HTTPTransportTLS struct {

// MCPServerStatus defines the observed state of MCPServer.
type MCPServerStatus struct {
// DisplayStatus shows a human-readable status of the MCPServer.
// Possible values: "Not Ready", "Ready", "Deleting"
// +optional
DisplayStatus string `json:"displayStatus,omitempty"`

// Conditions describe the current conditions of the MCPServer.
// Implementations should prefer to express MCPServer conditions
// using the `MCPServerConditionType` and `MCPServerConditionReason`
// using the MCPServerConditionType and MCPServerConditionReason
// constants so that operators and tools can converge on a common
// vocabulary to describe MCPServer state.
//
Expand Down Expand Up @@ -398,6 +403,7 @@ type ServiceAccountConfig struct {
// +kubebuilder:object:root=true
// +kubebuilder:subresource:status
// +kubebuilder:resource:shortName=mcps;mcp
// +kubebuilder:printcolumn:name="Status",type="string",JSONPath=".status.displayStatus"
// +kubebuilder:printcolumn:name="Ready",type="string",JSONPath=".status.conditions[?(@.type=='Ready')].status"
// +kubebuilder:printcolumn:name="Age",type="date",JSONPath=".metadata.creationTimestamp"
// +kubebuilder:resource:categories=kagent
Expand Down
19 changes: 19 additions & 0 deletions pkg/controller/mcpserver_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,25 @@ func (r *MCPServerReconciler) reconcileStatus(
}
}

// Set human-readable DisplayStatus based on deletion timestamp and Ready condition
if !server.DeletionTimestamp.IsZero() {
server.Status.DisplayStatus = "Deleting"
} else {
readyCondition := false
for _, condition := range server.Status.Conditions {
if condition.Type == string(kagentdevv1alpha1.MCPServerConditionReady) &&
condition.Status == metav1.ConditionTrue {
readyCondition = true
break
}
}
if readyCondition {
server.Status.DisplayStatus = "Ready"
} else {
server.Status.DisplayStatus = "Not Ready"
}
}

// Update the status
if err := r.Status().Update(ctx, server); err != nil {
log.FromContext(ctx).Error(err, "Failed to update MCPServer status")
Expand Down