A Kubernetes operator that provides a declarative API to deploy, manage, and safely roll out MCP Servers, handling their full lifecycle with production-grade automation and ecosystem integrations.
- Kubernetes cluster (v1.28+)
- kubectl configured to access your cluster
- Go 1.24+ (for building from source)
First, install the Custom Resource Definitions:
make installThis creates the MCPServer CRD in your cluster.
You have two options:
Run the controller on your local machine (it will connect to your cluster):
make runKeep this terminal open. The controller logs will appear here.
Build and deploy the controller as a Deployment in your cluster:
# Build and push the container image for multiple platforms
make docker-buildx IMG=<your-registry>/mcp-lifecycle-operator:latest
# Deploy to cluster
make deploy IMG=<your-registry>/mcp-lifecycle-operator:latestNote: docker-buildx builds for multiple architectures (amd64, arm64, s390x, ppc64le) and pushes automatically.
In a new terminal, create a test MCPServer resource:
kubectl apply -f - <<EOF
apiVersion: mcp.x-k8s.io/v1alpha1
kind: MCPServer
metadata:
name: test-server
namespace: default
spec:
source:
type: ContainerImage
containerImage:
ref: aliok/mcp-server-streamable-http:latest
config:
port: 8081
EOFCheck that the operator created the resources:
# View the MCPServer status
kubectl get mcpservers
kubectl get mcpserver test-server -o yaml
# Verify the Deployment was created
kubectl get deployment test-server
# Verify the Service was created
kubectl get service test-server
# Check the pod is running
kubectl get pods -l mcp-server=test-serverExpected output from kubectl get mcpservers:
NAME PHASE IMAGE PORT ADDRESS AGE
test-server Running aliok/mcp-server-streamable-http:latest 8081 http://test-server.default.svc.cluster.local:8081/mcp 1m
The ADDRESS column shows the cluster-internal URL that can be used by other workloads to connect to the MCP server.
The status includes the service address for easy discovery:
status:
phase: Running
deploymentName: test-server
serviceName: test-server
address:
url: http://test-server.default.svc.cluster.local:8081/mcp
conditions:
- type: Ready
status: "True"Port-forward to test connectivity:
kubectl port-forward service/test-server 8081:8081Then in another terminal:
curl http://localhost:8081/mcpYou should see a response from the MCP server.
To remove the CRDs and operator:
# If you deployed to cluster
make undeploy
# Remove the CRDs
make uninstallFor complete examples with ConfigMap support and detailed documentation, see the examples/ directory:
- kubernetes-mcp-server - Deploy the Kubernetes MCP Server with basic and ConfigMap-based configurations
apiVersion: mcp.x-k8s.io/v1alpha1
kind: MCPServer
metadata:
name: streamable-http-server
namespace: default
spec:
source:
type: ContainerImage
containerImage:
ref: aliok/mcp-server-streamable-http:latest
config:
port: 8081apiVersion: mcp.x-k8s.io/v1alpha1
kind: MCPServer
metadata:
name: custom-server
namespace: default
spec:
source:
type: ContainerImage
containerImage:
ref: my-registry.io/custom-mcp-server:1.0.0
config:
port: 8000# Generate code and manifests
make manifests generate
# Build binary
make build
# Run tests
make testThis project is part of Kubernetes SIG Apps.
Learn how to engage with the Kubernetes community on the community page.
You can reach the maintainers of this project at:
Participation in the Kubernetes community is governed by the Kubernetes Code of Conduct.