sandeshghanta/mcp-server-kubernetes-read-only
3.2
If you are the rightful owner of mcp-server-kubernetes-read-only and would like to certify it and/or have it hosted online, please leave a comment on the right or send an email to dayong@mcphub.com.
This is a read-only MCP server for Kubernetes cluster inspection using FastMCP and the Python Kubernetes client.
Tools
5
Resources
0
Prompts
0
MCP Server Kubernetes (Python)
Read-only MCP server for Kubernetes cluster inspection using FastMCP and Python kubernetes client.
Copied Heavily inspired from Flux159/mcp-server-kubernetes
Installation
uv pip install -e .
Usage
uv run python -m mcp_server_k8s.server
Example Usage
Get Pods
# Via Claude Code or Claude Desktop
"Show me all pods in default namespace"
"List pods with label app=nginx in production namespace"
Describe Resources
"Describe the deployment called my-app"
"Show details of pod my-pod-123 in namespace staging"
View Logs
"Show logs from pod my-pod"
"Get the last 50 lines of logs from deployment nginx"
"Show logs from the app container in pod multi-container-pod"
Troubleshooting
"Diagnose issues with pods matching 'api'"
"/k8s-diagnose keyword=backend namespace=production"
Health Check
"Ping the Kubernetes cluster"
"Check if cluster is accessible"
Tool Reference
| Tool | Description | Key Parameters |
|---|---|---|
kubectl_get | Get/list resources | resourceType, name, namespace, labelSelector |
kubectl_get_paginated | Paginated listing | resourceType, namespace, limit, continue |
kubectl_describe | Detailed resource info | resourceType, name, namespace |
kubectl_logs | Container logs | resourceType, name, namespace, container, tail |
ping | Health check | none |
Troubleshooting
"Unable to connect to cluster"
Check that:
~/.kube/configexists and is valid- Current context is set:
kubectl config current-context - You have network access to the cluster
"Resource not found"
Verify:
- Resource name is correct
- Namespace is correct (default: "default")
- You have RBAC permissions to view the resource
"Multi-container pod requires container specification"
For pods with multiple containers, specify which container:
"Show logs from container nginx in pod my-pod"
Claude Desktop Configuration
{
"mcpServers": {
"kubernetes": {
"command": "uv",
"args": ["run", "python", "-m", "mcp_server_k8s.server"]
}
}
}
Features
- kubectl_get - Get/list resources
- kubectl_get_paginated - Paginated resource listing
- kubectl_describe - Detailed resource descriptions
- kubectl_logs - Pod/deployment logs
- ping - Health check
- k8s-diagnose prompt - Troubleshooting flow
Development
# Install dev dependencies
uv pip install -e ".[dev]"
# Run tests
pytest