Logo di Kubernetes MCP 服务器

Kubernetes MCP 服务器

Community
kkb0318

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

Autorekkb0318
Repositorykubernetes-mcp
LinguaGo
Fork
8
Stelle
43
Strumenti disponibili
0
Tipo di trasportostdio
Categorie
LicenzaMIT
Link
  • Collega gli strumenti ai flussi di lavoro IA

    Kubernetes MCP 服务器 mette a disposizione funzionalità MCP utilizzabili da client e agenti IA compatibili.

  • 0 strumenti disponibili

    Esplora le azioni richiamabili qui sotto, con nomi e descrizioni quando forniti dal server.

  • Configurazione pronta da copiare

    Usa gli esempi di installazione per configurare questo server nel tuo client MCP preferito.

  • Indicatori di interesse open source

    43 stelle e 8 fork nel repository collegato.

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.

Installazione

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

Usa MCP Kubernetes MCP 服务器 con più modelli IA

TypingMind collega gli strumenti MCP a livello di area di lavoro: una volta connesso Kubernetes MCP 服务器, puoi usarlo con diversi modelli IA in TypingMind, senza configurarlo separatamente per ogni modello. Questa integrazione MCP viene eseguita localmente sul tuo dispositivo tramite il connettore MCP di TypingMind.

Guida alla configurazione del connettore locale

Usa questo metodo quando il server MCP deve accedere a file locali, app o risorse private sul tuo computer.

1

Apri le impostazioni MCP

In TypingMind, vai su Impostazioni, Impostazioni avanzate, poi su Model Context Protocol e scegli Configura MCP.

  1. Apri TypingMind nel tuo browser.
  2. Fai clic sull'icona Impostazioni.
  3. Vai a Impostazioni avanzate.
  4. Apri la sezione Model Context Protocol.
  5. Fai clic su Configura MCP e scegli Questo dispositivo.
Schermata di configurazione del connettore MCP di TypingMind con Questo dispositivo selezionato
2

Esegui il comando del connettore

Scegli Questo dispositivo, copia il comando da TypingMind ed eseguilo nel terminale. Lascia il processo in esecuzione mentre usi MCP.

  1. Copia il comando di configurazione mostrato da TypingMind.
  2. Apri Terminale su macOS o Windows Terminal su Windows.
  3. Incolla ed esegui il comando.
  4. Conferma l'installazione del pacchetto se il terminale ti chiede di procedere.
  5. Tieni aperta la finestra del terminale con il processo in esecuzione mentre usi gli strumenti MCP.
3

Aggiungi Kubernetes MCP 服务器 come server

Quando lo stato del connettore è Pronto, fai clic su Modifica server e incolla la configurazione del server MCP.

  1. Attendi che lo stato del connettore sia Pronto.
  2. Fai clic su Modifica server.
  3. Incolla la configurazione del server MCP di Kubernetes MCP 服务器.
  4. Salva l'elenco dei server.
  5. Aggiorna per verificare che il connettore sia ancora pronto.
Impostazioni MCP di TypingMind con un server attivo e il pulsante Modifica server
{
  "mcpServers": {
    "kubernetes-mcp": {
      "command": "npx",
      "args": [
        "-y",
        "<mcp-server-package>"
      ]
    }
  }
}
4

Usa la connessione con diversi modelli

Salva l'elenco dei server, apri Plugin, abilita gli strumenti MCP di Kubernetes MCP 服务器, poi seleziona un modello IA supportato in TypingMind e usa gli strumenti in chat o assegnali a un agente IA.

  1. Apri la pagina Plugin in TypingMind.
  2. Abilita gli strumenti MCP di Kubernetes MCP 服务器.
  3. Avvia una chat e scegli il modello IA che vuoi usare.
  4. Usa gli strumenti MCP in chat o assegnali a un agente IA.
  5. Passa a un altro modello IA quando serve, senza riconnettere MCP.
Chat di TypingMind che usa gli strumenti MCP abilitati con un modello IA selezionato
Puoi usare Kubernetes MCP 服务器 per aiutarmi con questa attività?
Kubernetes MCP 服务器
Certo. Ho letto.
Ecco cosa ho trovato con Kubernetes MCP 服务器.

Domande frequenti

A cosa serve il server MCP Kubernetes MCP 服务器?

Kubernetes MCP 服务器 è un server MCP che consente ai client IA compatibili di accedere a strumenti e informazioni di contesto esterni. In TypingMind puoi aggiungere questo server MCP una sola volta e rendere disponibili i suoi strumenti nella tua area di lavoro IA.

Posso usare Kubernetes MCP 服务器 MCP con più modelli IA in TypingMind?

Sì. TypingMind collega gli strumenti MCP a livello di area di lavoro, quindi puoi usare Kubernetes MCP 服务器 con diversi modelli IA come Claude, ChatGPT, Gemini o altri modelli che hai configurato in TypingMind, senza dover configurare il server MCP separatamente per ogni modello.

Perché usare il connettore MCP Kubernetes MCP 服务器 con TypingMind?

TypingMind è una delle migliori interfacce per chattare con gli LLM perché riunisce più modelli IA, prompt, plugin, agenti IA, chiavi API e strumenti MCP in un'unica area di lavoro. Collegando Kubernetes MCP 服务器, puoi usare i suoi strumenti MCP con i tuoi modelli preferiti e mantenere organizzato il tuo flusso di lavoro in chat su TypingMind.

Come collego Kubernetes MCP 服务器 MCP a TypingMind?

Kubernetes MCP 服务器 funziona tramite il connettore MCP locale di TypingMind. È la soluzione ideale quando il server MCP deve accedere a file locali, app desktop, strumenti da riga di comando o risorse private sul tuo computer.

Quali strumenti offre Kubernetes MCP 服务器 MCP in TypingMind?

Kubernetes MCP 服务器 mette a disposizione funzionalità MCP che puoi attivare dalla pagina Plugin di TypingMind e usare in chat o assegnare agli agenti IA.

Devo condividere le mie chiavi API con TypingMind per usare Kubernetes MCP 服务器 MCP?

No. TypingMind privilegia il funzionamento in locale e ti permette di mantenere il controllo su fornitori di modelli, chiavi API, prompt e configurazione MCP. Se Kubernetes MCP 服务器 richiede l'autenticazione, aggiungi le intestazioni, le impostazioni OAuth o la configurazione locale necessarie per quel server MCP quando crei la connessione.

Server MCP correlati

Vedi tutti

Crea subito la tua area di lavoro IA

Iscriviti alla nostra newsletter per ricevere aggiornamenti sulle nuove funzionalità e sulle prossime iniziative a premi 👇