mcp生命周期操作员
Kubernetes运营商,提供一个声明性的API来部署、管理和安全地推出MCP服务器,通过生产级自动化和生态系统集成来处理其整个生命周期。
注: 该项目目前正在进行中 阿尔法 (v1alpha1).API和行为可能会在未来的版本中发生变化。文档
- 简介 -体系结构和MCPServer API概述
- 快速入门指南 -迅速起身并奔跑
- 指标 -Prometheus度量参考
- API 参考 -完整的MCPServer API文档
- 完整的MCPServer示例 -YAML显示所有可用字段
- 贡献 -如何为项目做出贡献
先决条件
- Kubernetes集群(v1.28+)
- kubectl已配置为访问您的集群
快速开始
1.安装操作装置
选项A:从版本安装(推荐)
直接从以下位置安装操作器和CRD 最新版本:
kubectl apply -f https://github.com/kubernetes-sigs/mcp-lifecycle-operator/releases/latest/download/install.yaml这将在中安装CRD、控制器部署和所有必要的RBAC资源 mcp-lifecycle-operator-system 命名空间。
选项B:在当地运营(用于发展)
克隆存储库并在本地计算机上运行控制器:
make install # Install the CRDs
make run # Run the controller locally保持这个终端打开。控制器日志将显示在此处。
选项C:从源代码构建和部署
在集群中构建和部署控制器作为部署:
# Build and push the container image for multiple platforms
make docker-buildx IMG=/mcp-lifecycle-operator:latest
# Deploy to cluster
make deploy IMG=/mcp-lifecycle-operator:latest注: docker-buildx 为多种架构(amd64、arm64、s390x、ppc64le)构建并自动推送。
2.创建测试MCPServer
在新终端中,创建测试 MCPServer 资源:
kubectl apply -f - <<EOF
apiVersion: mcp.x-k8s.io/v1alpha1
kind: MCPServer
metadata:
name: test-server
namespace: default
spec:
source:
type: ContainerImage
containerImage:
ref: quay.io/containers/kubernetes_mcp_server:latest
config:
port: 8080
EOF3.验证部署
检查操作员是否创建了资源:
# 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-server预期产出 kubectl get mcpservers:
NAME READY ACCEPTED IMAGE PORT ADDRESS AGE
test-server True True quay.io/containers/kubernetes_mcp_server:latest 8080 http://test-server.default.svc.cluster.local:8080/mcp 1m这 ADDRESS 列显示了集群内部URL,其他工作负载可以使用该URL连接到MCP服务器。
状态包括条件和服务地址,便于查找:
status:
deploymentName: test-server
serviceName: test-server
address:
url: http://test-server.default.svc.cluster.local:8080/mcp
conditions:
- type: Accepted
status: "True"
reason: Valid
- type: Ready
status: "True"
reason: Available4.测试服务
端口转发以测试连接:
kubectl port-forward service/test-server 8080:8080然后在另一个终端中:
# Test the health endpoint
curl http://localhost:8080/healthz
# Test the MCP endpoint
curl http://localhost:8080/mcp您应该看到MCP服务器的响应。
5.卸载(可选)
要卸下CRD和操作员:
# If you installed from the release
kubectl delete -f https://github.com/kubernetes-sigs/mcp-lifecycle-operator/releases/latest/download/install.yaml
# If you deployed from source
make undeploy
make uninstall示例
有关更多示例,请参阅 示例/ 目录:
- kubernetes mcp服务器 -使用基本配置和基于ConfigMap的配置部署Kubernetes MCP服务器
- 所有mcp服务器 -部署Everything MCP服务器
发展
先决条件
- 转到1.25+
建筑
# Generate code and manifests
make manifests generate
# Build binary
make build
# Run unit tests
make test
# Run e2e tests (requires Kind)
make deploy-test-e2e # creates Kind cluster, builds image, deploys operator
make test-e2e # runs e2e tests against the cluster
make cleanup-test-e2e # tears down the Kind cluster社区、讨论、贡献和支持
该项目是Kubernetes的一部分 SIG应用程序.
了解如何在 社区页面.
您可以通过以下方式联系此项目的维护人员:
行为准则
Kubernetes社区的参与由 Kubernetes行为准则.
