K8s MCP Server
@christian-schlichtherle
About K8s MCP Server
An MCP server for comprehensive access to one or more Kubernetes clusters
Basic information
Category
Cloud & Infrastructure
Transports
stdio
Publisher
christian-schlichtherle
Submitted by
Christian Schlichtherle
Config
Add this server to your MCP-compatible client using the configuration below.
{
"mcpServers": {
"k8s": {
"command": "uv",
"args": [
"--directory",
"/path/to/k8s-mcp",
"run",
"k8s-mcp"
],
"env": {
"KUBECONFIG_ALIASES": "development=dev production=prod",
"KUBECONFIG_URLS": "dev=file:///path/to/development/k3s/kubeconfig.yaml prod=file:///path/to/production/k3s/kubeconfig.yaml",
"PORT_FORWARD_CONFIG_URL": "file:///path/to/k8s-mcp/port-forward-config.yaml"
}
}
}
}Tools
No tools detected
We auto-extract tools from the README. The maintainer can list them under a ## Tools heading to populate this section.
Overview
What is K8s MCP Server?
K8s MCP Server is an AI-friendly Kubernetes access tool that supports enhanced port‑forward management, headless services, and kubectl‑inspired output formats. It is designed for AI agents and developers who need efficient, context‑aware interaction with Kubernetes clusters.
How to use K8s MCP Server?
Install dependencies with pip install -e ., set environment variables such as KUBECONFIG_URLS and PORT_FORWARD_CONFIG_URL, then run python main.py. The server provides MCP tools for reading, modifying, and discovering resources, along with port‑forward session management.
Key features of K8s MCP Server
- kubectl‑inspired output formats (table, wide, json, yaml, custom‑columns, jsonpath)
- Natural‑language resource kind discovery for CRDs and built‑in resources
- URL‑based port‑forward configuration via local files or GitHub Gists
- Headless service support with direct pod targeting via label selectors
- Token‑efficient AI‑optimized output and multi‑format config files (YAML, JSON, TOML)
- In‑memory port‑forward session tracking with list and teardown capabilities
Use cases of K8s MCP Server
- AI agents perform cluster overview, application debugging, and safe deployment updates
- Automated port‑forward setup for AI workflows (e.g., connecting to a Druid service in development)
- Resource cleanup and security audits using read‑only or modify tools
- Performance troubleshooting and disaster recovery with structured tool workflows
- Multi‑cluster resource discovery and exploration without manual kubectl commands
FAQ from K8s MCP Server
What Kubernetes resources can I list or query?
You can list pods, services, deployments, nodes, events, and any custom resource kind discovered via discover_resource_kinds. The server supports plural, singular, and abbreviated resource names (e.g., pods, pod, po), and case‑insensitive input.
How does the port‑forward configuration work?
Port‑forward targets are defined in a YAML/JSON/TOML file, referenced by PORT_FORWARD_CONFIG_URL. Each target specifies a cluster alias, namespace, label selectors, local port, and remote port. The AI agent can then use connect_to_service_targets to set up the forward.
Are the tools safe for autonomous AI use?
Tools are classified into three safety levels: [READ-ONLY] (safe for autonomous use, e.g., list_resources, get_logs), [MODIFIES STATE] (require user approval, e.g., apply_manifest, connect_to_service_targets), and [DANGEROUS] (require explicit confirmation, e.g., delete_resource, execute_in_pod).
Does K8s MCP Server support headless services?
Yes. For headless services, the server selects the first ready pod using label selectors, mimicking kubectl port-forward behavior. This is configured in the port‑forward config file under each service target.
What transport or authentication does the server use?
The server uses the MCP stdio transport and relies on existing Kubernetes authentication (kubeconfig) configured via the KUBECONFIG_URLS environment variable. It does not implement additional authentication layers.
More Cloud & Infrastructure MCP servers
MCP Server that interacts with Azure AI Foundry (experimental)
azure-ai-foundryA MCP Server for Azure AI Foundry: it's now moved to cloud, check the new Foundry MCP Server
Supabase MCP Server
supabase-communityConnect Supabase to your AI assistants
K8s MCP Server
alexei-ledK8s-mcp-server is a Model Context Protocol (MCP) server that enables AI assistants like Claude to securely execute Kubernetes commands. It provides a bridge between language models and essential Kubernetes CLI tools including kubectl, helm, istioctl, and argocd, allowing AI syste
MCP Gateway
mcp-ecosystem🧩 MCP Gateway - A lightweight gateway service that instantly transforms existing MCP Servers and APIs into MCP servers with zero code changes. Features Docker deployment and management UI, requiring no infrastructure modifications.
tfmcp: Terraform Model Context Protocol Tool
nwiizo🌍 Terraform Model Context Protocol (MCP) Tool - An experimental CLI tool that enables AI assistants to manage and operate Terraform environments. Supports reading Terraform configurations, analyzing plans, applying configurations, and managing state with Claude Desktop integrati
Comments