HK

hsn0918/kubernetes-mcp

Developer tools

이 페이지는 AI로 자동 번역되었습니다. 기술적인 세부 사항은 원문을 확인하세요. 원문 보기

30 stars 3 forks 품질 56 트렌드 11Apache-2.0

A Kubernetes-focused Model Context Protocol (MCP) server built in Go. It exposes Kubernetes operations as MCP tools and supports stdio, sse, and streamable transports.

개요

A Kubernetes-focused Model Context Protocol (MCP) server built in Go. It exposes Kubernetes operations as MCP tools and supports stdio, sse, and streamable transports. - Unified MCP interface for Kubernetes operations - Works with both local kubeconfig and in-cluster configuration - Multiple transports for different integration modes - Generic resource CRUD + utility tools + prompts + metrics - slog-based logging with configurable level/format - Go 1.24+ - Access to a Kubernetes cluster - via --kubeconfig, or - via in-cluster service account - --log-level (debug|info|warn|error, default info) - --log-format (console|json, default console) - --kubeconfig (optional) Network transport flags (sse, streamable): - --port (default 8080) - --health-port (default 8081) - --allow-origins (default *) - --base-url (default http://localhost: ) - StreamableHTTP MCP endpoint: POST /mcp - Health endpoints (SSE/Streamable only): - GET /healthz - GET /readyz

README

원문 README의 일부입니다. 원문 보기.

Kubernetes MCP

English | 中文

A Kubernetes-focused Model Context Protocol (MCP) server built in Go. It exposes Kubernetes operations as MCP tools and supports stdio, sse, and streamable transports.

Why This Project

  • Unified MCP interface for Kubernetes operations
  • Works with both local kubeconfig and in-cluster configuration
  • Multiple transports for different integration modes
  • Generic resource CRUD + utility tools + prompts + metrics
  • slog-based logging with configurable level/format

Requirements

  • Go 1.24+
  • Access to a Kubernetes cluster
    • via --kubeconfig, or
    • via in-cluster service account

Quick Start

Build

git clone https://github.com/HSn0918/kubernetes-mcp.git
cd kubernetes-mcp
go build -o kubernetes-mcp ./cmd/kubernetes-mcp

Run (stdio)

./kubernetes-mcp server transport stdio --kubeconfig ~/.kube/config

Run (SSE)

./kubernetes-mcp server transport sse \
  --port 8080 \
  --health-port 8081 \
  --allow-origins "*" \
  --base-url "http://localhost:8080" \
  --kubeconfig ~/.kube/config

Run (StreamableHTTP)

./kubernetes-mcp server transport streamable \
  --port 8080 \
  --health-port 8081 \
  --allow-origins "*" \
  --kubeconfig ~/.kube/config

CLI Structure

kubernetes-mcp
├── server
│   └── transport
│       ├── stdio
│       ├── sse
│       └── streamable
└── version

Configuration Flags

Global flags:

  • --log-level (debug|info|warn|error, default info)
  • --log-format (console|json, default console)
  • --kubeconfig (optional)

Network transport flags (sse, streamable):

  • --port (default 8080)
  • --health-port (default 8081)
  • --allow-origins (default *)

SSE-only flags:

  • --base-url (default http://localhost:)

Transport Endpoints

  • StreamableHTTP MCP endpoint: POST /mcp
  • Health endpoints (SSE/Streamable only):
    • GET /healthz
    • GET /readyz

Tooling Overview

1. Generic Resource Operations

For each API group prefix, the server exposes:

  • LIST__RESOURCES
  • GET__RESOURCE
  • DESCRIBE__RESOURCE
  • CREATE__RESOURCE
  • UPDATE__RESOURCE
  • DELETE__RESOURCE

Registered prefixes:

  • K8S

2. Core/Cluster Utilities

  • LIST_NAMESPACES
  • LIST_NODES
  • GET_POD_LOGS
  • ANALYZE_POD_LOGS

3. Utility Tools

  • GET_CURRENT_TIME
  • GET_CLUSTER_INFO
  • GET_API_RESOURCES
  • SEARCH_RESOURCES
  • EXPLAIN_RESOURCE
  • APPLY_MANIFEST
  • VALIDATE_MANIFEST
  • DIFF_MANIFEST
  • GET_EVENTS

4. Prompt Tools

  • KUBERNETES_YAML_PROMPT
  • KUBERNETES_QUERY_PROMPT
  • TROUBLESHOOT_PODS_PROMPT
  • TROUBLESHOOT_NODES_PROMPT
  • TROUBLESHOOT_NETWORK_PROMPT

5. Metrics Tools

  • GET_NODE_METRICS
  • GET_POD_METRICS
  • GET_RESOURCE_METRICS
  • GET_TOP_CONSUMERS
GitHub에서 전체 README 보기

설치

docker run --rm -it \
MCP 초보자라면? mcpskill.org 가이드부터 시작하세요 →