Skip to content

Commit 22428ff

Browse files
authored
Promote MCPRegistry feature (#2136)
* docs for MCP registry CRD Signed-off-by: Daniele Martinoli <[email protected]> * integrated comments Signed-off-by: Daniele Martinoli <[email protected]> * rebased Signed-off-by: Daniele Martinoli <[email protected]> * promoted mcpregistry feature Signed-off-by: Daniele Martinoli <[email protected]> * bump chart version (operator and crds) Signed-off-by: Daniele Martinoli <[email protected]> * lint fix Signed-off-by: Daniele Martinoli <[email protected]> * rebased * bump chart version (operator and crds) Signed-off-by: Daniele Martinoli <[email protected]> * lint issues Signed-off-by: Daniele Martinoli <[email protected]> --------- Signed-off-by: Daniele Martinoli <[email protected]>
1 parent 0fe8402 commit 22428ff

File tree

19 files changed

+22
-74
lines changed

19 files changed

+22
-74
lines changed

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,15 +66,15 @@ ToolHive includes a Kubernetes Operator for enterprise and production deployment
6666
### Features
6767

6868
- **MCPServer CRD**: Deploy and manage MCP servers as Kubernetes resources
69-
- **MCPRegistry CRD** *(Experimental)*: Centralized registry management with automated sync
69+
- **MCPRegistry CRD** Centralized registry management with automated sync
7070
- **Secure isolation**: Container-based server execution with permission profiles
7171
- **Protocol proxying**: Stdio servers exposed via HTTP/SSE networking protocols
7272
- **Service discovery**: Automatic service creation and DNS integration
7373

7474
### Documentation
7575

7676
- [Operator Guide](cmd/thv-operator/README.md) - Complete operator documentation
77-
- [MCPRegistry Reference](cmd/thv-operator/REGISTRY.md) - Registry management (experimental)
77+
- [MCPRegistry Reference](cmd/thv-operator/REGISTRY.md) - Registry management
7878
- [CRD API Reference](docs/operator/crd-api.md) - Auto-generated API documentation
7979
- [Deployment Guide](docs/kind/deploying-toolhive-operator.md) - Step-by-step installation
8080
- [Examples](examples/operator/) - Sample configurations

cmd/thv-operator/CLAUDE.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,9 @@ After modifying the CRDs, the following needs to be run:
1313

1414
When committing a change that changes CRDs, it is important to bump the chart version as described in the [CLAUDE.md](../../deploy/charts/operator-crds/CLAUDE.md#bumping-crd-chart) doc for the CRD Helm Chart.
1515

16-
## MCPRegistry CRD (Experimental)
16+
## MCPRegistry CRD
1717

18-
The MCPRegistry CRD enables centralized management of MCP server registries. Requires `operator.features.experimental=true`.
18+
The MCPRegistry CRD enables centralized management of MCP server registries.
1919

2020
### Key Components
2121

cmd/thv-operator/README.md

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,7 @@ Represents an MCP server in Kubernetes. When you create an `MCPServer` resource,
1616
3. Configures the appropriate permissions and settings
1717
4. Manages the lifecycle of the MCP server
1818

19-
### MCPRegistry (Experimental)
20-
21-
> ⚠️ **Experimental Feature**: MCPRegistry requires `ENABLE_EXPERIMENTAL_FEATURES=true`
19+
### MCPRegistry
2220

2321
Represents an MCP server registry in Kubernetes. When you create an `MCPRegistry` resource, the operator automatically:
2422

@@ -125,9 +123,6 @@ helm upgrade -i toolhive-operator-crds oci://ghcr.io/stacklok/toolhive/toolhive-
125123
```bash
126124
# Standard installation
127125
helm upgrade -i <release_name> oci://ghcr.io/stacklok/toolhive/toolhive-operator --version=<version> -n toolhive-system --create-namespace
128-
129-
# OR with experimental features (for MCPRegistry support)
130-
helm upgrade -i <release_name> oci://ghcr.io/stacklok/toolhive/toolhive-operator --version=<version> -n toolhive-system --create-namespace --set operator.features.experimental=true
131126
```
132127

133128
## Usage
@@ -252,9 +247,7 @@ permissionProfile:
252247
The ConfigMap should contain a JSON permission profile.
253248
-->
254249

255-
### Creating an MCP Registry (Experimental)
256-
257-
> ⚠️ **Requires**: `operator.features.experimental=true`
250+
### Creating an MCP Registry
258251

259252
First, create a ConfigMap containing ToolHive registry data. The ConfigMap must be user-defined and is not managed by the operator:
260253

cmd/thv-operator/REGISTRY.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
# MCPRegistry Reference
22

3-
> ⚠️ **Experimental Feature**: MCPRegistry requires enabling experimental features with `--set operator.features.experimental=true` during Helm installation.
4-
53
## Overview
64

75
MCPRegistry is a Kubernetes Custom Resource that manages MCP (Model Context Protocol) server registries. It provides centralized server discovery, automated synchronization, content filtering, and image validation for MCP servers in your cluster.

cmd/thv-operator/Taskfile.yml

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -136,28 +136,20 @@ tasks:
136136
TOOLHIVE_IMAGE:
137137
sh: KO_DOCKER_REPO=kind.local ko build --local -B ./cmd/thv-proxyrunner | tail -n 1
138138
REGISTRY_API_IMAGE:
139-
sh: |
140-
if [ "{{.ENABLE_EXPERIMENTAL_FEATURES}}" = "true" ]; then
141-
KO_DOCKER_REPO=kind.local ko build --local -B ./cmd/thv-registry-api | tail -n 1
142-
else
143-
echo ""
144-
fi
139+
sh: KO_DOCKER_REPO=kind.local ko build --local -B ./cmd/thv-registry-api | tail -n 1
145140
cmds:
146141
- echo "Loading toolhive operator image {{.OPERATOR_IMAGE}} into kind..."
147142
- kind load docker-image --name toolhive {{.OPERATOR_IMAGE}}
148143
- echo "Loading toolhive image {{.TOOLHIVE_IMAGE}} into kind..."
149144
- kind load docker-image --name toolhive {{.TOOLHIVE_IMAGE}}
150-
- |
151-
if [ "{{.ENABLE_EXPERIMENTAL_FEATURES}}" = "true" ]; then
152-
echo "Loading registry API image {{.REGISTRY_API_IMAGE}} into kind..."
153-
kind load docker-image --name toolhive {{.REGISTRY_API_IMAGE}}
154-
fi
145+
- echo "Loading registry API image {{.REGISTRY_API_IMAGE}} into kind..."
146+
- kind load docker-image --name toolhive {{.REGISTRY_API_IMAGE}}
155147
- |
156148
helm upgrade --install toolhive-operator deploy/charts/operator \
157149
--set operator.image={{.OPERATOR_IMAGE}} \
158150
--set operator.toolhiveRunnerImage={{.TOOLHIVE_IMAGE}} \
159151
--set operator.features.experimental={{.ENABLE_EXPERIMENTAL_FEATURES}} \
160-
{{if eq .ENABLE_EXPERIMENTAL_FEATURES "true"}}--set registryAPI.image={{.REGISTRY_API_IMAGE}}{{end}} \
152+
--set registryAPI.image={{.REGISTRY_API_IMAGE}} \
161153
--namespace toolhive-system \
162154
--create-namespace \
163155
--kubeconfig kconfig.yaml \

cmd/thv-operator/api/v1alpha1/mcpregistry_types.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -356,7 +356,6 @@ const (
356356
//+kubebuilder:validation:XValidation:rule="self.spec.source.type == 'configmap' ? has(self.spec.source.configmap) : (self.spec.source.type == 'git' ? has(self.spec.source.git) : true)",message="configMap field is required when source type is 'configmap', git field is required when source type is 'git'"
357357

358358
// MCPRegistry is the Schema for the mcpregistries API
359-
// ⚠️ Experimental API (v1alpha1) — subject to change.
360359
type MCPRegistry struct {
361360
metav1.TypeMeta `json:",inline"` // nolint:revive
362361
metav1.ObjectMeta `json:"metadata,omitempty"`

cmd/thv-operator/main.go

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -87,13 +87,11 @@ func main() {
8787
}
8888

8989
// Only register MCPRegistry controller if feature flag is enabled
90-
if os.Getenv("ENABLE_EXPERIMENTAL_FEATURES") == "true" {
91-
rec.ImageValidation = validation.ImageValidationRegistryEnforcing
90+
rec.ImageValidation = validation.ImageValidationRegistryEnforcing
9291

93-
if err = (controllers.NewMCPRegistryReconciler(mgr.GetClient(), mgr.GetScheme())).SetupWithManager(mgr); err != nil {
94-
setupLog.Error(err, "unable to create controller", "controller", "MCPRegistry")
95-
os.Exit(1)
96-
}
92+
if err = (controllers.NewMCPRegistryReconciler(mgr.GetClient(), mgr.GetScheme())).SetupWithManager(mgr); err != nil {
93+
setupLog.Error(err, "unable to create controller", "controller", "MCPRegistry")
94+
os.Exit(1)
9795
}
9896
//+kubebuilder:scaffold:builder
9997

cmd/thv-operator/pkg/validation/image_validation_test.go

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ package validation
33
import (
44
"context"
55
"fmt"
6-
"os"
76
"testing"
87

98
"github.com/stretchr/testify/assert"
@@ -95,18 +94,6 @@ func TestNewImageValidator(t *testing.T) {
9594
for _, tt := range tests {
9695
t.Run(tt.name, func(t *testing.T) {
9796
t.Parallel()
98-
// Save original env value
99-
originalValue := os.Getenv("TOOLHIVE_EXPERIMENTAL_REGISTRY_ENFORCEMENT")
100-
defer func() {
101-
os.Setenv("TOOLHIVE_EXPERIMENTAL_REGISTRY_ENFORCEMENT", originalValue)
102-
}()
103-
104-
// Set test env value
105-
if tt.setupEnv {
106-
os.Setenv("TOOLHIVE_EXPERIMENTAL_REGISTRY_ENFORCEMENT", tt.envValue)
107-
} else {
108-
os.Unsetenv("TOOLHIVE_EXPERIMENTAL_REGISTRY_ENFORCEMENT")
109-
}
11097

11198
var validationType ImageValidation
11299
if tt.envValue == "true" {

cmd/thv-operator/test-integration/mcp-registry/suite_test.go

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ import (
1313
corev1 "k8s.io/api/core/v1"
1414
metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
1515
"k8s.io/client-go/kubernetes/scheme"
16-
"k8s.io/client-go/rest"
1716
ctrl "sigs.k8s.io/controller-runtime"
1817
"sigs.k8s.io/controller-runtime/pkg/client"
1918
"sigs.k8s.io/controller-runtime/pkg/envtest"
@@ -26,7 +25,6 @@ import (
2625
)
2726

2827
var (
29-
cfg *rest.Config
3028
k8sClient client.Client
3129
testEnv *envtest.Environment
3230
testMgr ctrl.Manager
@@ -44,11 +42,6 @@ var _ = BeforeSuite(func() {
4442

4543
ctx, cancel = context.WithCancel(context.TODO())
4644

47-
// Enable experimental features for MCPRegistry controller
48-
By("enabling experimental features")
49-
err := os.Setenv("ENABLE_EXPERIMENTAL_FEATURES", "true")
50-
Expect(err).NotTo(HaveOccurred())
51-
5245
By("bootstrapping test environment")
5346

5447
// Check if we should use an existing cluster (for CI/CD)
@@ -73,7 +66,7 @@ var _ = BeforeSuite(func() {
7366
BinaryAssetsDirectory: kubebuilderAssets,
7467
}
7568

76-
cfg, err = testEnv.Start()
69+
cfg, err := testEnv.Start()
7770
Expect(err).NotTo(HaveOccurred())
7871
Expect(cfg).NotTo(BeNil())
7972

deploy/charts/operator-crds/Chart.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,5 +2,5 @@ apiVersion: v2
22
name: toolhive-operator-crds
33
description: A Helm chart for installing the ToolHive Operator CRDs into Kubernetes.
44
type: application
5-
version: 0.0.33
5+
version: 0.0.34
66
appVersion: "0.0.1"

0 commit comments

Comments
 (0)