Cover image
Try Now
2025-04-07

Un servidor MCP ligero que proporciona procesamiento del lenguaje natural y acceso de API a clústeres de Kubernetes, que combina los comandos Kubectl y el cliente Kubernetes Python.

3 years

Works with Finder

1

Github Watches

0

Github Forks

0

Github Stars

Kubernetes MCP Server

Python Version License

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 mode Developer -> Edit config and open file claude_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.

相关推荐

  • Joshua Armstrong
  • Confidential guide on numerology and astrology, based of GG33 Public information

  • https://suefel.com
  • Latest advice and best practices for custom GPT development.

  • Emmet Halm
  • Converts Figma frames into front-end code for various mobile frameworks.

  • Elijah Ng Shi Yi
  • Advanced software engineer GPT that excels through nailing the basics.

  • lumpenspace
  • Take an adjectivised noun, and create images making it progressively more adjective!

  • https://maiplestudio.com
  • Find Exhibitors, Speakers and more

  • tomoyoshi hirata
  • Sony α7IIIマニュアルアシスタント

  • Carlos Ferrin
  • Encuentra películas y series en plataformas de streaming.

  • Yusuf Emre Yeşilyurt
  • I find academic articles and books for research and literature reviews.

  • apappascs
  • Descubra la colección más completa y actualizada de servidores MCP en el mercado. Este repositorio sirve como un centro centralizado, que ofrece un extenso catálogo de servidores MCP de código abierto y propietarios, completos con características, enlaces de documentación y colaboradores.

  • ShrimpingIt
  • Manipulación basada en Micrypthon I2C del expansor GPIO de la serie MCP, derivada de AdaFruit_MCP230xx

  • jae-jae
  • Servidor MCP para obtener contenido de la página web con el navegador sin cabeza de dramaturgo.

  • HiveNexus
  • Un bot de chat de IA para equipos pequeños y medianos, que apoyan modelos como Deepseek, Open AI, Claude y Gemini. 专为中小团队设计的 ai 聊天应用 , 支持 Deepseek 、 Open ai 、 Claude 、 Géminis 等模型。

  • ravitemer
  • Un poderoso complemento Neovim para administrar servidores MCP (protocolo de contexto del modelo)

  • patruff
  • Puente entre los servidores Ollama y MCP, lo que permite a LLM locales utilizar herramientas de protocolo de contexto del modelo

  • JackKuo666
  • 🔍 Habilitar asistentes de IA para buscar y acceder a la información del paquete PYPI a través de una interfaz MCP simple.

  • pontusab
  • La comunidad de cursor y windsurf, encontrar reglas y MCP

  • av
  • Ejecute sin esfuerzo LLM Backends, API, frontends y servicios con un solo comando.

    Reviews

    1 (1)
    Avatar
    user_9DbNm9N5
    2025-04-17

    As a dedicated user of the mcp-kubernetes-server by ductnn, I must say it has significantly streamlined our container orchestration. Its seamless integration and user-friendly interface make managing Kubernetes clusters a breeze. Highly recommend this to anyone looking for an efficient Kubernetes server solution.