Back to MCP directory
publicPublicdnsLocal runtime

kubernetes-mcp-server

Kubernetes MCP服务器是一个强大的Kubernetes模型上下文协议实现,支持Kubernetes和OpenShift集群操作,无需依赖外部工具即可执行各种资源管理任务。

article

README

🚀 Kubernetes 模型上下文协议 (MCP)

Kubernetes 模型上下文协议 (MCP) 为用户提供了与 Kubernetes 集群交互的便捷方式,可用于管理和操作各类 Kubernetes 资源。

🚀 快速开始

要使用 Kubernetes 的 MCP 功能,您需要先安装并运行一个 MCP 代理。

📦 安装指南

以下是设置 MCP 代理的示例命令:

# 下载 MCP 代理
wget https://github.com/ModelMesh/mesh-mcp/raw/main/deploy/mcp-agent.yaml
# 部署 MCP 代理到 Kubernetes 集群
kubectl apply -f mcp-agent.yaml

💻 使用示例

基础用法

MCP 提供了一个命令行工具 mcpctl,用于与 Kubernetes 集群交互。以下是一些常用命令:

# 获取 MCP 代理的版本信息
mcpctl version

# 检查 MCP 代理的状态
mcpctl status

# 获取 MCP 代理的帮助文档
mcpctl help

高级用法

mcpctl 提供了多种功能来与 Kubernetes 资源交互,以下是一些具体操作示例:

创建一个 Deployment

# 使用 YAML 文件创建 Deployment
mcpctl context create_or_update \
  --api-version apps/v1 \
  --kind Deployment \
  --name my-deployment \
  --namespace default \
  --resource ./my-deployment.yaml

删除一个 Service

# 删除名为 my-service 的 Service
mcpctl context delete \
  --api-version v1 \
  --kind Service \
  --name my-service \
  --namespace default

🔧 开发 MCP 代理

如果您想开发自己的 MCP 代理,可以使用以下命令:

# 编译项目
make build

# 运行 MCP 代理并与 mcp-inspector 工具一起使用
npx @modelcontextprotocol/inspector@latest $(pwd)/kubernetes-mcp-server

总结来说,这个文档详细介绍了如何安装、配置和使用 Kubernetes 的模型上下文协议 (MCP) 代理,以及如何与 MCP 资源进行交互。

help

Runtime guide

cloud

Hosted runtime

Hosted servers run from a provider-managed environment. You usually connect the MCP client to the hosted endpoint or follow the provider's authorization flow, without keeping a local process alive

  1. Open provider connection page
  2. Authorize or copy endpoint
  3. Connect from your MCP client
terminal

Local runtime / other methods

Local servers run on your own machine or infrastructure. You normally copy the server_config into your MCP client, install the required package, and provide env variables from env_schema when needed

  1. Copy server_config
  2. Install required package
  3. Fill env variables and restart client