Logo vun Kubernetes MCP 服务器

Kubernetes MCP 服务器

Communautéit
kkb0318

https://github.com/user-attachments/assets/89df70b0-65d1-461c-b4ab-84b2087136fa

Editeurkkb0318
Repositorykubernetes-mcp
SproochGo
Forks
8
Stären
43
Disponibel Tools
0
Transporttypstdio
Kategorien
LizenzMIT
Linken
  • Tools mat KI-Workflows verbannen

    Kubernetes MCP 服务器 stellt MCP-Funktioune bereit, déi vu kompatibele KI-Clienten a KI-Agente kënne benotzt ginn.

  • 0 disponibel Tools

    Kuckt Iech déi opruffbar Aktiounen hei drënner un, mat Nimm a Beschreiwungen, wa se vum Server geliwwert ginn.

  • Konfiguratioun fir ze kopéieren

    Benotzt d'Installatiounsbeispiller, fir dëse Server an Ärem bevorzugte MCP-Client ze konfiguréieren.

  • Indicateure fir Open Source

    43 Stären an 8 Forks aus dem verlinkte Repository.

Kubernetes MCP Server

tests codecov License: MIT

https://github.com/user-attachments/assets/89df70b0-65d1-461c-b4ab-84b2087136fa

A Model Context Protocol (MCP) server that provides safe, read-only access to Kubernetes resources for debugging and inspection. Built with security in mind, it offers comprehensive cluster visibility without modification capabilities.

Features

  • 🔒 Read-only security: Safely inspect Kubernetes resources without modification capabilities
  • 🎯 CRD support: Works seamlessly with any Custom Resource Definitions in your cluster
  • 🌐 Multi-cluster support: Switch between different Kubernetes contexts seamlessly
  • 🔍 Smart discovery: Find resources by API group substring (e.g., "flux" for FluxCD, "argo" for ArgoCD)
  • ⚡ High performance: Efficient resource querying with filtering and pagination
  • 🛠️ Comprehensive toolset:
    • list_resources: List and filter Kubernetes resources with advanced options
    • describe_resource: Get detailed information about specific resources
    • get_pod_logs: Retrieve pod logs with sophisticated filtering capabilities
    • list_events: List and filter Kubernetes events for debugging and monitoring
    • list_contexts: List all available Kubernetes contexts from kubeconfig

🚀 Quick Start

Prerequisites

  • Kubernetes cluster access with a valid kubeconfig file
  • Go 1.24+ (for building from source)

Installation Options

Option 1: Install with Go (Recommended)

bash
go install github.com/kkb0318/kubernetes-mcp@latest

The binary will be available at $GOPATH/bin/kubernetes-mcp (or $HOME/go/bin/kubernetes-mcp if GOPATH is not set).

Option 2: Build from Source

bash
git clone https://github.com/kkb0318/kubernetes-mcp.git
cd kubernetes-mcp
go build -o kubernetes-mcp .

⚙️ Configuration

MCP Server Setup

Add the server to your MCP configuration:

Basic Configuration

Uses ~/.kube/config automatically:

json
{
  "mcpServers": {
    "kubernetes": {
      "command": "/path/to/kubernetes-mcp"
    }
  }
}

Custom Kubeconfig

json
{
  "mcpServers": {
    "kubernetes": {
      "command": "/path/to/kubernetes-mcp",
      "env": {
        "KUBECONFIG": "/path/to/your/kubeconfig"
      }
    }
  }
}

Note: Replace /path/to/kubernetes-mcp with your actual binary path.

Standalone Usage

bash
# Default kubeconfig (~/.kube/config)
./kubernetes-mcp

# Custom kubeconfig path
KUBECONFIG=/path/to/your/kubeconfig ./kubernetes-mcp

Important: Ensure you have appropriate read permissions for the Kubernetes resources you want to inspect.

🛠️ Available Tools

list_resources

List and filter Kubernetes resources with advanced capabilities.

ParameterTypeDescription
contextoptionalKubernetes context name from kubeconfig (leave empty for current context)
kindrequiredResource type (Pod, Deployment, Service, etc.) or "all" for discovery
groupFilteroptionalFilter by API group substring for project-specific resources
namespaceoptionalTarget namespace (defaults to all namespaces)
labelSelectoroptionalFilter by labels (e.g., "app=nginx")
fieldSelectoroptionalFilter by fields (e.g., "metadata.name=my-pod")
limitoptionalMaximum number of resources to return
timeoutSecondsoptionalRequest timeout (default: 30s)
showDetailsoptionalReturn full resource objects instead of summary

Examples:

json
// List pods with label selector
{
  "kind": "Pod",
  "namespace": "default",
  "labelSelector": "app=nginx"
}

// List pods from a specific cluster context
{
  "kind": "Pod",
  "context": "production-cluster",
  "namespace": "default"
}

// Discover FluxCD resources
{
  "kind": "all",
  "groupFilter": "flux"
}

describe_resource

Get detailed information about a specific Kubernetes resource.

ParameterTypeDescription
contextoptionalKubernetes context name from kubeconfig (leave empty for current context)
kindrequiredResource type (Pod, Deployment, etc.)
namerequiredResource name
namespaceoptionalTarget namespace

Example:

json
{
  "kind": "Pod",
  "name": "nginx-pod",
  "namespace": "default"
}

get_pod_logs

Retrieve pod logs with sophisticated filtering options.

ParameterTypeDescription
contextoptionalKubernetes context name from kubeconfig (leave empty for current context)
namerequiredPod name
namespaceoptionalPod namespace (defaults to "default")
containeroptionalSpecific container name
tailoptionalNumber of lines from the end (default: 100)
sinceoptionalDuration like "5s", "2m", "3h"
sinceTimeoptionalRFC3339 timestamp
timestampsoptionalInclude timestamps in output
previousoptionalGet logs from previous container instance

Example:

json
{
  "name": "nginx-pod",
  "namespace": "default",
  "tail": 50,
  "since": "5m",
  "timestamps": true
}

list_events

List and filter Kubernetes events with advanced filtering options for debugging and monitoring.

ParameterTypeDescription
contextoptionalKubernetes context name from kubeconfig (leave empty for current context)
namespaceoptionalTarget namespace (leave empty for all namespaces)
objectoptionalFilter by object name (e.g., pod name, deployment name)
eventTypeoptionalFilter by event type: "Normal" or "Warning" (case-insensitive)
reasonoptionalFilter by event reason (e.g., "Pulled", "Failed", "FailedScheduling")
sinceoptionalDuration like "5s", "2m", "1h"
sinceTimeoptionalRFC3339 timestamp (e.g., "2025-06-20T10:00:00Z")
limitoptionalMaximum number of events to return (default: 100)
timeoutSecondsoptionalRequest timeout (default: 30s)

Examples:

json
// List recent warning events
{
  "eventType": "Warning",
  "since": "30m"
}

// List events for a specific pod
{
  "object": "nginx-pod",
  "namespace": "default"
}

// List failed scheduling events
{
  "reason": "FailedScheduling",
  "limit": 50
}

list_contexts

List all available Kubernetes contexts from your kubeconfig file.

Parameters: None - this tool takes no parameters.

Example Response:

json
{
  "contexts": [
    {
      "name": "production-cluster",
      "is_current": false
    },
    {
      "name": "staging-cluster", 
      "is_current": true
    },
    {
      "name": "development-cluster",
      "is_current": false
    }
  ],
  "current_context": "staging-cluster",
  "total": 3
}

Use Case: Perfect for multi-cluster workflows where you need to:

  • Discover available Kubernetes contexts
  • Identify the current active context
  • Plan operations across multiple clusters

🌟 Advanced Features

🌐 Multi-Cluster Support

Seamlessly work with multiple Kubernetes clusters using context switching:

  • Context Parameter: All tools now support an optional context parameter to specify which cluster to query
  • Automatic Discovery: Uses your existing kubeconfig file and automatically discovers available contexts
  • Default Context: When no context is specified, uses the current context from your kubeconfig
  • Cached Connections: Efficiently manages connections to multiple clusters with connection caching

Multi-cluster Examples:

json
// Query production cluster
{
  "kind": "Pod",
  "context": "production-cluster",
  "namespace": "default"
}

// Get logs from staging environment
{
  "name": "api-server",
  "context": "staging-cluster",
  "namespace": "api"
}

// Compare resources across environments (use multiple calls)
{
  "kind": "Deployment",
  "context": "production-cluster",
  "namespace": "app"
}

🎯 Custom Resource Definition (CRD) Support

Automatically discovers and works with any CRDs in your cluster. Simply use the CRD's Kind name with list_resources or describe_resource tools.

🔍 Smart Resource Discovery

Use the groupFilter parameter to discover resources by API group substring:

FilterDiscoversExamples
"flux"FluxCD resourcesHelmReleases, Kustomizations, GitRepositories
"argo"ArgoCD resourcesApplications, AppProjects, ApplicationSets
"istio"Istio resourcesVirtualServices, DestinationRules, Gateways
"cert-manager"cert-manager resourcesCertificates, Issuers, ClusterIssuers

🔒 Security & Safety

Built with security as a primary concern:

  • ✅ Read-only access - No resource creation, modification, or deletion
  • ✅ Production safe - Secure for use in production environments
  • ✅ Minimal permissions - Only requires read access to cluster resources
  • ✅ No destructive operations - Cannot harm your cluster

🤝 Contributing

We welcome contributions! Please ensure all changes maintain the read-only nature of the server and include appropriate tests.

📄 License

This project is licensed under the MIT License - see the LICENSE file for details.

Installatioun

TypingMind
{
  "mcpServers": {
    "kubernetes-mcp": {
      "command": "kubernetes-mcp",
      "args": []
    }
  }
}

Kubernetes MCP 服务器 MCP mat verschiddene KI-Modeller benotzen

TypingMind verbënnt MCP-Tools um Niveau vum Aarbechtsberäich. Soubal Kubernetes MCP 服务器 verbonnen ass, kënnt Dir et mat verschiddene KI-Modeller an TypingMind benotzen, amplaz et fir all Modell separat anzeriichten. Dës MCP-Integratioun leeft lokal iwwer den TypingMind-MCP-Connector op Ärem Apparat.

Ariichtungsuleedung fir de lokale Connector ze benotzen

Benotzt dës Optioun, wann den MCP-Server Zougrëff op lokal Fichieren, Appen oder privat Ressourcen op Ärem Computer brauch.

1

D'MCP-Astellungen opmaachen

Gitt an TypingMind op „Astellungen“, „Erweidert Astellungen“, dann op „Model Context Protocol“ a wielt „Connector ariichten“.

  1. Maacht TypingMind an Ärem Browser op.
  2. Klickt op d'Astellungssymbol.
  3. Gitt op „Erweidert Astellungen“.
  4. Maacht d'Sektioun „Model Context Protocol“ op.
  5. Klickt op „Connector ariichten“ a wielt „Dësen Apparat“.
Ariichtungsbildschierm vum TypingMind-MCP-Connector mat „Dësen Apparat“ ausgewielt
2

De Connector-Befeel ausféieren

Wielt „Dësen Apparat“, kopéiert de Befeel aus TypingMind a féiert en am Terminal aus. Loosst de Prozess lafen, wärend Dir MCP benotzt.

  1. Kopéiert den Ariichtungsbefeel, deen TypingMind uweist.
  2. Maacht Terminal op macOS oder Windows Terminal op Windows op.
  3. Pescht de Befeel an a féiert en aus.
  4. Bestätegt d'Installatioun vum Package, wann den Terminal Iech freet, ob Dir weiderfuere wëllt.
  5. Loosst den Terminal an de Prozess doranner lafen, wärend Dir MCP-Tools benotzt.
3

Kubernetes MCP 服务器 als Server derbäisetzen

Wann de Connector-Status „Prett“ ass, klickt op „Serveren änneren“ a pescht d'MCP-Serverkonfiguratioun an.

  1. Waart, bis de Connector-Status „Prett“ weist.
  2. Klickt op „Serveren änneren“.
  3. Pescht d'MCP-Serverkonfiguratioun vu Kubernetes MCP 服务器 an.
  4. Späichert d'Serverlëscht.
  5. Aktualiséiert, wann Dir kontrolléiere wëllt, ob de Connector nach ëmmer prett ass.
MCP-Astellunge vun TypingMind mat aktivem Server an dem Knäppchen „Serveren änneren“
{
  "mcpServers": {
    "kubernetes-mcp": {
      "command": "npx",
      "args": [
        "-y",
        "<mcp-server-package>"
      ]
    }
  }
}
4

D'Verbindung mat verschiddene Modeller benotzen

Späichert d'Serverlëscht, maacht „Plugins“ op an aktivéiert d'MCP-Tools vu Kubernetes MCP 服务器. Wielt dann e belibegen ënnerstëtzte KI-Modell an TypingMind a benotzt d'Tools am Chat oder weist se engem KI-Agent zou.

  1. Maacht d'Säit „Plugins“ an TypingMind op.
  2. Aktivéiert d'MCP-Tools vu Kubernetes MCP 服务器.
  3. Start e Chat a wielt de KI-Modell, deen Dir benotze wëllt.
  4. Benotzt d'MCP-Tools am Chat oder weist se engem KI-Agent zou.
  5. Wiesselt bei Bedarf op en anere KI-Modell, ouni MCP nei ze verbannen.
TypingMind-Chat mat aktivéierte MCP-Tools an engem ausgewielte KI-Modell
Hëlleft Dir mir bei dëser Aufgab mat Kubernetes MCP 服务器?
Kubernetes MCP 服务器
Jo. Ech hunn et gelies.
Dat hunn ech mat Kubernetes MCP 服务器 fonnt.

Heefeg gestallte Froen

Fir wat gëtt de MCP-Server Kubernetes MCP 服务器 benotzt?

Kubernetes MCP 服务器 ass e MCP-Server, deen et kompatibele KI-Clienten erlaabt, sech mat externen Tools a Kontext ze verbannen. An TypingMind kënnt Dir dëse MCP-Server eemol derbäisetzen a seng Tools an Ärem KI-Aarbechtsberäich zur Verfügung stellen.

Kann ech Kubernetes MCP 服务器 MCP mat méi KI-Modeller an TypingMind benotzen?

Jo. TypingMind verbënnt MCP-Tools um Niveau vum Aarbechtsberäich. Sou kënnt Dir Kubernetes MCP 服务器 mat verschiddene KI-Modeller wéi Claude, ChatGPT, Gemini oder anere Modeller benotzen, déi Dir an TypingMind konfiguréiert hutt, ouni de MCP-Server fir all Modell separat anzeriichten.

Firwat Kubernetes MCP 服务器 MCP mat TypingMind benotzen?

TypingMind ass eng vun de beschte Benotzeruewerfläche fir LLM-Chat, well et méi KI-Modeller, Prompts, Plugins, KI-Agenten, API-Schlësselen a MCP-Tools an engem Aarbechtsberäich zesummebréngt. Wann Kubernetes MCP 服务器 verbonnen ass, kënnt Dir seng MCP-Tools mat Äre bevorzugte Modeller benotzen a gläichzäiteg Är Chataarbecht an TypingMind organiséieren.

Wéi verbannen ech Kubernetes MCP 服务器 MCP mat TypingMind?

Kubernetes MCP 服务器 leeft iwwer de lokale MCP-Connector vun TypingMind. Dat eegent sech am beschten, wann de MCP-Server Zougrëff op lokal Fichieren, Desktop-Apps, Kommandozeilen-Tools oder privat Ressourcen op Ärem Computer brauch.

Wéi eng Tools stellt Kubernetes MCP 服务器 MCP an TypingMind zur Verfügung?

Kubernetes MCP 服务器 stellt MCP-Funktiounen zur Verfügung, déi Dir op der Plugins-Säit vun TypingMind aktivéiere kënnt, fir se am Chat ze benotzen oder KI-Agenten zouzeweisen.

Muss ech meng API-Schlëssele mat TypingMind deelen, fir Kubernetes MCP 服务器 MCP ze benotzen?

Nee. TypingMind setzt op lokal Veraarbechtung a léisst Iech d'Kontroll iwwer Är Modellubidder, API-Schlësselen, Prompts a MCP-Konfiguratioun. Wann Kubernetes MCP 服务器 eng Authentifizéierung verlaangt, setzt déi néideg Headeren, OAuth-Astellungen oder lokal Konfiguratioun fir dee MCP-Server derbäi, wann Dir d'Verbindung erstallt.

Änlech MCP-Serveren

All weisen

Elo Ären eegene KI-Workspace ariichten

Abonnéiert Iech op eisen Newsletter, fir iwwer nei Funktiounen an zukünfteg Gewënnspiller informéiert ze ginn 👇