Version 4.43 or later needs to be installed to add the server automatically
Use cases
About
Connect to a Kubernetes cluster and manage it.
Attribute | Details |
---|---|
Docker Image | mcp/kubernetes |
Author | Flux159 |
Repository | https://github.com/Flux159/mcp-server-kubernetes |
Dockerfile | https://github.com/Flux159/mcp-server-kubernetes/blob/main/Dockerfile |
Docker Image built by | Docker Inc. |
Docker Scout Health Score | |
Verify Signature | COSIGN_REPOSITORY=mcp/signatures cosign verify mcp/kubernetes --key https://raw.githubusercontent.com/docker/keyring/refs/heads/main/public/mcp/latest.pub |
Licence | MIT License |
Tools provided by this Server | Short Description |
---|---|
cleanup | Cleanup all managed resources |
exec_in_pod | Execute a command in a Kubernetes pod or container and return the output |
explain_resource | Get documentation for a Kubernetes resource or field |
install_helm_chart | Install a Helm chart with support for both standard and template-based installation |
kubectl_apply | Apply a Kubernetes YAML manifest from a string or file |
kubectl_context | Manage Kubernetes contexts - list, get, or set the current context |
kubectl_create | Create Kubernetes resources using various methods (from file or using subcommands) |
kubectl_delete | Delete Kubernetes resources by resource type, name, labels, or from a manifest file |
kubectl_describe | Describe Kubernetes resources by resource type, name, and optionally namespace |
kubectl_generic | Execute any kubectl command with the provided arguments and flags |
kubectl_get | Get or list Kubernetes resources by resource type, name, and optionally namespace |
kubectl_logs | Get logs from Kubernetes resources like pods, deployments, or jobs |
kubectl_patch | Update field(s) of a resource using strategic merge patch, JSON merge patch, or JSON patch |
kubectl_rollout | Manage the rollout of a resource (e.g., deployment, daemonset, statefulset) |
kubectl_scale | Scale a Kubernetes deployment |
list_api_resources | List the API resources available in the cluster |
node_management | Manage Kubernetes nodes with cordon, drain, and uncordon operations |
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 |
stop_port_forward | Stop a port-forward process |
uninstall_helm_chart | Uninstall a Helm chart release |
upgrade_helm_chart | Upgrade an existing Helm chart release |
cleanup
Cleanup all managed resources
exec_in_pod
Execute a command in a Kubernetes pod or container and return the output
Parameters | Type | Description |
---|---|---|
command | string | Command to execute in the pod (string or array of args) |
name | string | Name of the pod to execute the command in |
container | string optional | Container name (required when pod has multiple containers) |
context | string optional | Kubeconfig Context to use for the command (optional - defaults to null) |
namespace | string optional | Kubernetes namespace |
shell | string optional | Shell to use for command execution (e.g. '/bin/sh', '/bin/bash'). If not provided, will use command as-is. |
timeout | number optional | Timeout for command - 60000 milliseconds if not specified |
explain_resource
Get documentation for a Kubernetes resource or field
Parameters | Type | Description |
---|---|---|
resource | string | Resource name or field path (e.g. 'pods' or 'pods.spec.containers') |
apiVersion | string optional | API version to use (e.g. 'apps/v1') |
context | string optional | Kubeconfig Context to use for the command (optional - defaults to null) |
output | string optional | Output format (plaintext or plaintext-openapiv2) |
recursive | boolean optional | Print the fields of fields recursively |
install_helm_chart
Install a Helm chart with support for both standard and template-based installation
Parameters | Type | Description |
---|---|---|
chart | string | Chart name (e.g., 'nginx') or path to chart directory |
name | string | Name of the Helm release |
namespace | string | Kubernetes namespace |
context | string optional | Kubeconfig Context to use for the command (optional - defaults to null) |
createNamespace | boolean optional | Create namespace if it doesn't exist |
repo | string optional | Helm repository URL (optional if using local chart path) |
useTemplate | boolean optional | Use helm template + kubectl apply instead of helm install (bypasses auth issues) |
values | object optional | Custom values to override chart defaults |
valuesFile | string optional | Path to values file (alternative to values object) |
kubectl_apply
Apply a Kubernetes YAML manifest from a string or file
Parameters | Type | Description |
---|---|---|
context | string optional | Kubeconfig Context to use for the command (optional - defaults to null) |
dryRun | boolean optional | If true, only validate the resource, don't actually execute the operation |
filename | string optional | Path to a YAML file to apply (optional - use either manifest or filename) |
force | boolean optional | If true, immediately remove resources from API and bypass graceful deletion |
manifest | string optional | YAML manifest to apply |
namespace | string optional | Kubernetes namespace |
kubectl_context
Manage Kubernetes contexts - list, get, or set the current context
Parameters | Type | Description |
---|---|---|
operation | string | Operation to perform: list contexts, get current context, or set current context |
detailed | boolean optional | Include detailed information about the context |
name | string optional | Name of the context to set as current (required for set operation) |
output | string optional | Output format |
showCurrent | boolean optional | When listing contexts, highlight which one is currently active |
kubectl_create
Create Kubernetes resources using various methods (from file or using subcommands)
Parameters | Type | Description |
---|---|---|
annotations | array optional | Annotations to apply to the resource (e.g. ["key1=value1", "key2=value2"]) |
command | array optional | Command to run in the container |
context | string optional | Kubeconfig Context to use for the command (optional - defaults to null) |
dryRun | boolean optional | If true, only validate the resource, don't actually execute the operation |
filename | string optional | Path to a YAML file to create resources from |
fromFile | array optional | Path to file for creating configmap (e.g. ["key1=/path/to/file1", "key2=/path/to/file2"]) |
fromLiteral | array optional | Key-value pair for creating configmap (e.g. ["key1=value1", "key2=value2"]) |
image | string optional | Image to use for the containers in the deployment |
labels | array optional | Labels to apply to the resource (e.g. ["key1=value1", "key2=value2"]) |
manifest | string optional | YAML manifest to create resources from |
name | string optional | Name of the resource to create |
namespace | string optional | Kubernetes namespace |
output | string optional | Output format. One of: json |
port | number optional | Port that the container exposes |
replicas | number optional | Number of replicas to create for the deployment |
resourceType | string optional | Type of resource to create (namespace, configmap, deployment, service, etc.) |
schedule | string optional | Cron schedule expression for the CronJob (e.g. "*/5 * * * *") |
secretType | string optional | Type of secret to create (generic, docker-registry, tls) |
serviceType | string optional | Type of service to create (clusterip, nodeport, loadbalancer, externalname) |
suspend | boolean optional | Whether to suspend the CronJob |
tcpPort | array optional | Port pairs for tcp service (e.g. ["80:8080", "443:8443"]) |
validate | boolean optional | If true, validate resource schema against server schema |
kubectl_delete
Delete Kubernetes resources by resource type, name, labels, or from a manifest file
Parameters | Type | Description |
---|---|---|
name | string | Name of the resource to delete |
namespace | string | Kubernetes namespace |
resourceType | string | Type of resource to delete (e.g., pods, deployments, services, etc.) |
allNamespaces | boolean optional | If true, delete resources across all namespaces |
context | string optional | Kubeconfig Context to use for the command (optional - defaults to null) |
filename | string optional | Path to a YAML file to delete resources from (optional) |
force | boolean optional | If true, immediately remove resources from API and bypass graceful deletion |
gracePeriodSeconds | number optional | Period of time in seconds given to the resource to terminate gracefully |
labelSelector | string optional | Delete resources matching this label selector (e.g. 'app=nginx') |
manifest | string optional | YAML manifest defining resources to delete (optional) |
kubectl_describe
Describe Kubernetes resources by resource type, name, and optionally namespace
Parameters | Type | Description |
---|---|---|
name | string | Name of the resource to describe |
resourceType | string | Type of resource to describe (e.g., pods, deployments, services, etc.) |
allNamespaces | boolean optional | If true, describe resources across all namespaces |
context | string optional | Kubeconfig Context to use for the command (optional - defaults to null) |
namespace | string optional | Kubernetes namespace |
kubectl_generic
Execute any kubectl command with the provided arguments and flags
Parameters | Type | Description |
---|---|---|
command | string | The kubectl command to execute (e.g. patch, rollout, top) |
args | array optional | Additional command arguments |
context | string optional | Kubeconfig Context to use for the command (optional - defaults to null) |
flags | object optional | Command flags as key-value pairs |
name | string optional | Resource name |
namespace | string optional | Kubernetes namespace |
outputFormat | string optional | Output format (e.g. json, yaml, wide) |
resourceType | string optional | Resource type (e.g. pod, deployment) |
subCommand | string optional | Subcommand if applicable (e.g. 'history' for rollout) |
kubectl_get
Get or list Kubernetes resources by resource type, name, and optionally namespace
Parameters | Type | Description |
---|---|---|
name | string | Name of the resource (optional - if not provided, lists all resources of the specified type) |
namespace | string | Kubernetes namespace |
resourceType | string | Type of resource to get (e.g., pods, deployments, services, configmaps, events, etc.) |
allNamespaces | boolean optional | If true, list resources across all namespaces |
context | string optional | Kubeconfig Context to use for the command (optional - defaults to null) |
fieldSelector | string optional | Filter resources by field selector (e.g. 'metadata.name=my-pod') |
labelSelector | string optional | Filter resources by label selector (e.g. 'app=nginx') |
output | string optional | Output format |
sortBy | string optional | Sort events by a field (default: lastTimestamp). Only applicable for events. |
kubectl_logs
Get logs from Kubernetes resources like pods, deployments, or jobs
Parameters | Type | Description |
---|---|---|
name | string | Name of the resource |
namespace | string | Kubernetes namespace |
resourceType | string | Type of resource to get logs from |
container | string optional | Container name (required when pod has multiple containers) |
context | string optional | Kubeconfig Context to use for the command (optional - defaults to null) |
follow | boolean optional | Follow logs output (not recommended, may cause timeouts) |
labelSelector | string optional | Filter resources by label selector |
previous | boolean optional | Include logs from previously terminated containers |
since | string optional | Show logs since relative time (e.g. '5s', '2m', '3h') |
sinceTime | string optional | Show logs since absolute time (RFC3339) |
tail | number optional | Number of lines to show from end of logs |
timestamps | boolean optional | Include timestamps in logs |
kubectl_patch
Update field(s) of a resource using strategic merge patch, JSON merge patch, or JSON patch
Parameters | Type | Description |
---|---|---|
name | string | Name of the resource to patch |
resourceType | string | Type of resource to patch (e.g., pods, deployments, services) |
context | string optional | Kubeconfig Context to use for the command (optional - defaults to null) |
dryRun | boolean optional | If true, only validate the resource, don't actually execute the operation |
namespace | string optional | Kubernetes namespace |
patchData | object optional | Patch data as a JSON object |
patchFile | string optional | Path to a file containing the patch data (alternative to patchData) |
patchType | string optional | Type of patch to apply |
kubectl_rollout
Manage the rollout of a resource (e.g., deployment, daemonset, statefulset)
Parameters | Type | Description |
---|---|---|
name | string | Name of the resource |
namespace | string | Kubernetes namespace |
resourceType | string | Type of resource to manage rollout for |
subCommand | string | Rollout subcommand to execute |
context | string optional | Kubeconfig Context to use for the command (optional - defaults to null) |
revision | number optional | Revision to rollback to (for undo subcommand) |
timeout | string optional | The length of time to wait before giving up (e.g., '30s', '1m', '2m30s') |
toRevision | number optional | Revision to roll back to (for history subcommand) |
watch | boolean optional | Watch the rollout status in real-time until completion |
kubectl_scale
Scale a Kubernetes deployment
Parameters | Type | Description |
---|---|---|
name | string | Name of the deployment to scale |
replicas | number | Number of replicas to scale to |
context | string optional | Kubeconfig Context to use for the command (optional - defaults to null) |
namespace | string optional | Kubernetes namespace |
resourceType | string optional | Resource type to scale (deployment, replicaset, statefulset) |
list_api_resources
List the API resources available in the cluster
Parameters | Type | Description |
---|---|---|
apiGroup | string optional | API group to filter by |
context | string optional | Kubeconfig Context to use for the command (optional - defaults to null) |
namespaced | boolean optional | If true, only show namespaced resources |
output | string optional | Output format (wide, name, or no-headers) |
verbs | array optional | List of verbs to filter by |
node_management
Manage Kubernetes nodes with cordon, drain, and uncordon operations
Parameters | Type | Description |
---|---|---|
operation | string | Node operation to perform |
confirmDrain | boolean optional | Explicit confirmation to drain the node (required for drain operation) |
deleteLocalData | boolean optional | Delete local data even if emptyDir volumes are used (for drain operation) |
dryRun | boolean optional | Show what would be done without actually doing it (for drain operation) |
force | boolean optional | Force the operation even if there are pods not managed by a ReplicationController, ReplicaSet, Job, DaemonSet or StatefulSet (for drain operation) |
gracePeriod | number optional | 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. |
ignoreDaemonsets | boolean optional | Ignore DaemonSet-managed pods (for drain operation) |
nodeName | string optional | Name of the node to operate on (required for cordon, drain, uncordon) |
timeout | string optional | The length of time to wait before giving up (for drain operation, e.g., '5m', '1h') |
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
Parameters | Type | Description |
---|---|---|
localPort | number | |
resourceName | string | |
resourceType | string | |
targetPort | number | |
namespace | string optional |
stop_port_forward
Stop a port-forward process
Parameters | Type | Description |
---|---|---|
id | string |
uninstall_helm_chart
Uninstall a Helm chart release
Parameters | Type | Description |
---|---|---|
name | string | Name of the Helm release to uninstall |
namespace | string | Kubernetes namespace |
context | string optional | Kubeconfig Context to use for the command (optional - defaults to null) |
upgrade_helm_chart
Upgrade an existing Helm chart release
Parameters | Type | Description |
---|---|---|
chart | string | Chart name or path to chart directory |
name | string | Name of the Helm release to upgrade |
namespace | string | Kubernetes namespace |
context | string optional | Kubeconfig Context to use for the command (optional - defaults to null) |
repo | string optional | Helm repository URL (optional if using local chart path) |
values | object optional | Custom values to override chart defaults |
valuesFile | string optional | Path to values file (alternative to values object) |
{
"mcpServers": {
"kubernetes": {
"command": "docker",
"args": [
"run",
"-i",
"--rm",
"mcp/kubernetes"
]
}
}
}
Manual installation
You can install the MCP server using:
Installation for