home / mcp / mcp kubernetes server

MCP Kubernetes Server

This is an MCP kubernetes Server.

Installation
Add the following to your MCP client configuration file.

Configuration

View docs
{
  "mcpServers": {
    "abhijeetka-mcp-k8s-server": {
      "command": "uv",
      "args": [
        "--directory",
        "~/mcp/mcp-k8s-server",
        "run",
        "kubernetes.py"
      ]
    }
  }
}

You can manage Kubernetes clusters from conversations with language models. This MCP server bridges typical Kubernetes operations to an LLM-enabled workflow, letting you perform common actions safely and with context management through the Model Context Protocol.

How to use

You interact with Kubernetes resources by describing what you want to achieve in natural language. The MCP server translates your request into safe, structured actions that wrap around Kubernetes operations. You can create deployments, scale resources, fetch resource lists (pods, namespaces, nodes, services, deployments, jobs, cronjobs, statefulsets, daemonsets), view logs and events, annotate or label resources, expose services, and perform port-forwarding or deletions. The interface maintains context across steps so you can build multi-step workflows like creating a deployment, then updating its image, and finally verifying the rollout status.

What you can do with Kubernetes MCP

  • Create a new deployment named nginx-app using image nginx:latest in the production namespace with 3 replicas
  • Update the deployment nginx-app to version 1.19 in the production namespace
  • Scale the deployment nginx-app to 5 replicas in the production namespace
  • List pods, namespaces, nodes, services, deployments, jobs, cronjobs, statefulsets, and daemonsets
  • Get current context and switch contexts
  • Fetch logs for a specific pod in a namespace
  • Get events in a namespace
  • Annotate or remove annotations on pods in a namespace
  • Add or remove labels on pods in a namespace
  • Expose a deployment in a namespace on a port
  • Port-forward a resource to a local port
  • Delete various resource types by name in a namespace

Security and governance considerations

Ensure you have proper access controls for your Kubernetes cluster. Run the MCP server in a secure environment and use proper authentication and authorization for API access. When communicating with language models, validate inputs and maintain least-privilege access for all operations.