As a platform engineer using VirtualMCPServer in static mode,
I want VirtualMCPServer to discover MCPServerEntry resources via groupRef and include them as backends in the generated ConfigMap,
so that vMCP can route traffic to remote MCP servers declared as MCPServerEntry without proxy pods.
Size: L
Dependencies: MCPServerEntry CRD types must exist (Phase 1 story)
Labels: operator, kubernetes
RFC: RFC-0055
Context
Once the MCPServerEntry CRD exists (Phase 1), the VirtualMCPServer controller needs to discover these resources and include them as backends. In static mode, vMCP reads its backend configuration from a ConfigMap generated by the operator. This story extends that ConfigMap generation to include entry-type backends.
Key architectural decisions:
- MCPServerEntry backends are a new backend type (
entry) distinct from MCPServer (container) and MCPRemoteProxy (proxy)
- CA bundle ConfigMaps must be mounted as volumes into the vMCP pod for TLS verification
- The workload discoverer (
pkg/vmcp/workloads/) needs a new WorkloadTypeMCPServerEntry constant
Scope
VirtualMCPServer Controller Discovery
- Update
ensureAllResources() in cmd/thv-operator/controllers/virtualmcpserver_controller.go to discover MCPServerEntry resources via groupRef
- Extend
pkg/vmcp/workloads/k8s.go:
- Add
WorkloadTypeMCPServerEntry constant
- Update
ListWorkloadsInGroup() to include MCPServerEntry resources
- Add
getMCPServerEntryAsBackend() conversion (similar to getMCPRemoteProxyAsBackend())
- VirtualMCPServer watches MCPServerEntry (add mapper like
findVirtualMCPServerForMCPServer)
ConfigMap Generation
- Update
cmd/thv-operator/controllers/virtualmcpserver_vmcpconfig.go:
discoverBackendsWithMetadata() includes MCPServerEntry backends
convertBackendsToStaticBackends() handles entry-type backends
- Static config includes
remoteURL, transport, and auth config from MCPServerEntry spec
- New backend type marker in static config so vMCP parser can distinguish entry backends
CA Bundle Volume Mounting
- When MCPServerEntry has
caBundleRef, mount the referenced ConfigMap as a volume in the vMCP Deployment
- Mount path:
/etc/toolhive/ca-bundles//ca.crt
- Include mount path in static config so vMCP knows where to find the CA for each entry backend
- Update
ensureDeployment() to add volume and volumeMount entries
RBAC Updates
- VirtualMCPServer's generated ServiceAccount Role needs
get, list, watch on mcpserverentries
- Update
ensureRBACResources() in the controller
Status Updates
VirtualMCPServerStatus.DiscoveredBackends includes MCPServerEntry backends
BackendCount reflects entry backends
Acceptance Criteria
As a platform engineer using VirtualMCPServer in static mode,
I want VirtualMCPServer to discover MCPServerEntry resources via groupRef and include them as backends in the generated ConfigMap,
so that vMCP can route traffic to remote MCP servers declared as MCPServerEntry without proxy pods.
Size: L
Dependencies: MCPServerEntry CRD types must exist (Phase 1 story)
Labels:
operator,kubernetesRFC: RFC-0055
Context
Once the MCPServerEntry CRD exists (Phase 1), the VirtualMCPServer controller needs to discover these resources and include them as backends. In static mode, vMCP reads its backend configuration from a ConfigMap generated by the operator. This story extends that ConfigMap generation to include entry-type backends.
Key architectural decisions:
entry) distinct fromMCPServer(container) andMCPRemoteProxy(proxy)pkg/vmcp/workloads/) needs a newWorkloadTypeMCPServerEntryconstantScope
VirtualMCPServer Controller Discovery
ensureAllResources()incmd/thv-operator/controllers/virtualmcpserver_controller.goto discover MCPServerEntry resources via groupRefpkg/vmcp/workloads/k8s.go:WorkloadTypeMCPServerEntryconstantListWorkloadsInGroup()to include MCPServerEntry resourcesgetMCPServerEntryAsBackend()conversion (similar togetMCPRemoteProxyAsBackend())findVirtualMCPServerForMCPServer)ConfigMap Generation
cmd/thv-operator/controllers/virtualmcpserver_vmcpconfig.go:discoverBackendsWithMetadata()includes MCPServerEntry backendsconvertBackendsToStaticBackends()handles entry-type backendsremoteURL,transport, and auth config from MCPServerEntry specCA Bundle Volume Mounting
caBundleRef, mount the referenced ConfigMap as a volume in the vMCP Deployment/etc/toolhive/ca-bundles//ca.crtensureDeployment()to add volume and volumeMount entriesRBAC Updates
get,list,watchonmcpserverentriesensureRBACResources()in the controllerStatus Updates
VirtualMCPServerStatus.DiscoveredBackendsincludes MCPServerEntry backendsBackendCountreflects entry backendsAcceptance Criteria
WorkloadTypeMCPServerEntryconstant added to workloads discoverergetMCPServerEntryAsBackend()converts MCPServerEntry tovmcp.Backend/etc/toolhive/ca-bundles//ca.crtmcpserverentriesDiscoveredBackendsstatus includes entry backendstask test)