Skip to content
Merged
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
15 changes: 5 additions & 10 deletions pkg/vmcp/cli/serve.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ import (
vmcpclient "github.com/stacklok/toolhive/pkg/vmcp/client"
"github.com/stacklok/toolhive/pkg/vmcp/codemode"
"github.com/stacklok/toolhive/pkg/vmcp/config"
"github.com/stacklok/toolhive/pkg/vmcp/discovery"
"github.com/stacklok/toolhive/pkg/vmcp/health"
"github.com/stacklok/toolhive/pkg/vmcp/k8s"
"github.com/stacklok/toolhive/pkg/vmcp/optimizer"
Expand Down Expand Up @@ -210,11 +209,6 @@ func Serve(ctx context.Context, cfg ServeConfig) error {
// DynamicRegistry tracks backends for dynamic discovery in Kubernetes mode.
dynamicRegistry := vmcp.NewDynamicRegistry(backends)
backendRegistry := vmcp.BackendRegistry(dynamicRegistry)

discoveryMgr, err := discovery.NewManager(agg)
if err != nil {
return fmt.Errorf("failed to create discovery manager: %w", err)
}
slog.Info("dynamic backend registry enabled for Kubernetes environment")

// Backend watcher for dynamic backend discovery.
Expand Down Expand Up @@ -249,8 +243,9 @@ func Serve(ctx context.Context, cfg ServeConfig) error {
slog.Info("kubernetes backend watcher started for dynamic backend discovery")
}

// Create router.
rtr := vmcprouter.NewDefaultRouter()
// Workflow validation in core.New needs a non-nil Router, but the core routes per-call
// via NewSessionRouter and validation does not route — so an empty session router suffices.
rtr := vmcprouter.NewSessionRouter(&vmcp.RoutingTable{})

slog.Info(fmt.Sprintf("Setting up incoming authentication (type: %s)", vmcpCfg.IncomingAuth.Type))

Expand Down Expand Up @@ -462,8 +457,8 @@ func Serve(ctx context.Context, cfg ServeConfig) error {
slog.Info(fmt.Sprintf("Loaded %d composite tool workflow definitions", len(workflowDefs)))
}

// Create server with discovery manager, backend registry, and workflow definitions.
srv, err := vmcpserver.New(ctx, serverCfg, rtr, backendClient, discoveryMgr, backendRegistry, workflowDefs)
// Create server with the backend registry and workflow definitions.
srv, err := vmcpserver.New(ctx, serverCfg, rtr, backendClient, backendRegistry, workflowDefs)
if err != nil {
return fmt.Errorf("failed to create Virtual MCP Server: %w", err)
}
Expand Down
7 changes: 3 additions & 4 deletions pkg/vmcp/core/core_vmcp.go
Original file line number Diff line number Diff line change
Expand Up @@ -518,10 +518,9 @@ func workflowsRequireElicitation(defs map[string]*composer.WorkflowDefinition) b
// health monitor is used (respects circuit breaker state). When nil, falls back
// to the initial health status from the backend registry.
//
// This is an intentional, temporary duplication of discovery.filterHealthyBackends
// (discovery/middleware.go:157, rules at 185-188): the discovery middleware keeps
// its own copy on the legacy server.New path until that path is removed in Phase 3
// (#5442/#5445). Keep the include/exclude rules identical across both copies.
// This filtering previously had a second copy in the discovery middleware on the
// legacy server.New path. That path and its copy were removed in Phase 3 (#5445),
// so this is now the single source of truth for backend health filtering.
func filterHealthyBackends(backends []vmcp.Backend, healthStatusProvider health.StatusProvider) []vmcp.Backend {
if len(backends) == 0 {
return backends
Expand Down
38 changes: 0 additions & 38 deletions pkg/vmcp/discovery/context.go

This file was deleted.

91 changes: 0 additions & 91 deletions pkg/vmcp/discovery/context_test.go

This file was deleted.

84 changes: 0 additions & 84 deletions pkg/vmcp/discovery/manager.go

This file was deleted.

Loading
Loading