mcp-server-kubernetes-read-only

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

ToolDescriptionKey Parameters
kubectl_getGet/list resourcesresourceType, name, namespace, labelSelector
kubectl_get_paginatedPaginated listingresourceType, namespace, limit, continue
kubectl_describeDetailed resource inforesourceType, name, namespace
kubectl_logsContainer logsresourceType, name, namespace, container, tail
pingHealth checknone

Troubleshooting

"Unable to connect to cluster"

Check that:

  1. ~/.kube/config exists and is valid
  2. Current context is set: kubectl config current-context
  3. You have network access to the cluster

"Resource not found"

Verify:

  1. Resource name is correct
  2. Namespace is correct (default: "default")
  3. 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