Kubernetes MCP Server

by kkb0318

Not rated yet

About

Provides safe, read-only access to Kubernetes cluster resources for debugging and inspection.

Explore

Setup

Install Kubernetes MCP Server in your MCP client (Claude Desktop, Cursor, Windsurf, and others).

Repository: https://github.com/kkb0318/kubernetes-mcp

Follow the installation instructions in the repository README, then restart your MCP client.

Provides safe, read-only access to Kubernetes cluster resources for debugging and inspection.

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.

- 🔒 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

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

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

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

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

Add the server to your MCP configuration:

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

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

# 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.

List and filter Kubernetes resources with advanced capabilities.

// 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" }

Get detailed information about a specific Kubernetes resource.

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

Retrieve pod logs with sophisticated filtering options.

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

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

// 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 all available Kubernetes contexts from your kubeconfig file.

Parameters:None - this tool takes no parameters.

{ "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

Seamlessly work with multiple Kubernetes clusters using context switching:

- Context Parameter: All tools now support an optionalcontextparameter 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

// 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 withlist_resourcesordescribe_resourcetools.

Use thegroupFilterparameter to discover resources by API group substring:

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

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

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

Inspect and debug Kubernetes clusters with read-only access to resources, CRDs, and pod logs.

Query and interact with kubernetes environments monitored by Metoro

A server for Kubernetes CLI tools like kubectl, istioctl, helm, and argocd, supporting multi-cluster management via dynamic kubeconfig.

An MCP server for kubectl, enabling AI assistants to interact with Kubernetes clusters through a standardized protocol.

A read-only MCP server for retrieving information and diagnosing issues in Kubernetes clusters.

Execute Kubernetes commands using kubectl from any MCP-compatible client. Requires a valid kubeconfig file.

A server for managing Kubernetes clusters using the Model Context Protocol.

Operate a k3s / Kubernetes cluster from your AI agent — health, logs, and guarded restart/scale/delete; safe by default with a read-only switch and namespace allowlist.

Manage and interact with Microsoft Azure services.

No reviews yet — be the first

Sign in to leave a review

Use Google, GitHub, or an email account so ratings stay tied to real people.

Email sign in

No reviews posted yet.