Skip to content
Download Longwave

Kubernetes

Kubernetes is an MCP server for inspecting and managing Kubernetes clusters. Its connected implementation exposes 23 tools when a kubeconfig is available.

Add to Longwave Source

Install elsewhere

Install Kubernetes

Choose a harness. These instructions start the same local MCP server shown on this page.

Claude Code

Run this in your terminal. It adds a user-scoped server; use --scope project instead if it should apply only to the current project.

terminal
claude mcp add --scope user --transport stdio kubernetes -- npx -y [email protected]

What it does

Kubernetes MCP gives an agent cluster-aware operations. It can inspect workloads and resources through the same kubeconfig context a developer already uses.

  • Inspect cluster resources.
  • Read workload and pod state.
  • Work with Kubernetes manifests and namespaces.
  • Pass resource names and namespaces explicitly.
  • Keep kubeconfig and cluster credentials in the server environment.

Available functions

cleanup Cleanup all managed resources
exec_in_pod Execute a command in a Kubernetes pod or container and return the output. Command must be an array of strings where the first element is the executable and remaining elements are arguments. This executes directly without shell interpretation for security.

Arguments

command required
array Command to execute as an array of strings (e.g. ["ls", "-la", "/app"]). First element is the executable, remaining are arguments. Shell operators like pipes, redirects, or command chaining are not supported - use explicit array format for security.
container
string Container name (required when pod has multiple containers)
context
string Kubeconfig Context to use for the command (optional - defaults to null) Default:
name required
string Name of the pod to execute the command in
namespace
string Kubernetes namespace Default: default
timeout
number Timeout for command - 60000 milliseconds if not specified
explain_resource Get documentation for a Kubernetes resource or field

Arguments

apiVersion
string API version to use (e.g. 'apps/v1')
context
string Kubeconfig Context to use for the command (optional - defaults to null) Default:
output
string Output format (plaintext or plaintext-openapiv2) Allowed values: plaintext, plaintext-openapiv2 Default: plaintext
recursive
boolean Print the fields of fields recursively Default: false
resource required
string Resource name or field path (e.g. 'pods' or 'pods.spec.containers')
install_helm_chart Install a Helm chart with support for both standard and template-based installation

Arguments

chart required
string Chart name (e.g., 'nginx') or path to chart directory
context
string Kubeconfig Context to use for the command (optional - defaults to null) Default:
createNamespace
boolean Create namespace if it doesn't exist Default: true
name required
string Name of the Helm release
namespace required
string Kubernetes namespace Default: default
repo
string Helm repository URL (optional if using local chart path)
useTemplate
boolean Use helm template + kubectl apply instead of helm install (bypasses auth issues) Default: false
values
object Custom values to override chart defaults
valuesFile
string Path to values file (alternative to values object). The path is read on the machine running the MCP server, so it is rejected when the server runs over a remote (SSE/Streamable HTTP) transport; use 'values' to pass the values inline instead.
kubectl_apply Apply a Kubernetes YAML manifest from a string or file

Arguments

context
string Kubeconfig Context to use for the command (optional - defaults to null) Default:
dryRun
boolean If true, only validate the resource, don't actually execute the operation Default: false
filename
string Path to a YAML file to apply (optional - use either manifest or filename). The path is read on the machine running the MCP server, so it is rejected when the server runs over a remote (SSE/Streamable HTTP) transport; use 'manifest' to pass the file's contents instead.
force
boolean If true, immediately remove resources from API and bypass graceful deletion Default: false
manifest
string YAML manifest to apply
namespace
string Kubernetes namespace Default: default
kubectl_context Manage Kubernetes contexts - list, get, or set the current context

Arguments

detailed
boolean Include detailed information about the context Default: false
name
string Name of the context to set as current (required for set operation)
operation required
string Operation to perform: list contexts, get current context, or set current context Allowed values: list, get, set Default: list
output
string Output format Allowed values: json, yaml, name, custom Default: json
showCurrent
boolean When listing contexts, highlight which one is currently active Default: true
kubectl_create Create Kubernetes resources using various methods (from file or using subcommands)

Arguments

annotations
array Annotations to apply to the resource (e.g. ["key1=value1", "key2=value2"])
command
array Command to run in the container
context
string Kubeconfig Context to use for the command (optional - defaults to null) Default:
dryRun
boolean If true, only validate the resource, don't actually execute the operation Default: false
filename
string Path to a YAML file to create resources from. The path is read on the machine running the MCP server, so it is rejected when the server runs over a remote (SSE/Streamable HTTP) transport; use 'manifest' to pass the file's contents instead.
fromFile
array Path to file for creating configmap/secret (e.g. ["key1=/path/to/file1", "key2=/path/to/file2"]). The path is read on the machine running the MCP server, so it is rejected when the server runs over a remote (SSE/Streamable HTTP) transport; use "fromFileContent" to pass file contents directly instead.
fromFileContent
array Inline file contents for creating a configmap/secret, provided by the client instead of a server-side path (e.g. [{"key": "app.conf", "content": "..."}]). Safe on all transports; use this instead of "fromFile" on remote (SSE/Streamable HTTP) servers.
fromLiteral
array Key-value pair for creating configmap (e.g. ["key1=value1", "key2=value2"])
image
string Image to use for the containers in the deployment
labels
array Labels to apply to the resource (e.g. ["key1=value1", "key2=value2"])
manifest
string YAML manifest to create resources from
name
string Name of the resource to create
namespace
string Kubernetes namespace Default: default
output
string Output format. One of: json|yaml|name|go-template|go-template-file|template|templatefile|jsonpath|jsonpath-as-json|jsonpath-file Allowed values: json, yaml, name, go-template, go-template-file, template, templatefile, jsonpath, jsonpath-as-json, jsonpath-file Default: yaml
port
number Port that the container exposes
replicas
number Number of replicas to create for the deployment Default: 1
resourceType
string Type of resource to create (namespace, configmap, deployment, service, etc.)
schedule
string Cron schedule expression for the CronJob (e.g. "*/5 * * * *")
secretType
string Type of secret to create (generic, docker-registry, tls) Allowed values: generic, docker-registry, tls
serviceType
string Type of service to create (clusterip, nodeport, loadbalancer, externalname) Allowed values: clusterip, nodeport, loadbalancer, externalname
suspend
boolean Whether to suspend the CronJob Default: false
tcpPort
array Port pairs for tcp service (e.g. ["80:8080", "443:8443"])
validate
boolean If true, validate resource schema against server schema Default: true
kubectl_delete Delete Kubernetes resources by resource type, name, labels, or from a manifest file

Arguments

allNamespaces
boolean If true, delete resources across all namespaces Default: false
context
string Kubeconfig Context to use for the command (optional - defaults to null) Default:
filename
string Path to a YAML file to delete resources from (optional). The path is read on the machine running the MCP server, so it is rejected when the server runs over a remote (SSE/Streamable HTTP) transport; use 'manifest' to pass the file's contents instead.
force
boolean If true, immediately remove resources from API and bypass graceful deletion Default: false
gracePeriodSeconds
number Period of time in seconds given to the resource to terminate gracefully
labelSelector
string Delete resources matching this label selector (e.g. 'app=nginx')
manifest
string YAML manifest defining resources to delete (optional)
name
string Name of the resource to delete
namespace
string Kubernetes namespace Default: default
resourceType
string Type of resource to delete (e.g., pods, deployments, services, etc.)
kubectl_describe Describe Kubernetes resources by resource type, name, and optionally namespace

Arguments

allNamespaces
boolean If true, describe resources across all namespaces Default: false
context
string Kubeconfig Context to use for the command (optional - defaults to null) Default:
name required
string Name of the resource to describe
namespace
string Kubernetes namespace Default: default
resourceType required
string Type of resource to describe (e.g., pods, deployments, services, etc.)
kubectl_generic Execute any kubectl command with the provided arguments and flags

Arguments

allNamespaces
boolean If true, run the command across all namespaces Default: false
args
array Additional command arguments
command required
string The kubectl command to execute (e.g. patch, rollout, top)
context
string Kubeconfig Context to use for the command (optional - defaults to null) Default:
flags
object Command flags as key-value pairs
name
string Resource name
namespace
string Kubernetes namespace Default: default
outputFormat
string Output format (e.g. json, yaml, wide) Allowed values: json, yaml, wide, name, custom
resourceType
string Resource type (e.g. pod, deployment)
subCommand
string Subcommand if applicable (e.g. 'history' for rollout)
kubectl_get Get or list Kubernetes resources by resource type, name, and optionally namespace

Arguments

allNamespaces
boolean If true, list resources across all namespaces Default: false
context
string Kubeconfig Context to use for the command (optional - defaults to null) Default:
fieldSelector
string Filter resources by field selector (e.g. 'metadata.name=my-pod')
labelSelector
string Filter resources by label selector (e.g. 'app=nginx')
name
string Name of the resource (optional - if not provided, lists all resources of the specified type)
namespace
string Kubernetes namespace Default: default
output
string Output format Allowed values: json, yaml, wide, name, custom Default: json
resourceType required
string Type of resource to get (e.g., pods, deployments, services, configmaps, events, etc.)
sortBy
string Sort events by a field (default: lastTimestamp). Only applicable for events.
kubectl_logs Get logs from Kubernetes resources like pods, deployments, or jobs

Arguments

container
string Container name (required when pod has multiple containers)
context
string Kubeconfig Context to use for the command (optional - defaults to null) Default:
follow
boolean Follow logs output (not recommended, may cause timeouts) Default: false
labelSelector
string Filter resources by label selector
name required
string Name of the resource
namespace required
string Kubernetes namespace Default: default
previous
boolean Include logs from previously terminated containers Default: false
resourceType required
string Type of resource to get logs from Allowed values: pod, deployment, job, cronjob
since
string Show logs since relative time (e.g. '5s', '2m', '3h')
sinceTime
string Show logs since absolute time (RFC3339)
tail
number Number of lines to show from end of logs
timestamps
boolean Include timestamps in logs Default: false
kubectl_patch Update field(s) of a resource using strategic merge patch, JSON merge patch, or JSON patch

Arguments

context
string Kubeconfig Context to use for the command (optional - defaults to null) Default:
dryRun
boolean If true, only validate the resource, don't actually execute the operation Default: false
name required
string Name of the resource to patch
namespace
string Kubernetes namespace Default: default
patchData
object Patch data as a JSON object
patchFile
string Path to a file containing the patch data (alternative to patchData). The path is read on the machine running the MCP server, so it is rejected when the server runs over a remote (SSE/Streamable HTTP) transport; use 'patchData' to pass the patch contents instead.
patchType
string Type of patch to apply Allowed values: strategic, merge, json Default: strategic
resourceType required
string Type of resource to patch (e.g., pods, deployments, services)
kubectl_reconnect Reconnect to the Kubernetes API server by recreating all API clients. Use this after cluster upgrades (e.g., EKS control plane upgrades that rotate ENIs/IPs) to force fresh DNS resolution and new TCP connections.
kubectl_rollout Manage the rollout of a resource (e.g., deployment, daemonset, statefulset)

Arguments

context
string Kubeconfig Context to use for the command (optional - defaults to null) Default:
name required
string Name of the resource
namespace required
string Kubernetes namespace Default: default
resourceType required
string Type of resource to manage rollout for Allowed values: deployment, daemonset, statefulset Default: deployment
revision
number Revision to rollback to (for undo subcommand)
subCommand required
string Rollout subcommand to execute Allowed values: history, pause, restart, resume, status, undo Default: status
timeout
string The length of time to wait before giving up (e.g., '30s', '1m', '2m30s')
toRevision
number Revision to roll back to (for history subcommand)
watch
boolean Watch the rollout status in real-time until completion Default: false
kubectl_scale Scale a Kubernetes deployment

Arguments

context
string Kubeconfig Context to use for the command (optional - defaults to null) Default:
name required
string Name of the deployment to scale
namespace
string Kubernetes namespace Default: default
replicas required
number Number of replicas to scale to
resourceType
string Resource type to scale (deployment, replicaset, statefulset) Default: deployment
list_api_resources List the API resources available in the cluster

Arguments

apiGroup
string API group to filter by
context
string Kubeconfig Context to use for the command (optional - defaults to null) Default:
namespaced
boolean If true, only show namespaced resources
output
string Output format (wide, name, or no-headers) Allowed values: wide, name, no-headers Default: wide
verbs
array List of verbs to filter by
node_management Manage Kubernetes nodes with cordon, drain, and uncordon operations

Arguments

confirmDrain
boolean Explicit confirmation to drain the node (required for drain operation) Default: false
deleteLocalData
boolean Delete local data even if emptyDir volumes are used (for drain operation) Default: false
dryRun
boolean Show what would be done without actually doing it (for drain operation) Default: false
force
boolean Force the operation even if there are pods not managed by a ReplicationController, ReplicaSet, Job, DaemonSet or StatefulSet (for drain operation) Default: false
gracePeriod
number Period of time in seconds given to each pod to terminate gracefully (for drain operation). If set to -1, uses the kubectl default grace period. Default: -1
ignoreDaemonsets
boolean Ignore DaemonSet-managed pods (for drain operation) Default: true
nodeName
string Name of the node to operate on (required for cordon, drain, uncordon)
operation required
string Node operation to perform Allowed values: cordon, drain, uncordon
timeout
string The length of time to wait before giving up (for drain operation, e.g., '5m', '1h') Default: 0
ping Verify that the counterpart is still responsive and the connection is alive.
port_forward Forward a local port to a port on a Kubernetes resource

Arguments

localPort required
number
namespace
string
resourceName required
string
resourceType required
string
targetPort required
number
stop_port_forward Stop a port-forward process

Arguments

id required
string
uninstall_helm_chart Uninstall a Helm chart release

Arguments

context
string Kubeconfig Context to use for the command (optional - defaults to null) Default:
name required
string Name of the Helm release to uninstall
namespace required
string Kubernetes namespace Default: default
upgrade_helm_chart Upgrade an existing Helm chart release

Arguments

chart required
string Chart name or path to chart directory
context
string Kubeconfig Context to use for the command (optional - defaults to null) Default:
name required
string Name of the Helm release to upgrade
namespace required
string Kubernetes namespace Default: default
repo
string Helm repository URL (optional if using local chart path)
values
object Custom values to override chart defaults
valuesFile
string Path to values file (alternative to values object). The path is read on the machine running the MCP server, so it is rejected when the server runs over a remote (SSE/Streamable HTTP) transport; use 'values' to pass the values inline instead.

Resources

Kubernetes Deployments

k8s://default/deployments

List of deployments in the default namespace

Kubernetes Pods

k8s://default/pods

List of pods in the default namespace

Kubernetes Services

k8s://default/services

List of services in the default namespace

Kubernetes Namespaces

k8s://namespaces

List of all namespaces

Kubernetes Nodes

k8s://nodes

List of all nodes in the cluster

Prompts

k8s-diagnose

Diagnose Kubernetes Resources.

Arguments

keyword required
A keyword to search pod/node names.
namespace
Optional: Specify a namespace to narrow down the search.

Questions people ask

How do I install a Kubernetes MCP server?

Add the catalog-backed server to an MCP client on a machine with access to the target cluster. Configure the kubeconfig before starting the local process.

Does Kubernetes MCP use kubeconfig?

Yes. The catalog entry declares kubeconfig as its cluster connection. Set the intended context explicitly and do not expose a broader kubeconfig than the task needs.

Can Kubernetes MCP inspect pods?

Cluster and workload inspection are the entry's stated uses. The live function list defines the pod and resource operations returned by this server version.

Can Kubernetes MCP work with Cursor?

Add the local server to Cursor's MCP settings and make sure the configured kubeconfig context can reach the cluster. Cursor can use the operations returned by the process.

Can Kubernetes MCP work with Claude Code?

Yes. Add the server to Claude Code on a machine with the intended kubeconfig and cluster access. Claude Code can use only the operations advertised by the running server.

Can Kubernetes MCP run in Docker?

Yes, if the container receives a kubeconfig, can reach the Kubernetes API and has the required server runtime. Keep the mounted credentials limited to the target context.

Can Kubernetes MCP deploy an application?

Do not assume deployment writes are available. The generated function list is the source of truth, and Kubernetes RBAC still controls what the server can change.

Can an AI agent use Kubernetes MCP?

Yes. The server gives an MCP-capable agent cluster operations, but the agent acts with the kubeconfig and RBAC permissions supplied to the process.

Give the agent the cluster context.

Let it inspect workloads and resources through the kubeconfig you already trust.