home / mcp / kubectl-mcp-server mcp server

kubectl-mcp-server MCP Server

A Model Context Protocol (MCP) server for Kubernetes. Install: npx kubectl-mcp-server or pip install kubectl-mcp-server

Installation
Add the following to your MCP client configuration file.

Configuration

View docs
{
  "mcpServers": {
    "rohitg00-kubectl-mcp-server": {
      "command": "npx",
      "args": [
        "-y",
        "kubectl-mcp-server"
      ],
      "env": {
        "MCP_DEBUG": "false",
        "KUBECONFIG": "$HOME/.kube/config",
        "MCP_LOG_FILE": "/var/log/mcp.log",
        "MCP_AUTH_ISSUER": "https://idp.example.com",
        "MCP_AUTH_ENABLED": "true",
        "MCP_AUTH_AUDIENCE": "kubectl-mcp-server",
        "MCP_AUTH_JWKS_URI": "https://idp.example.com/.well-known/jwks.json",
        "MCP_BROWSER_ENABLED": "false",
        "MCP_AUTH_REQUIRED_SCOPES": "mcp:tools"
      }
    }
  }
}

You can control and automate your Kubernetes infrastructure through natural language conversations with an AI assistant using kubectl-mcp-server. This server translates your spoken or typed requests into kubectl actions, enabling pod debugging, deployments, cost optimization, security audits, Helm operations, and dashboards without memorizing commands.

How to use

You interact with a compatible AI assistant to manage clusters. Start conversations like: ask why a pod is crashing, deploy a service, optimize costs, audit security, or view dashboards. The MCP server handles translating your natural language requests into Kubernetes operations, returning results, metrics, and actionable guidance.

How to install

Choose a convenient way to run the MCP server on your machine or in your environment. You can run directly without installation or install a runtime locally.

# Quick Start with npx (Zero Install)
# Run directly without installation - works instantly!
npx -y kubectl-mcp-server

# Or install globally for faster startup
npm install -g kubectl-mcp-server

# Or install with pip (Python)
# Standard installation
pip install kubectl-mcp-server

# With interactive UI dashboards (recommended)
pip install kubectl-mcp-server[ui]

Additional setup and options

Prerequisites you will need before running the MCP server: Node.js 14+ for npx usage, Python 3.9+ for pip usage, and kubectl installed and configured to access your Kubernetes cluster.

# Prerequisites check
kubectl cluster-info
python --version
node --version
npm --version

Available tools

get_pods

List and retrieve pod information, logs, and health status across namespaces.

get_logs

Fetch and display pod logs with filtering and search capabilities.

get_pod_events

Retrieve events for one or more pods to diagnose issues.

check_pod_health

Assess pod health and readiness with actionable diagnostics.

exec_in_pod

Execute commands inside a running container within a pod.

cleanup_pods

Clean up terminated or unused pods to reclaim resources.

get_pod_conditions

Query and explain current pod conditions and statuses.

get_previous_logs

Access previous container logs for crash analysis.

get_deployments

List deployments and their statuses across namespaces.

create_deployment

Create a new deployment with recommended defaults.

scale_deployment

Scale a deployment to the desired number of replicas.

kubectl_rollout

Manage Kubernetes rollouts for deployments.

restart_deployment

Restart a deployment to trigger a fresh rollout.

get_statefulsets

List StatefulSets and their pod statuses.

get_daemonsets

List DaemonSets and their pod statuses.

get_jobs

List Jobs and their completion status.

get_replicasets

List ReplicaSets and their scale information.

get_services

List services and their endpoints.

get_ingress

Retrieve Ingress resources and routing details.

get_endpoints

Show endpoints for services.

diagnose_network_connectivity

Diagnose network reachability across cluster components.

check_dns_resolution

Verify DNS resolution for services and pods.

trace_service_chain

Trace a service call path from ingress to pods.

get_persistent_volumes

List Persistent Volumes and their status.

get_pvcs

List Persistent Volume Claims and usage.

get_storage_classes

Show available storage classes and defaults.

get_configmaps

Retrieve Kubernetes ConfigMaps and their data (masked when needed).

get_secrets

Retrieve Secrets with data masked for security.

get_resource_quotas

Show resource quotas across namespaces.

get_limit_ranges

Show limit ranges for resource management.

get_nodes

List nodes with health and capacity details.

get_namespaces

List all namespaces and their statuses.

get_cluster_info

Get high-level cluster information.

get_cluster_version

Show Kubernetes version information.

health_check

Perform a cluster health check and summarize results.

get_node_metrics

Query node resource metrics.

get_pod_metrics

Query pod resource metrics.

get_rbac_roles

List RBAC roles in the cluster.

get_cluster_roles

List cluster roles.

get_service_accounts

List service accounts across namespaces.

audit_rbac_permissions

Audit RBAC permissions for potential over-privilege.

check_secrets_security

Scan secrets for potential leakage or misconfigurations.

get_pod_security_info

Display pod security context and policies.

get_admission_webhooks

List admission webhooks and their configurations.

get_crds

List CustomResourceDefinitions.

get_priority_classes

List Kubernetes priority classes.

helm_list

List Helm releases.

helm_status

Show Helm release status.

helm_history

Show Helm release history.

helm_get_values

Retrieve Helm release values.

helm_get_manifest

Show Helm release manifest.

helm_get_notes

Show Helm release notes.

helm_get_hooks

Show Helm release hooks.

helm_get_all

Show all Helm release details.

install_helm_chart

Install a Helm chart into a namespace.

upgrade_helm_chart

Upgrade an existing Helm chart release.

uninstall_helm_chart

Uninstall a Helm chart release.

helm_rollback

Rollback a Helm release to a previous revision.

helm_test

Run Helm chart tests.

helm_template

Render Helm templates without installation.

helm_template_apply

Render and apply Helm templates.

helm_create

Create a new Helm chart skeleton.

helm_lint

Lint a Helm chart for best practices.

helm_package

Package a Helm chart for distribution.

helm_pull

Pull a Helm chart from a repository.

helm_dependency_list

List chart dependencies.

helm_dependency_update

Update chart dependencies.

helm_dependency_build

Build chart dependencies.

helm_version

Show Helm version information.

helm_env

Show or set Helm environment details.

get_current_context

Show the current kubectl context.

switch_context

Switch to a different Kubernetes context.

list_contexts

List all available contexts.

list_kubeconfig_contexts

List contexts from kubeconfig.

diagnose_pod_crash

Diagnose crashes with logs and events.

detect_pending_pods

Detect pods stuck in Pending state.

get_evicted_pods

List pods evicted from nodes.

compare_namespaces

Compare resources across namespaces.

kubectl_apply

Apply a manifest to a resource.

kubectl_create

Create a resource from manifest or inline content.

kubectl_describe

Describe a resource in detail.

kubectl_patch

Patch a resource with JSON or strategic merge.

delete_resource

Delete a Kubernetes resource.

kubectl_cp

Copy files to or from containers.

backup_resource

Back up a resource state.

label_resource

Add or update labels on a resource.

annotate_resource

Add annotations to a resource.

taint_node

Taint or untaint a node.

wait_for_condition

Wait for a specific condition on a resource.

get_hpa

List HorizontalPodAutoscalers.

get_pdb

List PodDisruptionBudgets.

kubectl_generic

Execute generic kubectl operations not covered by other tools.

kubectl_explain

Explain a Kubernetes resource or field.

get_api_resources

List API resources available in the cluster.

port_forward

Port-forward to a pod for local access.

get_resource_usage

Show current resource usage across the cluster.

node_management

Manage node lifecycle and maintenance tasks.

show_pod_logs_ui

UI tool to view pod logs with filtering.

show_pods_dashboard_ui

UI dashboard showing real-time pod and node status.

show_resource_yaml_ui

UI to view resource YAML with syntax highlighting.

show_cluster_overview_ui

UI overview of cluster health and usage.

show_events_timeline_ui

UI timeline of events with filters.

render_k8s_dashboard_screenshot

Export cluster dashboards as images.

gitops_apps_list

List GitOps-managed apps.

gitops_app_get

Get details of a GitOps app.

gitops_app_sync

Synchronize GitOps app state.

gitops_app_status

Show status of a GitOps app.

gitops_sources_list

List GitOps sources.

gitops_source_get

Get details of a GitOps source.

gitops_detect_engine

Detect GitOps engine in use.

certs_list

List Cert-Manager certificates.

certs_get

Get a specific certificate.

certs_issuers_list

List Cert-Manager issuers.

certs_issuer_get

Get a specific issuer.

certs_renew

Renew a certificate.

certs_status_explain

Explain certificate status.

certs_challenges_list

List certificate challenges.

certs_requests_list

List certificate requests.

certs_detect

Detect certificate issues.

policy_list

List policy resources (Kyverno/Gatekeeper).

policy_get

Get a specific policy.

policy_violations_list

List policy violations.

policy_explain_denial

Explain policy denial decisions.

policy_audit

Audit policy compliance.

policy_detect

Detect policy violations.

backup_list

List Velero backups.

backup_get

Get backup details.

backup_create

Create a Velero backup.

backup_delete

Delete a Velero backup.

restore_list

List Velero restores.

restore_create

Create a Velero restore.

restore_get

Get a Velero restore.

backup_locations_list

List Velero backup locations.

backup_schedules_list

List Velero backup schedules.

backup_schedule_create

Create a Velero backup schedule.

backup_detect

Detect Velero backups in use.

keda_scaledobjects_list

List KEDA ScaledObjects.

keda_scaledobject_get

Get a specific ScaledObject.

keda_scaledjobs_list

List KEDA ScaledJobs.

keda_triggerauths_list

List KEDA TriggerAuth resources.

keda_triggerauth_get

Get a TriggerAuth resource.

keda_hpa_list

List KEDA HPAs.

keda_detect

Detect KEDA usage.

cilium_policies_list

List Cilium NetworkPolicies.

cilium_policy_get

Get a Cilium policy.

cilium_endpoints_list

List Cilium endpoints.

cilium_identities_list

List Cilium identities.

cilium_nodes_list

List Cilium nodes.

cilium_status

Show Cilium status.

hubble_flows_query

Query Hubble observable flows.

cilium_detect

Detect Cilium networking setup.

rollouts_list

List Argo Rollouts.

rollout_get

Get rollout details.

rollout_status

Show rollout status.

rollout_promote

Promote a rollout.

rollout_abort

Abort a rollout.

rollout_retry

Retry a rollout.

rollout_restart

Restart a rollout.

analysis_runs_list

List analysis runs for Rollouts.

flagger_canaries_list

List Flagger canaries.

flagger_canary_get

Get a canary.

rollouts_detect

Detect rollout state.

capi_clusters_list

List Cluster API clusters.

capi_cluster_get

Get a Cluster API cluster.

capi_machines_list

List Cluster API machines.

capi_machine_get

Get a specific machine.

capi_machinedeployments_list

List MachineDeployments.

capi_machinedeployment_scale

Scale a MachineDeployment.

capi_machinesets_list

List MachineSets.

capi_machinehealthchecks_list

List MachineHealthChecks.

capi_clusterclasses_list

List ClusterClass resources.

capi_cluster_kubeconfig

Get kubeconfig for a cluster.

capi_detect

Detect Cluster API usage.

kubevirt_vms_list

List KubeVirt virtual machines.

kubevirt_vm_get

Get details of a VM.

kubevirt_vm_start

Start a VM.

kubevirt_vm_stop

Stop a VM.

kubevirt_vm_restart

Restart a VM.

kubevirt_vm_pause

Pause a VM.

kubevirt_vm_unpause

Unpause a VM.

kubevirt_vm_migrate

Migrate a VM.

kubevirt_datasources_list

List KubeVirt data sources.

kubevirt_instancetypes_list

List instance types for VMs.

kubevirt_datavolumes_list

List data volumes.

kubevirt_detect

Detect KubeVirt presence.

istio_virtualservices_list

List Istio VirtualServices.

istio_virtualservice_get

Get a VirtualService.

istio_destinationrules_list

List DestinationRules.

istio_gateways_list

List Gateways.

istio_peerauthentications_list

List PeerAuthentications.

istio_authorizationpolicies_list

List AuthorizationPolicies.

istio_proxy_status

Check Istio proxy status.

istio_analyze

Analyze Istio configuration.

istio_sidecar_status

Check Istio sidecar status.

istio_detect

Detect Istio setup.

vind_detect_tool

Detect vCluster presence.

vind_list_clusters_tool

List vCluster clusters.

vind_status_tool

Check vCluster status.

vind_get_kubeconfig_tool

Fetch kubeconfig for a vCluster.

vind_logs_tool

Fetch vCluster logs.

vind_create_cluster_tool

Create a vCluster.

vind_delete_cluster_tool

Delete a vCluster.

vind_pause_tool

Pause a vCluster.

vind_resume_tool

Resume a vCluster.

vind_connect_tool

Connect to a vCluster.

vind_disconnect_tool

Disconnect from a vCluster.

vind_upgrade_tool

Upgrade a vCluster.

vind_describe_tool

Describe a vCluster.

vind_platform_start_tool

Start vCluster platform.

kind_detect_tool

Detect kind (Kubernetes in Docker) usage.

kind_version_tool

Show kind version.

kind_list_clusters_tool

List kind clusters.

kind_get_nodes_tool

Get nodes of a kind cluster.

kind_get_kubeconfig_tool

Get kubeconfig for a kind cluster.

kind_export_logs_tool

Export logs from kind cluster.

kind_cluster_info_tool

Get cluster information for kind.

kind_node_labels_tool

Show node labels for kind clusters.

kind_create_cluster_tool

Create a new kind cluster.

kind_delete_cluster_tool

Delete a kind cluster.

kind_delete_all_clusters_tool

Delete all kind clusters.

kind_load_image_tool

Load image into kind cluster.

kind_load_image_archive_tool

Load image from archive into kind cluster.

kind_build_node_image_tool

Build node image for kind cluster.

kind_set_kubeconfig_tool

Set kubeconfig for kind.