mcp-server-kubernetes
MCP-сервер Kubernetes
Сервер MCP, который может подключаться к кластеру Kubernetes и управлять им.
https://github.com/user-attachments/assets/f25f8f4e-4d04-479b-9ae0-5dac452dd2ed
Использование с Claude Desktop
{
"mcpServers": {
"kubernetes": {
"command": "npx",
"args": ["mcp-server-kubernetes"]
}
}
}Сервер автоматически подключится к вашему текущему контексту kubectl. Убедитесь, что у вас есть:
kubectl установлен и находится в вашем PATH
Действительный файл kubeconfig с настроенными контекстами
Доступ к кластеру Kubernetes, настроенному для kubectl (например, minikube, Rancher Desktop, GKE и т. д.)
Helm v3 установлен и находится в PATH (Tiller не требуется). Необязательно, если вы не планируете использовать Helm.
Вы можете проверить свое подключение, попросив Клода составить список ваших модулей или создать тестовое развертывание.
Если у вас возникли ошибки, откройте стандартный терминал и запустите kubectl get pods чтобы проверить, сможете ли вы подключиться к своему кластеру без проблем с учетными данными.
Related MCP server: mcp-server-kubernetes
Использование с mcp-chat
mcp-chat — это CLI-чат-клиент для серверов MCP. Вы можете использовать его для взаимодействия с сервером Kubernetes.
npx mcp-chat --server "npx mcp-server-kubernetes"Либо передайте ему существующий файл конфигурации Claude Desktop, указанный выше (Linux должен передать правильный путь к config):
Мак:
npx mcp-chat --config "~/Library/Application Support/Claude/claude_desktop_config.json"Окна:
npx mcp-chat --config "%APPDATA%\Claude\claude_desktop_config.json"Функции
[x] Подключиться к кластеру Kubernetes
[x] Список всех модулей, служб, развертываний
[x] Список, описание узлов
[x] Создать, описать, удалить модуль
[x] Список всех пространств имен, создание пространства имен
[x] Создание пользовательских конфигураций модулей и развертывания, обновление реплик развертывания
[x] Создать, описать, удалить, обновить услугу
[x] Создать, получить, обновить, удалить ConfigMap
[x] Получение журналов из модуля для отладки (поддерживает модули, развертывания, задания и селекторы меток)
[x] Поддержка Helm v3 для установки диаграмм
Установить диаграммы с пользовательскими значениями
Удаление релизов
Обновите существующие версии
Поддержка пространств имен
Поддержка спецификации версии
Поддержка пользовательских репозиториев
[x] kubectl Explain и поддержка kubectl API-ресурсов
[x] Получить события Kubernetes из кластера
[x] Переадресация порта на модуль или службу
[x] Создание, перечисление и описание cronjobs
[x] Неразрушающий режим для доступа к кластерам только для чтения и создания/обновления
Местное развитие
Убедитесь, что у вас установлен bun . Клонируйте репозиторий и установите зависимости:
git clone https://github.com/Flux159/mcp-server-kubernetes.git
cd mcp-server-kubernetes
bun installРабочий процесс разработки
Запустить сервер в режиме разработки (отслеживает изменения файлов):
bun run devЗапуск модульных тестов:
bun run testСоздайте проект:
bun run buildЛокальное тестирование с инспектором
npx @modelcontextprotocol/inspector node dist/index.js
# Follow further instructions on terminal for Inspector linkЛокальное тестирование с помощью Claude Desktop
{
"mcpServers": {
"mcp-server-kubernetes": {
"command": "node",
"args": ["/path/to/your/mcp-server-kubernetes/dist/index.js"]
}
}
}Локальное тестирование с mcp-chat
bun run chatВнося вклад
Подробности смотрите в файле CONTRIBUTING.md .
Передовой
Дополнительные расширенные функции
Более подробную информацию, например, об использовании транспорта SSE и неразрушающем режиме с ALLOW_ONLY_NON_DESTRUCTIVE_TOOLS , см. в файле ADVANCED_README.md .
Архитектура
Более подробный обзор архитектуры, созданный Девином, можно найти по этой ссылке DeepWiki .
В этом разделе описывается высокоуровневая архитектура сервера MCP Kubernetes.
Запрос потока
Приведенная ниже диаграмма последовательности иллюстрирует, как запросы проходят через систему:
sequenceDiagram
participant Client
participant Transport as StdioTransport
participant Server as MCP Server
participant Handler as Request Handler
participant K8sManager as KubernetesManager
participant K8s as Kubernetes API
Client->>Transport: Send Request via STDIO
Transport->>Server: Forward Request
alt Tools Request
Server->>Handler: Route to tools handler
Handler->>K8sManager: Execute tool operation
K8sManager->>K8s: Make API call
K8s-->>K8sManager: Return result
K8sManager-->>Handler: Process response
Handler-->>Server: Return tool result
else Resource Request
Server->>Handler: Route to resource handler
Handler->>K8sManager: Get resource data
K8sManager->>K8s: Query API
K8s-->>K8sManager: Return data
K8sManager-->>Handler: Format response
Handler-->>Server: Return resource data
end
Server-->>Transport: Send Response
Transport-->>Client: Return Final ResponseПубликация нового релиза
Перейдите на страницу релизов , нажмите «Черновик нового релиза», нажмите «Выбрать тег» и создайте новый тег, введя новый номер версии, используя формат semver «v{major}.{minor}.{patch}». Затем напишите название релиза «Выпуск v{major}.{minor}.{patch}» и описание/журнал изменений, если необходимо, и нажмите «Опубликовать релиз».
Это создаст новый тег, который запустит новую сборку релиза через рабочий процесс cd.yml. После успешного выполнения новый релиз будет опубликован в npm . Обратите внимание, что нет необходимости вручную обновлять версию package.json, поскольку рабочий процесс автоматически обновит номер версии в файле package.json и отправит коммит в main.
Не планируется
Аутентификация/добавление кластеров в kubectx.
Available Tools
17 toolsexplain_resourceBRead-only
Get documentation for a Kubernetes resource or field
Inputs: resource (required), output, context, recursive, +1 more.
install_helm_chartBDestructive
Install a Helm chart with support for both standard and template-based installation
Inputs: name (required), chart (required), namespace (required), repo, +5 more.
kubectl_applyADestructive
Apply a Kubernetes YAML manifest from a string or file
Inputs: force, dryRun, context, filename, +2 more.
kubectl_contextBIdempotent
Manage Kubernetes contexts - list, get, or set the current context
Inputs: operation (required), name, output, detailed, +1 more.
kubectl_createB
Create Kubernetes resources using various methods (from file or using subcommands)
Inputs: name, port, image, dryRun, +19 more.
kubectl_describeARead-only
Describe Kubernetes resources by resource type, name, and optionally namespace
Inputs: name (required), resourceType (required), context, namespace, +1 more.
kubectl_getARead-only
Get or list Kubernetes resources by resource type, name, and optionally namespace
Inputs: resourceType (required), name, output, sortBy, +5 more.
kubectl_logsBRead-only
Get logs from Kubernetes resources like pods, deployments, or jobs
Inputs: name (required), namespace (required), resourceType (required), tail, +8 more.
kubectl_patchCDestructive
Update field(s) of a resource using strategic merge patch, JSON merge patch, or JSON patch
Inputs: name (required), resourceType (required), dryRun, context, +4 more.
kubectl_reconnectA
Reconnect to the Kubernetes API server by recreating all API clients. Use this after cluster upgrades (e.g., EKS control plane upgrades that rotate ENIs/IPs) to force fresh DNS resolution and new TCP connections.
Inputs: no named parameters.
kubectl_rolloutBDestructive
Manage the rollout of a resource (e.g., deployment, daemonset, statefulset)
Inputs: name (required), namespace (required), subCommand (required), resourceType (required), +5 more.
kubectl_scaleBDestructive
Scale a Kubernetes deployment
Inputs: name (required), replicas (required), context, namespace, +1 more.
list_api_resourcesCRead-only
List the API resources available in the cluster
Inputs: verbs, output, context, apiGroup, +1 more.
pingARead-only
Verify that the counterpart is still responsive and the connection is alive.
Inputs: no named parameters.
port_forwardC
Forward a local port to a port on a Kubernetes resource
Inputs: localPort (required), targetPort (required), resourceName (required), resourceType (required), +1 more.
stop_port_forwardD
Stop a port-forward process
Inputs: id (required).
upgrade_helm_chartCDestructive
Upgrade an existing Helm chart release
Inputs: name (required), chart (required), namespace (required), repo, +3 more.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 17 tools
Most tools target clearly distinct Kubernetes actions and resources, such as get vs describe, scale vs rollout, and port_forward vs stop_port_forward. The main overlap is kubectl_create vs kubectl_apply, since both can create or update resources from manifests, but their descriptions give enough guidance to distinguish typical use.
The set is readable and mostly uses snake_case action-oriented names, but the kubectl_ prefix is inconsistently applied across otherwise Kubernetes-related tools. For example, kubectl_get and kubectl_apply coexist with explain_resource, install_helm_chart, port_forward, and list_api_resources.
Seventeen tools is reasonable for a Kubernetes management server covering core resource, rollout, Helm, and connectivity workflows. A few tools like ping and kubectl_reconnect are auxiliary, but they support operational reliability rather than bloating the surface excessively.
The server covers create/apply, read, describe, patch, logs, scale, rollout, contexts, Helm install/upgrade, and port forwarding. However, there is no delete tool for Kubernetes resources, which is a notable lifecycle gap, and Helm coverage lacks list/uninstall operations.
Maintenance
Related MCP Connectors
Deploy and operate Kubernetes: clusters, stacks, apps, logs, metrics and security, with OAuth.
Deploy applications and manage governed Kubernetes preview spaces and capacity.
Manage Kubernetes clusters, deployments, databases, secrets and observability on Mengi Cloud.
Deploy and manage applications, databases and storage on Helm7.
Related MCP Servers
- AlicenseAqualityDmaintenanceEnables AI agents to interact with Kubernetes clusters through progressive disclosure, where agents discover TypeScript modules via filesystem, write and execute code, and receive summarized console output for cluster management tasks.27 npm2MIT
- AlicenseBqualityDmaintenanceEnables connection to a Kubernetes cluster to list and manage pods, services, deployments, and nodes, create/delete/describe pods, inspect namespaces, and retrieve logs for debugging.11MIT
- AlicenseBqualityDmaintenanceEnables connecting to a Kubernetes cluster to manage it, including listing pods, services, deployments, nodes, and namespaces, creating and deleting pods, describing pods, and retrieving logs for debugging.11MIT
- AlicenseBqualityDmaintenanceConnects to a Kubernetes cluster through the current kubectl context and enables listing, creating, deleting, and describing pods, services, deployments, nodes, and namespaces, plus retrieving logs for debugging.11MIT