From 02e2bad97c6c648440b3ac9c2cc3587984907aea Mon Sep 17 00:00:00 2001 From: Nick Hale <4175918+njhale@users.noreply.github.com> Date: Fri, 7 Nov 2025 19:50:55 -0500 Subject: [PATCH 1/2] fix: don't gc component servers when the parent catalog entry is deleted Addresses https://github.com/obot-platform/obot/issues/4961 Signed-off-by: Nick Hale <4175918+njhale@users.noreply.github.com> --- pkg/storage/apis/obot.obot.ai/v1/mcpserver.go | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/pkg/storage/apis/obot.obot.ai/v1/mcpserver.go b/pkg/storage/apis/obot.obot.ai/v1/mcpserver.go index 59119a62f8..f19eefdf27 100644 --- a/pkg/storage/apis/obot.obot.ai/v1/mcpserver.go +++ b/pkg/storage/apis/obot.obot.ai/v1/mcpserver.go @@ -63,13 +63,18 @@ func (in *MCPServer) FieldNames() []string { } func (in *MCPServer) DeleteRefs() []Ref { - return []Ref{ + refs := []Ref{ {ObjType: &Thread{}, Name: in.Spec.ThreadName}, - {ObjType: &MCPServerCatalogEntry{}, Name: in.Spec.MCPServerCatalogEntryName}, {ObjType: &MCPCatalog{}, Name: in.Spec.MCPCatalogID}, {ObjType: &PowerUserWorkspace{}, Name: in.Spec.PowerUserWorkspaceID}, {ObjType: &MCPServer{}, Name: in.Spec.CompositeName}, } + if in.Spec.CompositeName == "" { + // Only garbage collect an MCP server when the catalog entry is deleted if it's not a component of a composite MCP server. + // Component MCP servers get their manifest from the composite catalog entry instead. + refs = append(refs, Ref{ObjType: &MCPServerCatalogEntry{}, Name: in.Spec.MCPServerCatalogEntryName}) + } + return refs } type MCPServerSpec struct { From 3aea2ed1820f5af119b85b774527bc6f0ccd10da Mon Sep 17 00:00:00 2001 From: Nick Hale <4175918+njhale@users.noreply.github.com> Date: Fri, 7 Nov 2025 20:08:33 -0500 Subject: [PATCH 2/2] fix: validate composite catalog entry before committing upgrade Addresses https://github.com/obot-platform/obot/issues/4960 Signed-off-by: Nick Hale <4175918+njhale@users.noreply.github.com> --- pkg/api/handlers/mcpcatalogs.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/pkg/api/handlers/mcpcatalogs.go b/pkg/api/handlers/mcpcatalogs.go index c2f8f50c1d..958012ac88 100644 --- a/pkg/api/handlers/mcpcatalogs.go +++ b/pkg/api/handlers/mcpcatalogs.go @@ -1251,6 +1251,11 @@ func (h *MCPCatalogHandler) RefreshCompositeComponents(req api.Context) error { } } + // Validate the refreshed manifest to ensure it's still valid + if err := validation.ValidateCatalogEntryManifest(entry.Spec.Manifest); err != nil { + return types.NewErrBadRequest("failed to validate entry manifest: %v", err) + } + // Update the entry if err := req.Update(&entry); err != nil { return fmt.Errorf("failed to update entry: %w", err)