mcp-kubernetes-server
v1.0.4
Published
TypeScript MCP stdio server for Kubernetes operational tasks - manage pods, check logs, diagnose failures via SSH
Maintainers
Readme
MCP Kubernetes Server
TypeScript MCP stdio server for Kubernetes operational tasks.
Prerequisites
Required
- Node.js 18+ and npm
- kubectl installed and configured
- SSH access to Kubernetes master nodes
For Nested SSH (Master → Worker Nodes)
- sshpass installed on master nodes (not on your local machine)
- Only needed if you use
check_node_logsor nested SSH commands
Installation
npm install
npm run buildRun
npm startMCP Configuration
Option 1: Using Config File (Recommended)
Create a config file anywhere on your local machine (e.g., C:\Users\your-username\.ssh\mcp-config.json or D:\configs\mcp-config.json):
{
"HOST_ALIASES": "pod1-master=kubemaster01.pod1.com,pod2-master=kubemaster01.pod2.com",
"USERNAME": "your-username",
"PASSWORD": "your-password"
}Note: This same file can be used for both Kubernetes MCP and Vault MCP servers!
Then reference it in mcp_config.json using an absolute path:
{
"mcpServers": {
"kubernetes-ts": {
"command": "npx",
"args": ["-y", "mcp-kubernetes-server"],
"env": {
"MCP_CONFIG_FILE": "C:\\Users\\your-username\\.ssh\\mcp-config.json"
}
}
}
}The config file can be located anywhere:
- ✅
C:\Users\your-username\.ssh\mcp-config.json - ✅
D:\my-configs\mcp-config.json - ✅
C:\configs\mcp-config.json - ✅ Any absolute path you prefer!
Option 2: Direct Environment Variables
{
"mcpServers": {
"kubernetes-ts": {
"command": "npx",
"args": ["-y", "mcp-kubernetes-server"],
"env": {
"SSH_HOST_ALIASES": "pod1-master=kubemaster01.pod1.com,pod2-master=kubemaster01.pod2.com",
"SSH_USERNAME": "your-username",
"SSH_PASSWORD": "your-password"
}
}
}
}Tools
Kubernetes Resources
get_resources- Get any K8s resource (ingress, services, configmaps, etc.) in various formatsget_secrets- Get secrets with automatic base64 decodingget_nodes- Get cluster nodes with optional metrics
Pod Management
get_pod_status- Get pod status in tabular/json/yaml formatdescribe_pod- Describe pod detailsget_pod_logs- Get current/previous pod logsdiagnose_pod_failure- Comprehensive pod failure diagnosis
Cluster Operations
list_contexts- List kubeconfig contextsswitch_context- Switch active contextget_service_nodes- Get nodes hosting service pods
SSH & Logs
list_ssh_aliases- List SSH host aliasesexecute_ssh_command- Execute SSH commands on remote hostscheck_node_logs- Check node logs (supports serviceName and custom logPath)
