home / mcp / kubernetes tools mcp server

Kubernetes Tools MCP Server

Exposes Kubernetes read-only tooling as an MCP server for agents to query namespaces, pods, deployments, services, events, and logs.

Installation
Add the following to your MCP client configuration file.

Configuration

View docs
{
  "mcpServers": {
    "benedatllc-k8stools": {
      "command": "k8s-mcp-server",
      "args": [],
      "env": {
        "KUBECONFIG": "path/to/kubeconfig"
      }
    }
  }
}

You run a Kubernetes-focused MCP server that exposes your cluster tools over a simple, queryable interface. This server lets you interact with Kubernetes data through an MCP client, enabling read-only monitoring and root-cause analysis workflows in a safe, tool-driven way.

How to use

Connect your MCP client to the available Kubernetes tools to fetch read-only data about your cluster. You can run the server locally and choose a transport that fits your workflow: use the stdio transport for local Coding Agents and the streamable HTTP transport for remote access. Once the MCP server is running, you can request pod, node, deployment, service information, logs, events, and more through the provided tools. Use the tools to build monitoring queries, RCA scenarios, or to power your custom chat UI with live cluster data.

How to install

Prerequisites: you need Python and a package manager to install and run the MCP server tools.

Install the Kubernetes tools package with Python's package manager:

pip install k8stools

Configuration and usage notes

The server can be run in two main ways: as a local stdio server or as a streamable HTTP server. The stdio configuration is tailored for local development with Coding Agents, while the HTTP option allows remote access.

Additional sections

Mock tools are available to test agents without connecting to a real Kubernetes cluster. Enable mock data when starting the MCP server to return realistic static values for testing.

Instruction files for Copilot-style agents can be customized to guide how the tools are used in your environment. Save additional instructions in your workspace to tailor agent behavior to your cluster.

Available tools

get_namespaces

Retrieve a list of Kubernetes namespaces, similar to the kubectl get namespaces command.

get_node_summaries

Fetch a summary of nodes in the cluster, including wide output details.

get_pod_summaries

Return a list of pods with extended information comparable to kubectl get pods -o wide.

get_pod_container_statuses

Return the status of each container within a specified pod.

get_pod_events

Retrieve events related to a specific pod to aid in RCA.

get_pod_spec

Retrieve the pod specification for a given pod.

get_logs_for_pod_and_container

Fetch logs from a specified pod and container, useful for debugging.

get_deployment_summaries

List deployments with pertinent details similar to kubectl get deployments.

get_service_summaries

List services in the cluster with key metadata and status.

print_namespaces

Helper to pretty-print the list of namespaces.

print_node_summaries

Helper to format node summaries for quick review.

print_pod_summaries

Helper to display pod summaries in a readable format.

print_pod_container_statuses

Helper to show container statuses in a readable table.

print_pod_events

Helper to present pod events clearly.

print_pod_spec

Helper to present pod specifications in a readable form.

print_deployment_summaries

Helper to display deployment summaries succinctly.

print_service_summaries

Helper to present service summaries clearly.