mcp-k8s
MCP server for Kubernetes that safely executes kubectl, helm, and cluster operations.
claude mcp add --transport stdio xwomen1-mcp-k8s-server go build -o k8s-mcp-server \ --env KUBECONFIG_PATH="Path to kubeconfig (e.g., /home/user/.kube/config)"
How to use
This Kubernetes MCP server provides a comprehensive, AI-assisted interface for managing Kubernetes clusters. Built with Go, it exposes a rich set of MCP tools that cover deployments, workloads, configuration management, observability, security, and multi-cluster operations. You can interact with the server using any MCP-compatible client (such as Claude, ChatGPT, Windsurf, or other MCP-enabled assistants) to perform tasks like applying manifests, managing workloads (Deployments, StatefulSets, DaemonSets, Jobs, CronJobs), monitoring resources, handling RBAC and Secrets, and coordinating across multiple clusters. The server supports real-time port-forwarding, service discovery, event filtering, and smart, safe resource updates via Server-Side Apply and dry-run validation, enabling both automation and careful human oversight when deploying to production.
To use it, start the server and point your MCP client to the server’s address. The client sends structured MCP requests to perform actions in Kubernetes, and the server returns results, including resources lists, status, logs, and metrics. Features like multi-cluster registration, dynamic context switching, and AI-driven session management allow you to manage several clusters from a single session while maintaining proper isolation and audit trails.
How to install
Prerequisites:
- Go 1.21+ installed on your machine
- Git installed
- Access to a Kubernetes cluster and a kubeconfig file
- Clone the repository
git clone https://github.com/yourusername/k8s-mcp-server.git
cd k8s-mcp-server
- Build the server
go build -o k8s-mcp-server
- Run the server with default configuration
./k8s-mcp-server
- Optional: prepare a client configuration snippet Create a client-side configuration (e.g., servers.k8s) that points to the built server:
{
"servers": {
"k8s": {
"command": "path/to/k8s-mcp-server",
"env": {
"KUBECONFIG_PATH": "/path/to/kubeconfig"
}
}
}
}
- Verify the server is responding by issuing a simple MCP request from your client (e.g., list deployments in a namespace) and confirm you receive a structured MCP response.
Additional notes
Tips and caveats:
- Ensure KUBECONFIG_PATH (or equivalent kubeconfig access) is correctly set so the server can authenticate to your clusters.
- The MCP server supports multi-cluster management; use distinct cluster IDs and contexts to avoid cross-cluster confusion.
- For production deployments, consider running the server in a container (Docker) and enabling TLS/authorization as appropriate for your environment.
- If you enable Server-Side Apply, ensure clients provide consistent field_manager identifiers (e.g., ai-provisioner) to improve merge behavior.
- The server offers dry-run validation to test manifests without creating resources; leverage this to validate changes before applying to your clusters.
Related MCP Servers
langchainjs -adapters
** THIS REPO HAS MOVED TO https://github.com/langchain-ai/langchainjs/tree/main/libs/langchain-mcp-adapters ** Adapters for integrating Model Context Protocol (MCP) tools with LangChain.js applications, supporting both stdio and SSE transports.
mcp-cyclops
Model Context Protocol server for Cyclops
hop
Fast, elegant SSH connection manager with a TUI dashboard and MCP server
devir
Dev Runner CLI - Terminal UI for managing multiple dev services with colored logs, filtering, and MCP integration for Claude Code
mcp-json-yaml-toml
A structured data reader and writer like 'jq' and 'yq' for AI Agents
mcp-tidy
CLI tool to visualize and manage MCP server configurations in Claude Code. List servers, analyze usage statistics, and clean up unused servers