Kubernetes MCP Server
Enables management of lightweight K3s clusters remotely via SSH, with full support for all Kubernetes operations including resource management, monitoring, and troubleshooting.
Provides comprehensive cluster management capabilities with 50 specialized tools for managing pods, deployments, services, ConfigMaps, secrets, StatefulSets, DaemonSets, ingresses, rollouts, and cluster resources. Supports both local kubectl execution and remote SSH-based execution.
Click on "Deploy Server".
Wait a few minutes for the server to deploy. Once ready, it will show a "Started" state.
In the chat, type
@followed by the MCP server name and your instructions, e.g., "@Kubernetes MCP Server list all pods in the default namespace"
That's it! The server will respond to your query, and you can continue using it as needed.
Here is a step-by-step guide with screenshots.
Kubernetes MCP Server
A Model Context Protocol (MCP) server that provides comprehensive Kubernetes cluster management capabilities. This server enables AI assistants like Claude to interact with Kubernetes clusters through 50 specialized tools, supporting both local kubectl and remote SSH-based execution.
Features
50 Kubernetes Management Tools
This MCP server provides complete cluster management capabilities organized into the following categories:
Cluster Management (4 tools)
k8s_get_cluster_info- Get cluster information including server version and endpointsk8s_list_nodes- List all nodes with status, roles, and resource informationk8s_get_node- Get detailed information about a specific nodek8s_describe_node- Get full node description including conditions and capacity
Namespace Management (3 tools)
k8s_list_namespaces- List all namespaces in the clusterk8s_create_namespace- Create a new namespacek8s_delete_namespace- Delete a namespace (with warning)
Pod Management (6 tools)
k8s_list_pods- List pods with filtering by namespace and labelsk8s_get_pod- Get detailed pod informationk8s_describe_pod- Get full pod description including eventsk8s_get_pod_logs- Get container logs with filtering optionsk8s_delete_pod- Delete a pod (with optional force)k8s_exec_pod- Execute commands in pod containers
Deployment Management (6 tools)
k8s_list_deployments- List deployments in namespace or cluster-widek8s_get_deployment- Get detailed deployment informationk8s_describe_deployment- Get full deployment description with eventsk8s_scale_deployment- Scale deployment replicask8s_restart_deployment- Perform rolling restartk8s_update_deployment_image- Update container image
Service Management (3 tools)
k8s_list_services- List services in namespace or cluster-widek8s_get_service- Get detailed service informationk8s_describe_service- Get full service description including endpoints
ConfigMap Management (4 tools)
k8s_list_configmaps- List ConfigMaps in namespacek8s_get_configmap- Get ConfigMap details and datak8s_create_configmap- Create ConfigMap from literal valuesk8s_delete_configmap- Delete a ConfigMap
Secret Management (4 tools)
k8s_list_secrets- List secrets (values hidden)k8s_get_secret- Get secret metadata (with optional decode)k8s_create_secret- Create secret from literal valuesk8s_delete_secret- Delete a secret
StatefulSet Management (3 tools)
k8s_list_statefulsets- List StatefulSets in namespacek8s_get_statefulset- Get StatefulSet detailsk8s_scale_statefulset- Scale StatefulSet replicas
DaemonSet Management (2 tools)
k8s_list_daemonsets- List DaemonSets in namespacek8s_get_daemonset- Get DaemonSet details
Ingress Management (2 tools)
k8s_list_ingresses- List Ingresses in namespacek8s_get_ingress- Get Ingress details
Resource Management (5 tools)
k8s_apply_manifest- Apply YAML/JSON manifest to clusterk8s_delete_resource- Delete resource by type and namek8s_get_events- Get cluster events with optional filteringk8s_get_resource_yaml- Get any resource as YAMLk8s_get_all- Get all common resources in namespace
Rollout Management (3 tools)
k8s_rollout_status- Get deployment rollout statusk8s_rollout_history- Get rollout historyk8s_rollout_undo- Undo deployment rollout
Metrics & Monitoring (2 tools)
k8s_top_nodes- Show node resource usage (CPU/memory)k8s_top_pods- Show pod resource usage (CPU/memory)
Context Management (2 tools)
k8s_get_contexts- List all available kubectl contextsk8s_current_context- Get current kubectl context
Related MCP server: Kubernetes MCP Server
Installation
Prerequisites
Node.js 20 or higher
TypeScript 5.3 or higher
kubectl installed and configured (for local mode)
SSH access configured (for remote mode)
Setup
Clone this repository:
git clone https://github.com/yourusername/mcp-kubernetes.git
cd mcp-kubernetesInstall dependencies:
npm installBuild the TypeScript source:
npm run buildConfiguration
Environment Variables
The server supports both local kubectl execution and remote SSH-based execution:
Local kubectl Mode
KUBECONFIG(optional) - Path to kubeconfig file (defaults to ~/.kube/config)K8S_CONTEXT(optional) - Specific kubectl context to useK8S_DEFAULT_NAMESPACE(optional) - Default namespace (defaults to "default")KUBECTL_PATH(optional) - Path to kubectl binary (defaults to "kubectl")
Remote SSH Mode (for K3s or remote clusters)
K8S_SSH_HOST- SSH host for remote kubectl execution (e.g., 192.168.16.100)K8S_SSH_USER- SSH username for authenticationK8S_SSH_KEY- Path to SSH private key for authenticationK8S_SSH_PASSWORD(alternative) - SSH password (uses plink on Windows, sshpass on Linux)K8S_DEFAULT_NAMESPACE(optional) - Default namespace (defaults to "default")
Claude Desktop Configuration
Add to your Claude desktop configuration file (~/.claude/config.json or %APPDATA%\Claude\config.json on Windows):
Local kubectl:
{
"mcpServers": {
"kubernetes": {
"type": "stdio",
"command": "node",
"args": ["/path/to/mcp-kubernetes/dist/index.js"],
"env": {
"K8S_DEFAULT_NAMESPACE": "default"
}
}
}
}Remote SSH (K3s/Raspberry Pi example):
{
"mcpServers": {
"kubernetes": {
"type": "stdio",
"command": "node",
"args": ["C:/Users/Administrator/mcp-servers/kubernetes/dist/index.js"],
"env": {
"K8S_SSH_HOST": "192.168.16.100",
"K8S_SSH_USER": "mark",
"K8S_SSH_KEY": "C:/Users/Administrator/.ssh/id_ed25519_k8s",
"K8S_DEFAULT_NAMESPACE": "default"
}
}
}
}Usage Examples
List all pods in a namespace
// Using the k8s_list_pods tool
{
"namespace": "default"
}Get pod logs
// Using the k8s_get_pod_logs tool
{
"name": "my-pod",
"namespace": "default",
"tail": 100,
"since": "5m"
}Scale a deployment
// Using the k8s_scale_deployment tool
{
"name": "my-deployment",
"namespace": "default",
"replicas": 3
}Apply a manifest
// Using the k8s_apply_manifest tool
{
"manifest": "apiVersion: v1\nkind: Pod\n...",
"namespace": "default"
}Execute command in pod
// Using the k8s_exec_pod tool
{
"name": "my-pod",
"namespace": "default",
"command": "ls -la /app"
}Get cluster events
// Using the k8s_get_events tool
{
"namespace": "default"
}Development
Running in development mode
npm run devBuilding for production
npm run buildStarting the server
npm startArchitecture
The server uses the Model Context Protocol (MCP) to expose Kubernetes operations as tools. It supports two execution modes:
Local Mode: Executes kubectl commands directly on the local machine
Remote SSH Mode: Executes kubectl commands on a remote server via SSH (useful for K3s clusters or remote Kubernetes installations)
The server automatically detects which mode to use based on the presence of SSH environment variables.
Use Cases
Raspberry Pi K3s Clusters: Manage lightweight K3s clusters remotely
Development Clusters: Quick operations on local development clusters
Production Monitoring: Read-only operations for cluster health monitoring
GitOps Workflows: Apply manifests and track deployments
Troubleshooting: Get logs, describe resources, check events
Resource Management: Create/delete ConfigMaps, Secrets, and other resources
Security Considerations
SSH Key Authentication: Prefer SSH key authentication over password-based auth
Read-Only Operations: Many tools are read-only and safe for production
Secret Handling: Secrets are base64 encoded by default; decode only when necessary
Namespace Isolation: Use namespace parameters to limit scope of operations
Force Operations: Be cautious with
forceparameters on delete operations
Tested Environments
K3s on Raspberry Pi (v1.33.5+k3s1)
Local Kubernetes (minikube, kind, Docker Desktop)
Remote Kubernetes via SSH
Limitations
Requires
kubectlto be installed and accessibleSSH mode requires sudo access for kubectl on remote host
Metrics tools require metrics-server to be installed in the cluster
Windows SSH password auth requires PuTTY's plink to be available
Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
License
MIT License - see LICENSE file for details
Acknowledgments
Built with the Model Context Protocol SDK
Designed for use with Claude Desktop
Inspired by the Kubernetes community's kubectl tool
Support
For issues, questions, or contributions, please open an issue on GitHub.
Version History
1.0.0 - Initial release with 50 Kubernetes management tools
Full support for pods, deployments, services, ConfigMaps, secrets
StatefulSets, DaemonSets, Ingresses
Rollout management and metrics
Local and remote SSH execution modes
Available Tools
49 toolsk8s_apply_manifestC
Apply a YAML or JSON manifest to the cluster
Inputs: manifest (required), namespace, dry_run.
k8s_create_configmapC
Create a ConfigMap from literal values
Inputs: name (required), data (required), namespace.
k8s_create_namespaceC
Create a new namespace
Inputs: name (required).
k8s_create_secretC
Create a generic secret from literal values
Inputs: name (required), data (required), namespace, type.
k8s_current_contextB
Get the current kubectl context
Inputs: no named parameters.
k8s_delete_configmapC
Delete a ConfigMap
Inputs: name (required), namespace.
k8s_delete_namespaceA
Delete a namespace (WARNING: This will delete all resources in the namespace)
Inputs: name (required).
k8s_delete_podC
Delete a pod
Inputs: name (required), namespace, force.
k8s_delete_resourceC
Delete a resource by type and name
Inputs: resource_type (required), name (required), namespace, force.
k8s_delete_secretC
Delete a secret
Inputs: name (required), namespace.
k8s_describe_deploymentC
Get full description of a deployment including events and conditions
Inputs: name (required), namespace.
k8s_describe_nodeB
Get full description of a node including conditions, capacity, and allocatable resources
Inputs: name (required).
k8s_describe_podC
Get full description of a pod including events
Inputs: name (required), namespace.
k8s_describe_serviceB
Get full description of a service including endpoints
Inputs: name (required), namespace.
k8s_exec_podC
Execute a command in a pod container
Inputs: name (required), command (required), namespace, container.
k8s_get_allC
Get all common resources in a namespace
Inputs: namespace.
k8s_get_cluster_infoB
Get Kubernetes cluster information including server version and endpoints
Inputs: no named parameters.
k8s_get_configmapC
Get ConfigMap details and data
Inputs: name (required), namespace.
k8s_get_contextsB
List all available kubectl contexts
Inputs: no named parameters.
k8s_get_daemonsetC
Get DaemonSet details
Inputs: name (required), namespace.
k8s_get_deploymentC
Get detailed information about a deployment
Inputs: name (required), namespace.
k8s_get_eventsB
Get cluster events, optionally filtered by namespace
Inputs: namespace, all_namespaces.
k8s_get_ingressC
Get Ingress details
Inputs: name (required), namespace.
k8s_get_nodeC
Get detailed information about a specific node
Inputs: name (required).
k8s_get_podB
Get detailed information about a specific pod
Inputs: name (required), namespace.
k8s_get_pod_logsC
Get logs from a pod container
Inputs: name (required), namespace, container, tail, +2 more.
k8s_get_resource_yamlC
Get any resource as YAML
Inputs: resource_type (required), name (required), namespace.
k8s_get_secretC
Get secret metadata (values are base64 encoded)
Inputs: name (required), namespace, decode.
k8s_get_serviceC
Get detailed information about a service
Inputs: name (required), namespace.
k8s_get_statefulsetC
Get StatefulSet details
Inputs: name (required), namespace.
k8s_list_configmapsB
List ConfigMaps in a namespace
Inputs: namespace, all_namespaces.
k8s_list_daemonsetsC
List DaemonSets in a namespace
Inputs: namespace, all_namespaces.
k8s_list_deploymentsB
List deployments in a namespace or all namespaces
Inputs: namespace, all_namespaces.
k8s_list_ingressesC
List Ingresses in a namespace
Inputs: namespace, all_namespaces.
k8s_list_namespacesB
List all namespaces in the cluster
Inputs: no named parameters.
k8s_list_nodesB
List all nodes in the cluster with their status, roles, and resource information
Inputs: no named parameters.
k8s_list_podsC
List pods in a namespace or all namespaces
Inputs: namespace, all_namespaces, label_selector.
k8s_list_secretsB
List secrets in a namespace (values are not shown)
Inputs: namespace, all_namespaces.
k8s_list_servicesB
List services in a namespace or all namespaces
Inputs: namespace, all_namespaces.
k8s_list_statefulsetsC
List StatefulSets in a namespace
Inputs: namespace, all_namespaces.
k8s_restart_deploymentC
Perform a rolling restart of a deployment
Inputs: name (required), namespace.
k8s_rollout_historyB
Get the rollout history of a deployment
Inputs: name (required), namespace.
k8s_rollout_statusB
Get the status of a deployment rollout
Inputs: name (required), namespace.
k8s_rollout_undoC
Undo the last rollout of a deployment
Inputs: name (required), namespace, revision.
k8s_scale_deploymentC
Scale a deployment to a specific number of replicas
Inputs: name (required), replicas (required), namespace.
k8s_scale_statefulsetC
Scale a StatefulSet to a specific number of replicas
Inputs: name (required), replicas (required), namespace.
k8s_top_nodesB
Show resource usage (CPU/memory) for nodes
Inputs: no named parameters.
k8s_top_podsC
Show resource usage (CPU/memory) for pods
Inputs: namespace, all_namespaces.
k8s_update_deployment_imageC
Update the container image of a deployment
Inputs: name (required), container (required), image (required), namespace.
Tool Schema Changelog
Recent tool additions, removals, and schema changes observed during successful MCP inspections.
Loading tool schema changelog…
TDQS
Scored across 49 tools
Most tools have distinct purposes targeting specific Kubernetes resources and actions, with clear boundaries (e.g., k8s_get_pod vs. k8s_describe_pod for different detail levels). However, some overlap exists, such as k8s_delete_resource potentially covering deletions handled by specific tools like k8s_delete_pod, which could cause minor confusion.
Tool names follow a highly consistent k8s_verb_noun pattern throughout, using snake_case uniformly. This predictability makes it easy for agents to understand and navigate the toolset without naming conflicts or style variations.
With 49 tools, the count is excessive for typical MCP server scope, likely overwhelming for agents and leading to decision paralysis. While Kubernetes is complex, this many tools suggests fragmentation rather than a well-scoped, cohesive set.
The toolset provides comprehensive coverage of Kubernetes operations, including CRUD for core resources (pods, deployments, services), lifecycle management (scale, restart, rollout), monitoring (logs, events, top), and cluster administration. No obvious gaps exist for the domain.
Related MCP Connectors
The Google GKE MCP server is a managed Model Context Protocol server that provides AI applications with tools to manage Google Kubernetes Engine (GKE) clusters and Kubernetes resources. It exposes a structured, discoverable interface that allows AI agents to interact with GKE and Kubernetes APIs, enabling them to inspect cluster configurations, retrieve Kubernetes resource YAMLs, monitor operations like cluster upgrades, diagnose issues, and optimize costs—all without needing to parse text output or use complex kubectl commands.
Deploy and run apps, workers, jobs, Postgres, and Valkey on Ownkube from your coding agent.
Query your team's drift, vulnerability, and upgrade data from any AI assistant. OAuth 2.1, 51 tools.
Read and write KukGit repositories, files, issues and pull requests from an AI assistant.
Related MCP Servers
- AlicenseNot gradedqualityDmaintenanceEnables advanced management of Kubernetes clusters through natural language interactions. Supports querying, managing, and monitoring pods, deployments, nodes, and logs across multiple contexts and namespaces.10MIT
- AlicenseBqualityDmaintenanceEnables managing Kubernetes clusters through natural language by providing tools to list resources, view logs, port-forward services, scale deployments, and execute kubectl operations via AI assistants.81MIT
- FlicenseNot gradedqualityDmaintenanceEnables interaction with Kubernetes clusters through 32 specialized tools for managing resources, deployments, and services. Provides both CLI and web interfaces for real-time Kubernetes operations powered by Google Gemini.5-
- AlicenseAqualityDmaintenanceEnables AI assistants to interact with and manage Kubernetes clusters, supporting operations on pods, deployments, services, configmaps, secrets, namespaces, metrics, and events with built-in safety features for destructive actions.910 npm1MIT