kube-mcp

by lochgeo
Verified

local-only server

The server can only run on the client’s local machine because it depends on local resources.

Integrations

  • Integrates with Google's Gemini API for AI capabilities, allowing the MCP server to leverage Gemini models for processing and responding to requests.

  • Enables interaction with Kubernetes clusters, allowing for management and orchestration of containerized applications through the Kubernetes API using the Python client.

kube-mcp

获取 Gemini APi 密钥

前往https://aistudio.google.com/获取 API 密钥。目前,gemini-2.0-pro-exp-02-05 LLM 完全免费。其他型号也提供非常优惠的价格。

安装 Codename Goose

Goose 是一个开源 AI 代理,它通过自动化编码任务来增强您的软件开发能力。我们将使用 Codename Goose,因为它内置了 MCP 客户端。请按照此处的步骤安装 Codename Goose: https://block.github.io/goose/docs/getting-started/installation 。设置 GOOGLE_API_KEY 环境变量,以便 Goose 知道使用 Gemini API。了解如何使用goose configure进行配置,以及如何使用goose session以会话方式启动。

开发 MCP 服务器

通过阅读文档了解 MCP: https://modelcontextprotocol.io/introduction以及 Python SDK: https://github.com/modelcontextprotocol/python-sdk克隆此仓库并使用mcp dev server.py进行测试。请注意,本项目使用uv包管理器而不是 pip。通过阅读文档了解uvhttps://github.com/astral-sh/uv本项目使用 Kubernetes python 客户端: https://github.com/kubernetes-client/python

安装 Minikube

按照以下说明安装 minikube: https://minikube.sigs.k8s.io/docs/start/? arch=/linux/x86-64/stable/binary+download 确保集群配置已提供给 MCP 服务器。查看KubernetesManagerconfig.load_kube_config()以了解配置的加载方式。

将您的 MCP 服务器连接到 Codename Goose

通过阅读以下文档将 MCP 服务器添加为扩展: https://block.github.io/goose/docs/getting-started/using-extensions使用命令goose session --with-builtin developer --with-extension "uvx kube-mcp"启动新的 goose 会话

让一切正常运转

尝试在 Goose 中发出命令并使其使用 MCP 服务器与 Minikube 进行交互

-
security - not tested
A
license - permissive license
-
quality - not tested

MCP 服务器可以通过自然语言与 Kubernetes/Minikube 集群进行交互,从而允许 Codename Goose 等 AI 代理通过模型上下文协议管理 Kubernetes 资源。

  1. Get a Gemini APi Key
    1. Install Codename Goose
      1. Develop MCP Server
        1. Install Minikube
          1. Connect your MCP server to Codename Goose
            1. Make it all work
              ID: nzessvvgda