How would you build an MCP server that exposes Kubernetes pod status?
IntermediateHands-onMCP (Model Context Protocol)
Answer
Use an official MCP SDK (Python or TypeScript). Define read-only tools such as list_pods(namespace, label), get_pod_logs(namespace, pod, lines) and get_events(namespace), backed by a service account with only get, list and watch permissions on pods, logs and events. Validate inputs, cap output sizes, and run it over stdio for local use first.