K8s Lens

v0.1.0
io.github.firas-mcp-servers/k8s-lens-mcp Checked 5 hours ago Published 6 months ago

MCP server for natural-language Kubernetes operations across single or multi-cluster environments.

These tools were reported by the server itself during our smoke test (tools/list), not copied from the README.

health

Check the server health and connectivity to the Kubernetes cluster. Returns the server status, configured context, and default namespace.

get_resources

Query Kubernetes resources with flexible filters. Supports pods, deployments, services, nodes, and more. Filter by namespace, status, labels, or field selectors. Example prompts: 'Show me all pods with status CrashLoopBackOff in namespace staging', 'List all deployments in the default namespace', 'Get nodes with label zone=us-east-1'.

ParameterTypeDescription
resource_type *stringResource type, e.g. 'pods', 'deployments', 'services', 'nodes'
contextsarrayKubernetes contexts to query. If empty, uses the default context.
field_selectorRaw field selector string
labelsLabel selector as key-value pairs
limitintegerMaximum results to return
namespaceNamespace to query. Omit for all namespaces.
statusFilter by status phase, e.g. 'Running', 'Pending', 'CrashLoopBackOff'

analyze_pod

Perform deep root-cause analysis on a failing or misbehaving pod. Correlates pod status, recent events, container logs, resource limits, and node conditions to diagnose the issue. Example prompts: 'Why is my-pod failing?', 'Why does my-pod keep restarting?', 'Diagnose pod my-pod in namespace production'.

ParameterTypeDescription
pod_name *stringName of the pod to analyze
containerSpecific container for multi-container pods
namespacePod namespace
tail_linesintegerNumber of log lines to fetch

compare_deployments

Diff two Kubernetes resources (e.g., Deployments) across namespaces or clusters. Strips volatile metadata (UIDs, resourceVersions, timestamps) and returns a structured diff showing added, removed, and changed fields. Example prompts: 'Diff the nginx deployment between staging and prod', 'Compare the api deployment in dev vs production'.

ParameterTypeDescription
name *stringName of the resource
namespace_a *stringNamespace of first resource
namespace_b *stringNamespace of second resource
context_aContext for first resource
context_bContext for second resource
resource_kindstringKind of resource to diff

generate_manifest

Generate best-practice Kubernetes YAML manifests from a natural language description. Supports Deployments, Services, Ingresses, and ConfigMaps. Returns valid, ready-to-apply YAML with sensible defaults for replicas, resource requests, probes, and labels. Example prompts: 'Create a basic nginx deployment with 2 replicas and a LoadBalancer service', 'Generate a Redis deployment with a ClusterIP service on port 6379'.

ParameterTypeDescription
description *stringNatural language description of desired resources
kindSpecific kind: Deployment, Service, Ingress, ConfigMap
namespaceTarget namespace

compare_helm_releases

Diff Helm releases across namespaces or clusters. Compares rendered manifests and values to detect drift. Example prompts: 'Diff the nginx Helm release between staging and prod', 'Compare the api release values in dev vs production'.

ParameterTypeDescription
namespace_a *stringNamespace of first release
namespace_b *stringNamespace of second release
release_name *stringName of the Helm release to compare
context_aContext for first release
context_bContext for second release

advise_resources

Scan the cluster for resource optimization opportunities. Identifies idle pods, over-provisioned CPU/memory, missing HPAs, and orphaned PVCs. Example prompts: 'Find waste in the cluster', 'Which pods are over-provisioned?', 'Show me idle resources'.

ParameterTypeDescription
namespaceNamespace to scope to. Omit for all namespaces.