Kubernetes MCP Server
A lightweight MCP server that provides natural language processing and API access to Kubernetes clusters, combining both kubectl commands and Kubernetes Python client.
ductnn
README
Kubernetes MCP Server
A lightweight MCP server that provides natural language processing and API access to Kubernetes clusters, combining both kubectl commands and Kubernetes Python client.
https://github.com/user-attachments/assets/48e061cd-3e85-40ff-ab04-a1a2b9bbd152
✨ Features
- Natural Language Interface: Convert plain English queries to kubectl commands
- List pods and deployments across all namespaces
- Fallback to general resource listing for unsupported queries
- Full CRUD Operations:
- 🆕 Create/Delete namespaces, pods, and deployments via API endpoints
- 🔍 Inspect cluster resources
- ✏️ Modify labels, annotations, and deployment configurations
- 🗑️ Graceful deletion
- 📊 Scale deployments
- Dual Execution Mode:
kubectl
command integration- Kubernetes Python client (official SDK)
- Advanced Capabilities:
- Namespace validation (DNS-1123 compliant)
- Label filtering
- Grace period control
- Automatic command fallback
- Resource management (CPU, memory)
- Environment variable configuration
📦 Installation
Prerequisites
- Python 3.11+
- Kubernetes cluster access
kubectl
configured locally- UV installed
# Clone repository
git clone https://github.com/ductnn/mcp-kubernetes-server.git
cd mcp-kubernetes-server
# Create virtual environment
uv venv .venv
# Activate (Unix)
source .venv/bin/activate
# Install dependencies
uv pip install -r requirements.txt
🚀 Usage
Natural Language Processing
The server supports basic natural language queries for listing resources:
# List all pods
result = nl_processor.process("Show me all pods")
# List all deployments
result = nl_processor.process("Show me all deployments")
# Query with namespace
result = nl_processor.process("Show me all resources", "kube-system")
For more complex operations, use the dedicated API endpoints:
# Create a pod
pod_service.create_pod(
name="my-pod",
namespace="default",
image="nginx:latest",
labels={"app": "my-app"}
)
# Create a deployment
deployment_service.create_deployment(
name="my-deployment",
namespace="default",
image="nginx:latest",
replicas=3
)
# Delete a namespace
namespace_service.delete("my-namespace", force=True)
API Endpoints
The server provides RESTful endpoints for all operations:
/api/pods
- Pod operations/api/deployments
- Deployment operations/api/namespaces
- Namespace operations/api/cluster
- Cluster operations/api/nlp
- Natural language processing
🤖 Usage with AI Assistants
Claude Desktop
- Open your Claude Desktop and choose
Settings
-> choose modeDeveloper
->Edit config
and open fileclaude_desktop_config.json
and edit:
{
"mcpServers": {
"kubernetes": {
"command": "/path-to-your-uv/uv",
"args": [
"--directory",
"/path-you-project/", // Example for me /Users/ductn/mcp-kubernetes-server
"run",
"main.py"
]
}
}
}
- Then, restart your Claude Desktop and play :)
🧪 Testing
Run the test suite:
# Run all tests
pytest
# Run specific test file
pytest tests/unit/test_pod_service.py
# Run with coverage
pytest --cov=.
📝 License
This project is licensed under the MIT License - see the LICENSE file for details.
Recommended Servers
playwright-mcp
A Model Context Protocol server that enables LLMs to interact with web pages through structured accessibility snapshots without requiring vision models or screenshots.
Magic Component Platform (MCP)
An AI-powered tool that generates modern UI components from natural language descriptions, integrating with popular IDEs to streamline UI development workflow.
MCP Package Docs Server
Facilitates LLMs to efficiently access and fetch structured documentation for packages in Go, Python, and NPM, enhancing software development with multi-language support and performance optimization.
Claude Code MCP
An implementation of Claude Code as a Model Context Protocol server that enables using Claude's software engineering capabilities (code generation, editing, reviewing, and file operations) through the standardized MCP interface.
@kazuph/mcp-taskmanager
Model Context Protocol server for Task Management. This allows Claude Desktop (or any MCP client) to manage and execute tasks in a queue-based system.
Linear MCP Server
Enables interaction with Linear's API for managing issues, teams, and projects programmatically through the Model Context Protocol.
mermaid-mcp-server
A Model Context Protocol (MCP) server that converts Mermaid diagrams to PNG images.
Jira-Context-MCP
MCP server to provide Jira Tickets information to AI coding agents like Cursor

Linear MCP Server
A Model Context Protocol server that integrates with Linear's issue tracking system, allowing LLMs to create, update, search, and comment on Linear issues through natural language interactions.

Sequential Thinking MCP Server
This server facilitates structured problem-solving by breaking down complex issues into sequential steps, supporting revisions, and enabling multiple solution paths through full MCP integration.