Skip to content
Open
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
5 changes: 2 additions & 3 deletions cmd/thv/app/list.go
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ func printTextOutput(workloadList []core.Workload) {

// Create a tabwriter for pretty output
w := tabwriter.NewWriter(os.Stdout, 0, 0, 3, ' ', 0)
fmt.Fprintln(w, "NAME\tPACKAGE\tSTATUS\tURL\tPORT\tTOOL TYPE\tGROUP\tCREATED AT")
fmt.Fprintln(w, "NAME\tPACKAGE\tSTATUS\tURL\tPORT\tGROUP\tCREATED AT")

// Print workload information
for _, c := range workloadList {
Expand All @@ -147,13 +147,12 @@ func printTextOutput(workloadList []core.Workload) {
}

// Print workload information
fmt.Fprintf(w, "%s\t%s\t%s\t%s\t%d\t%s\t%s\t%s\n",
fmt.Fprintf(w, "%s\t%s\t%s\t%s\t%d\t%s\t%s\n",
c.Name,
c.Package,
status,
c.URL,
c.Port,
c.ToolType,
c.Group,
c.CreatedAt,
)
Expand Down
2 changes: 1 addition & 1 deletion docs/server/docs.go

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion docs/server/swagger.json

Large diffs are not rendered by default.

5 changes: 0 additions & 5 deletions docs/server/swagger.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 2 additions & 6 deletions pkg/client/manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,6 @@ import (
"github.com/stacklok/toolhive/pkg/logger"
)

const (
mcpToolType = "mcp"
)

// Client represents a registered ToolHive client.
type Client struct {
Name MCPClient `json:"name"`
Expand Down Expand Up @@ -206,9 +202,9 @@ func (m *defaultManager) RemoveServerFromClients(ctx context.Context, serverName
}

// shouldSkipWorkload determines if a workload should be skipped when adding/removing servers from clients.
// Workloads are skipped if they are not MCP tool type and if they are not remote.
// Workloads are skipped if they are not remote.
func shouldSkipWorkload(workload core.Workload) bool {
return workload.ToolType != mcpToolType && !workload.Remote
return !workload.Remote
}

// addWorkloadsToClient adds the specified workloads to the client's configuration
Expand Down
3 changes: 0 additions & 3 deletions pkg/core/workload.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,6 @@ type Workload struct {
// Port is the port on which the workload is exposed.
// This is embedded in the URL.
Port int `json:"port"`
// ToolType is the type of tool this workload represents.
// For now, it will always be "mcp" - representing an MCP server.
ToolType string `json:"tool_type"`
// TransportType is the type of transport used for this workload.
TransportType types.TransportType `json:"transport_type"`
// ProxyMode is the proxy mode that clients should use to connect.
Expand Down
3 changes: 0 additions & 3 deletions pkg/core/workload_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,6 @@ func TestSortWorkloadsByName(t *testing.T) {
Package: "zebra-pkg",
URL: "http://localhost:8080",
Port: 8080,
ToolType: "mcp",
TransportType: types.TransportTypeSSE,
Status: runtime.WorkloadStatusRunning,
StatusContext: "healthy",
Expand All @@ -108,7 +107,6 @@ func TestSortWorkloadsByName(t *testing.T) {
Package: "alpha-pkg",
URL: "http://localhost:8081",
Port: 8081,
ToolType: "mcp",
TransportType: types.TransportTypeStdio,
Status: runtime.WorkloadStatusStopped,
StatusContext: "stopped",
Expand Down Expand Up @@ -159,7 +157,6 @@ func TestSortWorkloadsByName(t *testing.T) {
assert.Equal(t, originalWorkload.Package, sortedWorkload.Package)
assert.Equal(t, originalWorkload.URL, sortedWorkload.URL)
assert.Equal(t, originalWorkload.Port, sortedWorkload.Port)
assert.Equal(t, originalWorkload.ToolType, sortedWorkload.ToolType)
assert.Equal(t, originalWorkload.TransportType, sortedWorkload.TransportType)
assert.Equal(t, originalWorkload.Status, sortedWorkload.Status)
assert.Equal(t, originalWorkload.StatusContext, sortedWorkload.StatusContext)
Expand Down
12 changes: 0 additions & 12 deletions pkg/labels/labels.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,6 @@ const (
// LabelPort is the label that contains the port
LabelPort = "toolhive-port"

// LabelToolType is the label that indicates the type of tool
LabelToolType = "toolhive-tool-type"

// LabelNetworkIsolation indicates that the network isolation functionality is enabled.
LabelNetworkIsolation = "toolhive-network-isolation"

Expand All @@ -50,9 +47,6 @@ func AddStandardLabels(labels map[string]string, containerName, containerBaseNam
labels[LabelBaseName] = containerBaseName
labels[LabelTransport] = transportType
labels[LabelPort] = fmt.Sprintf("%d", port)

// TODO: In the future, we'll support different tool types beyond just "mcp"
labels[LabelToolType] = "mcp"
}

// AddNetworkLabels adds network-related labels to a network
Expand Down Expand Up @@ -116,11 +110,6 @@ func GetPort(labels map[string]string) (int, error) {
return port, nil
}

// GetToolType gets the tool type from labels
func GetToolType(labels map[string]string) string {
return labels[LabelToolType]
}

// GetGroup gets the group name from labels
func GetGroup(labels map[string]string) string {
return labels[LabelGroup]
Expand All @@ -147,7 +136,6 @@ func IsStandardToolHiveLabel(key string) bool {
LabelBaseName,
LabelTransport,
LabelPort,
LabelToolType,
LabelNetworkIsolation,
}

Expand Down
40 changes: 0 additions & 40 deletions pkg/labels/labels_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ func TestAddStandardLabels(t *testing.T) {
LabelBaseName: "test-base",
LabelTransport: "http",
LabelPort: "8080",
LabelToolType: "mcp",
},
},
{
Expand All @@ -41,7 +40,6 @@ func TestAddStandardLabels(t *testing.T) {
LabelBaseName: "another-base",
LabelTransport: "https",
LabelPort: "9090",
LabelToolType: "mcp",
},
},
{
Expand All @@ -56,7 +54,6 @@ func TestAddStandardLabels(t *testing.T) {
LabelBaseName: "group-base",
LabelTransport: "sse",
LabelPort: "7070",
LabelToolType: "mcp",
},
},
}
Expand Down Expand Up @@ -390,11 +387,6 @@ func TestIsStandardToolHiveLabel(t *testing.T) {
key: LabelPort,
expected: true,
},
{
name: "Standard tool type label",
key: LabelToolType,
expected: true,
},
{
name: "Standard network isolation label",
key: LabelNetworkIsolation,
Expand Down Expand Up @@ -693,35 +685,3 @@ func TestParseLabelValidation(t *testing.T) {
})
}
}

func TestGetToolType(t *testing.T) {
t.Parallel()
tests := []struct {
name string
labels map[string]string
expected string
}{
{
name: "Tool type exists",
labels: map[string]string{
LabelToolType: "mcp",
},
expected: "mcp",
},
{
name: "Tool type doesn't exist",
labels: map[string]string{},
expected: "",
},
}

for _, tc := range tests {
t.Run(tc.name, func(t *testing.T) {
t.Parallel()
result := GetToolType(tc.labels)
if result != tc.expected {
t.Errorf("Expected tool type to be %s, but got %s", tc.expected, result)
}
})
}
}
4 changes: 0 additions & 4 deletions pkg/runner/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -460,7 +460,6 @@ func TestRunConfig_WithStandardLabels(t *testing.T) {
"toolhive-name": "test-server",
"toolhive-transport": "sse",
"toolhive-port": "60000",
"toolhive-tool-type": "mcp",
},
},
{
Expand All @@ -477,7 +476,6 @@ func TestRunConfig_WithStandardLabels(t *testing.T) {
"toolhive": "true",
"toolhive-name": "test-server",
"toolhive-transport": "stdio",
"toolhive-tool-type": "mcp",
"existing-label": "existing-value",
},
},
Expand All @@ -496,7 +494,6 @@ func TestRunConfig_WithStandardLabels(t *testing.T) {
"toolhive-name": "test-server",
"toolhive-transport": "sse", // Should be "sse" not "stdio"
"toolhive-port": "60000",
"toolhive-tool-type": "mcp",
},
},
{
Expand All @@ -514,7 +511,6 @@ func TestRunConfig_WithStandardLabels(t *testing.T) {
"toolhive-name": "test-server",
"toolhive-transport": "streamable-http", // Should be "streamable-http" not "stdio"
"toolhive-port": "60000",
"toolhive-tool-type": "mcp",
},
},
}
Expand Down
6 changes: 1 addition & 5 deletions pkg/vmcp/aggregator/discoverer_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ func TestBackendDiscoverer_Discover(t *testing.T) {
TransportType: "streamable-http",
HealthStatus: vmcp.BackendHealthy,
Metadata: map[string]string{
"tool_type": "github",
"workload_status": "running",
"env": "prod",
},
Expand All @@ -48,7 +47,6 @@ func TestBackendDiscoverer_Discover(t *testing.T) {
TransportType: "sse",
HealthStatus: vmcp.BackendHealthy,
Metadata: map[string]string{
"tool_type": "jira",
"workload_status": "running",
},
}
Expand All @@ -67,7 +65,6 @@ func TestBackendDiscoverer_Discover(t *testing.T) {
assert.Equal(t, "workload1", backends[0].ID)
assert.Equal(t, "http://localhost:8080/mcp", backends[0].BaseURL)
assert.Equal(t, vmcp.BackendHealthy, backends[0].HealthStatus)
assert.Equal(t, "github", backends[0].Metadata["tool_type"])
assert.Equal(t, "prod", backends[0].Metadata["env"])
assert.Equal(t, "workload2", backends[1].ID)
assert.Equal(t, "sse", backends[1].TransportType)
Expand Down Expand Up @@ -337,7 +334,7 @@ func TestCLIWorkloadDiscoverer(t *testing.T) {
Name: "workload1",
BaseURL: "http://localhost:8080/mcp",
HealthStatus: vmcp.BackendHealthy,
Metadata: map[string]string{"tool_type": "github", "env": "prod"},
Metadata: map[string]string{"env": "prod"},
}

mockGroups.EXPECT().Exists(gomock.Any(), testGroupName).Return(true, nil)
Expand All @@ -353,7 +350,6 @@ func TestCLIWorkloadDiscoverer(t *testing.T) {
assert.Equal(t, "workload1", backends[0].ID)
assert.Equal(t, "http://localhost:8080/mcp", backends[0].BaseURL)
assert.Equal(t, vmcp.BackendHealthy, backends[0].HealthStatus)
assert.Equal(t, "github", backends[0].Metadata["tool_type"])
assert.Equal(t, "prod", backends[0].Metadata["env"])
})

Expand Down
6 changes: 2 additions & 4 deletions pkg/vmcp/workloads/k8s.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package workloads
import (
"context"
"fmt"
"maps"
"strings"

"k8s.io/apimachinery/pkg/api/errors"
Expand Down Expand Up @@ -178,12 +179,9 @@ func (d *k8sDiscoverer) mcpServerToBackend(ctx context.Context, mcpServer *mcpv1
}

// Copy user labels to metadata first
for k, v := range userLabels {
backend.Metadata[k] = v
}
maps.Copy(backend.Metadata, userLabels)

// Set system metadata (these override user labels to prevent conflicts)
backend.Metadata["tool_type"] = "mcp"
backend.Metadata["workload_status"] = string(mcpServer.Status.Phase)
if mcpServer.Namespace != "" {
backend.Metadata["namespace"] = mcpServer.Namespace
Expand Down
1 change: 0 additions & 1 deletion pkg/vmcp/workloads/k8s_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -350,7 +350,6 @@ func TestMCPServerToBackend_BasicFields(t *testing.T) {
assert.Equal(t, "http://localhost:8080", backend.BaseURL)
assert.Equal(t, "streamable-http", backend.TransportType)
assert.Equal(t, vmcp.BackendHealthy, backend.HealthStatus)
assert.Equal(t, "mcp", backend.Metadata["tool_type"])
assert.Equal(t, string(mcpv1alpha1.MCPServerPhaseRunning), backend.Metadata["workload_status"])
assert.Equal(t, namespace, backend.Metadata["namespace"])
}
Expand Down
2 changes: 0 additions & 2 deletions pkg/workloads/manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,6 @@ func (d *DefaultManager) GetWorkloadAsVMCPBackend(ctx context.Context, workloadN
}

// Set system metadata (these override user labels to prevent conflicts)
backend.Metadata["tool_type"] = workload.ToolType
backend.Metadata["workload_status"] = string(workload.Status)

return backend, nil
Expand Down Expand Up @@ -1410,7 +1409,6 @@ func (d *DefaultManager) getRemoteWorkloadsFromState(
Port: runConfig.Port,
TransportType: transportType,
ProxyMode: effectiveProxyMode,
ToolType: "remote",
Group: runConfig.Group,
CreatedAt: workloadStatus.CreatedAt,
Labels: runConfig.ContainerLabels,
Expand Down
4 changes: 0 additions & 4 deletions pkg/workloads/types/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,6 @@ func WorkloadFromContainerInfo(container *runtime.ContainerInfo) (core.Workload,
}
}

// Get tool type from labels
toolType := labels.GetToolType(container.Labels)

// Get port from labels
port, err := labels.GetPort(container.Labels)
if err != nil {
Expand Down Expand Up @@ -103,7 +100,6 @@ func WorkloadFromContainerInfo(container *runtime.ContainerInfo) (core.Workload,
Name: name, // Use the calculated workload name (base name), not container name
Package: container.Image,
URL: url,
ToolType: toolType,
TransportType: tType,
ProxyMode: effectiveProxyMode,
Status: container.State,
Expand Down
2 changes: 0 additions & 2 deletions test/e2e/remote_mcp_server_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ type WorkloadInfo struct {
Package string `json:"package"`
URL string `json:"url"`
Port int `json:"port"`
ToolType string `json:"tool_type"`
TransportType string `json:"transport_type"`
ProxyMode string `json:"proxy_mode"`
Status string `json:"status"`
Expand Down Expand Up @@ -87,7 +86,6 @@ var _ = Describe("Remote MCP Server", Label("remote", "mcp", "e2e"), Serial, fun
Expect(serverInfo.Status).To(Equal("running"), "Server should be in running state")
Expect(serverInfo.Remote).To(BeTrue(), "Server should be marked as remote")
Expect(serverInfo.Package).To(Equal("remote"), "Package should be 'remote'")
Expect(serverInfo.ToolType).To(Equal("remote"), "Tool type should be 'remote'")
Expect(serverInfo.TransportType).To(Equal("streamable-http"), "Transport should be streamable-http")
})

Expand Down
Loading