Repository navigation
Closed
2 / 22 of 2 issues completedClosed
2 / 22 of 2 issues completed
Copy link
Labels
apiItems related to the APIenhancementNew feature or requestgoPull requests that update go codekubernetesItems related to KubernetesoperatorvmcpVirtual MCP Server related issues
Description
Description
Add a platform-agnostic StatusReporter interface to enable vMCP runtime to report operational status. This enables real-time status updates from the running vMCP binary rather than controller-inferred status.
Background
Currently, VirtualMCPServer CRD status is populated by the controller via static queries at reconcile time. The vMCP runtime has no way to report actual operational state (backend health, tool counts, connectivity). This leads to stale status information.
Proposed Design
Interface (pkg/vmcp/status/reporter.go)
type Reporter interface {
Report(ctx context.Context, status *RuntimeStatus) error
Start(ctx context.Context, interval time.Duration) error
Stop()
}
type RuntimeStatus struct {
Phase string // Ready, Degraded, Failed
Message string
Backends []BackendHealthReport
TotalToolCount int
HealthyBackends int
UnhealthyBackends int
LastDiscoveryTime time.Time
}Implementations
| Implementation | Environment | Behavior |
|---|---|---|
K8sReporter |
Kubernetes | Updates VirtualMCPServer/status subresource |
LogReporter |
CLI/local | Logs status periodically |
NoopReporter |
Testing | No-op |
Factory
func NewReporter(name, namespace string) (Reporter, error) {
if rt.IsKubernetesRuntime() {
return NewK8sReporter(name, namespace)
}
return NewLogReporter(name), nil
}Implementation
New Files
pkg/vmcp/status/reporter.go- Interfacepkg/vmcp/status/types.go- RuntimeStatus typespkg/vmcp/status/k8s_reporter.go- K8s implementationpkg/vmcp/status/log_reporter.go- Logging implementationpkg/vmcp/status/factory.go- Platform detection factory
Modified Files
pkg/vmcp/server/server.go- Accept and use StatusReportercmd/vmcp/app/commands.go- Create reporter based on environmentcmd/thv-operator/controllers/virtualmcpserver_deployment.go- Add VMCP_NAME/VMCP_NAMESPACE env vars
RBAC Updates
vMCP ServiceAccount needs status update permission:
- apiGroups: ["toolhive.stacklok.dev"]
resources: ["virtualmcpservers/status"]
verbs: ["get", "update", "patch"]Design Principles
- Platform-agnostic: Interface works for K8s and CLI
- Loose coupling: Runtime imports only CRD types, not controller code
- Graceful degradation: K8s reporter errors fall back to logging
- Non-blocking: Status reporting in background goroutine
Acceptance Criteria
-
Reporterinterface defined with Start/Stop/Report methods -
K8sReporterupdates VirtualMCPServer status subresource -
LogReporterlogs status for CLI environments - Factory detects runtime environment
- vMCP server integrates StatusReporter
- RBAC rules added for status updates
- Unit tests for all implementations
- Integration test for K8s status updates
Sub-issues
Collapse Sub-issuesSub-issues
Loading 2 sub-issues
Metadata
Metadata
Assignees
Labels
apiItems related to the APIenhancementNew feature or requestgoPull requests that update go codekubernetesItems related to KubernetesoperatorvmcpVirtual MCP Server related issues
Activity
jhrozek commentedon Dec 11, 2025
Scope Extension
Per the THV-2884 vMCP K8s-aware refactor planning, this issue is extended to include server integration (wiring StatusReporter into the vMCP server lifecycle).
Additional Acceptance Criteria
Additional Files to Modify
pkg/vmcp/server/server.go- Accept and start reportercmd/vmcp/app/commands.go- Create reporter based on environmentRelated Issues
Add StatusReporter abstraction for vMCP runtime status updates
Add GenerationChangedPredicate to VirtualMCPServer controller
Add StatusReporter abstraction for vMCP runtime status updates
Add GenerationChangedPredicate to VirtualMCPServer controller
4t8dd commentedon Dec 22, 2025
@jerm-dro Hi I found this is the toppest dependency of #3004 then I fix this first for later fix. I hope you find it well.