About Kubernetes MCP Server
Kubernetes MCP Server exposes Kubernetes cluster operations to MCP clients, allowing cluster management through natural-language requests. It covers workloads, services, namespaces, and nodes, with metrics and maintenance operations.
Key features
- 01Filter and inspect pods
- 02Read pod logs and metrics
- 03Scale and manage deployment rollouts
- 04Inspect and expose services
- 05Create and manage namespaces
- 06Inspect and maintain nodes
Use cases
- 01Check pods and read their logs
- 02Scale a deployment or restart its rollout
- 03Expose a deployment as a service
- 04Drain a node for maintenance
MCP support
The MCP server makes Kubernetes operations available as tools to MCP clients, which can use natural language to request cluster actions.
Configuration
Local server config is the same for every client. Copy it into your client’s MCP config file.
We haven’t collected a package or remote endpoint for this server. Follow the instructions in the project README.
Tools
Local servers expose tools only once running on your machine, and the maintainer has not provided a tool list.
Details
From the project READMEKubernetes MCP Server
This is a Model Context Protocol (MCP) server that provides comprehensive Kubernetes functionality through the MCP Python SDK. It allows you to interact with your Kubernetes cluster using natural language through an MCP client.
Features
The server provides a wide range of Kubernetes operations organized into logical modules:
Pod Operations
- Get pods with filtering and output format options
- Describe specific pods
- Get pod logs with various options
- Execute commands in pods
- Get pod metrics
Deployment Operations
- Get deployments with filtering and output format options
- Describe specific deployments
- Scale deployments
- Manage deployment rollouts (status, history, restart, undo)
- Get deployment metrics
Service Operations
- Get services with filtering and output format options
- Describe specific services
- Expose deployments as services
- Port forward to services
Namespace Operations
- Get namespaces with filtering
- Describe specific namespaces
- Create and delete namespaces
- Get namespace resource quotas
Cluster Operations
- Get cluster information
- Get and describe nodes
- Manage node scheduling (cordon/uncordon)
- Drain nodes for maintenance
- Get cluster metrics
Prerequisites
- Python 3.7+
- kubectl installed and configured
- Access to a Kubernetes cluster
- MCP client (e.g., Claude Desktop)
Installation
- Clone this repository
- Install dependencies:
pip install -r requirements.txt
Usage
Running the Server
-
Development mode with MCP Inspector:
python -m mcp.inspector src/k8s_mcp_server.py -
Install in Claude Desktop:
python -m mcp.install src/k8s_mcp_server.py -
Run directly:
python src/k8s_mcp_server.py
Using the Tools
Once connected through an MCP client, you can use natural language to interact with your Kubernetes cluster. For example:
- "Get all pods in the default namespace"
- "Describe the deployment named 'nginx' in the 'web' namespace"
- "Get logs from the 'frontend' pod in the 'production' namespace"
- "Scale the 'backend' deployment to 3 replicas"
- "Create a new namespace called 'staging' with label environment=staging"
Project Structure
src/
├── k8s_mcp_server.py # Main server entry point
├── k8s_tools/ # Tool modules
│ ├── __init__.py
│ ├── pod_tools.py # Pod-related tools
│ ├── deployment_tools.py # Deployment-related tools
│ ├── service_tools.py # Service-related tools
│ ├── namespace_tools.py # Namespace-related tools
│ └── cluster_tools.py # Cluster-related tools
└── requirements.txt # Project dependencies
Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
License
This project is licensed under the MIT License - see the LICENSE file for details.
Comments
New to MCP?
From what the protocol is to installing your first server, these answers cover most first questions.
An open protocol that defines how AI applications connect to external tools and data in a uniform way. Clients talk to the model; MCP servers provide tools, resources and prompt templates. They exchange standard messages, so one server can be reused by many clients.