Cleanup

This page documents the manual cleanup procedure. During the workshop, AgentSherpa handles cleanup in Stage 9d. Use this reference if you need to clean up manually.

Cleanup order

Resources must be removed in reverse dependency order:

# 1. Remove MCP server from OpenCode (via UI or config)

# 2. Delete the MCPServerRegistration (deregisters from gateway)
oc delete mcpserverregistration ${USER_PREFIX}-stock-mcp

# 3. Delete the HTTPRoute (removes gateway path)
oc delete httproute ${USER_PREFIX}-stock-mcp

# 4. Delete the MCPServer CR
#    The MCP Lifecycle Operator garbage-collects:
#    Deployment, Service, NetworkPolicy
oc delete mcpserver ${USER_PREFIX}-stock-mcp

# 5. Delete the BuildConfig and ImageStream
oc delete bc/${USER_PREFIX}-stock-mcp
oc delete is/${USER_PREFIX}-stock-mcp

Why this order matters

  • The MCPServerRegistration references the HTTPRoute — remove the registration first so the gateway stops routing to your server

  • The HTTPRoute references the MCPServer’s Service — remove it after the registration

  • The MCPServer owns the Deployment, Service, and NetworkPolicy — when the CR is deleted, the operator garbage-collects them automatically

  • The BuildConfig and ImageStream are independent — safe to remove last

Verify cleanup

oc get mcpserver,mcpserverregistration,httproute,bc,is \
  -l app.kubernetes.io/name=${USER_PREFIX}-stock-mcp

Expected: no resources found.

Playground cleanup (participants)

If you created a Playground instance during the workshop, delete it:

  1. Open the OpenShift AI dashboard

  2. Navigate to Gen AI Studio → Playground

  3. Click the three-dot menu next to your playground instance

  4. Select Delete

This removes the Playground instance from your project but does not affect other participants.

Full namespace cleanup (facilitators)

Facilitators can delete all user namespaces after the workshop:

for i in $(seq 1 30); do
  oc delete namespace user${i}-devspaces --ignore-not-found
done

Or uninstall the Helm release:

helm uninstall mcp-workshop -n mcp-system

This removes all workshop-created namespaces and resources.

AI Playground ConfigMap (facilitators)

The gen-ai-aa-mcp-servers ConfigMap in redhat-ods-applications is shared across all participants and managed by the facilitator. Individual participants do not need to clean it up.

To remove it after the workshop:

oc delete configmap gen-ai-aa-mcp-servers -n redhat-ods-applications --ignore-not-found
Deleting this ConfigMap removes all MCP servers from the Playground MCP tab. If other teams are using the Playground, coordinate before deleting.