Skip to main content

MCP Kubernetes Server for managing Kubernetes clusters through MCP protocol

Project description

MCP Kubernetes Server

smithery badge

This is an MCP (Model Context Protocol) server for Kubernetes that provides control over Kubernetes clusters through interactions with LLMs.

Overview

This client allows you to perform common Kubernetes operations through MCP tools. It wraps kubectl commands to provide a simple interface for managing Kubernetes resources. The Model Context Protocol (MCP) enables seamless interaction between language models and Kubernetes operations.

What is MCP?

Model Context Protocol (MCP) is a framework that enables Language Models to interact with external tools and services in a structured way. It provides:

  • A standardized way to expose functionality to language models
  • Context management for operations
  • Tool discovery and documentation
  • Type-safe interactions between models and tools

Usage Examples

  • Create a new deployment for me with name nginx-app and image nginx:latest in the production namespace with 3 replicas.
  • Update the deployment nginx-app to version 1.19 in the production namespace.
  • Scale the deployment nginx-app to 5 replicas in the production namespace.
  • Get me the pods in the production namespace.
  • Get me all namespaces in the cluster.
  • Get me all nodes in the cluster.
  • Get me all services in the cluster.
  • Get me all deployments in the cluster.
  • Get me all jobs in the cluster.
  • Get me all cronjobs in the cluster.
  • Get me all statefulsets in the cluster.
  • Get me all daemonsets in the cluster.
  • What is the current context.
  • list all contexts.
  • switch to context .
  • Get me the logs of pod in the production namespace.
  • Get me the events in the production namespace.
  • annotate pod with key1=value1 in the production namespace.
  • remove annotation key1 from pod in the production namespace.
  • add label key1=value1 to pod in the production namespace.
  • remove label key1 from pod in the production namespace.
  • expose deployment nginx-app in the production namespace on port 80.
  • port-forward pod,deployment,service with name in the production namespace to local port 8080.
  • delete pod, deployment, service, job, cronjob, statefulset, daemonset with name in the production namespace.

Upcoming Features

  • Create cluster role.
  • delete cluster role.
  • create cluster role binding.
  • delete cluster role binding.
  • create namespace.
  • delete namespace.
  • create service account.
  • delete service account.
  • create role.
  • delete role.
  • create role binding.a
  • delete role binding.

LLM Integration

This MCP client is designed to work seamlessly with Large Language Models (LLMs). The functions are decorated with @mcp.tool(), making them accessible to LLMs through the Model Context Protocol framework.

Example LLM Prompts

LLMs can interact with your Kubernetes cluster using natural language. Here are some example prompts:

  • "Create a new nginx deployment with 3 replicas in the production namespace"
  • "Scale the nginx-app deployment to 5 replicas"
  • "Update the image of nginx-app to version 1.19"

The LLM will interpret these natural language requests and call the appropriate MCP functions with the correct parameters.

Benefits of LLM Integration

  1. Natural Language Interface: Manage Kubernetes resources using conversational language
  2. Reduced Command Complexity: No need to remember exact kubectl syntax
  3. Error Prevention: LLMs can validate inputs and provide helpful error messages
  4. Context Awareness: LLMs can maintain context across multiple operations
  5. Structured Interactions: MCP ensures type-safe and documented interactions between LLMs and tools

Requirements

  • Kubernetes cluster access configured via kubectl
  • Python 3.x
  • MCP framework installed and configured

Security Note

When using this client with LLMs, ensure that:

  • Proper access controls are in place for your Kubernetes cluster
  • The MCP server is running in a secure environment
  • API access is properly authenticated and authorized

Usage with Claude Desktop

{
    "mcpServers": {
        "Kubernetes": {
            "command": "uv",
            "args": [
                "--directory",
                "~/mcp/mcp-k8s-server",
                "run",
                "kubernetes.py"
            ]
        }
    }
}

Contributing

We welcome contributions to the MCP Kubernetes Server! If you'd like to contribute:

  1. Fork the repository
  2. Create a new branch for your feature (git checkout -b feature/amazing-feature)
  3. Make your changes
  4. Write or update tests as needed
  5. Commit your changes (git commit -m 'Add some amazing feature')
  6. Push to your branch (git push origin feature/amazing-feature)
  7. Open a Pull Request

For major changes, please open an issue first to discuss what you would like to change.

Installing via Smithery

To install Kubernetes Server for Claude Desktop automatically via Smithery:

npx -y @smithery/cli install @abhijeetka/mcp-k8s-server --client claude

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

iflow_mcp_mcp_k8s_server-0.1.0.tar.gz (5.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

iflow_mcp_mcp_k8s_server-0.1.0-py3-none-any.whl (6.0 kB view details)

Uploaded Python 3

File details

Details for the file iflow_mcp_mcp_k8s_server-0.1.0.tar.gz.

File metadata

  • Download URL: iflow_mcp_mcp_k8s_server-0.1.0.tar.gz
  • Upload date:
  • Size: 5.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.10 {"installer":{"name":"uv","version":"0.9.10"},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for iflow_mcp_mcp_k8s_server-0.1.0.tar.gz
Algorithm Hash digest
SHA256 77e358d34661f59efde95038d3eec4e585c2554eb7beea5e1a97a39ff47b679f
MD5 e6dacd60457a1c05386cf2e82468a9fe
BLAKE2b-256 a2a00d1764b8f2ad894bc790c63c74ef21593d6b361280369793c50a3c3689ff

See more details on using hashes here.

File details

Details for the file iflow_mcp_mcp_k8s_server-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: iflow_mcp_mcp_k8s_server-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 6.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.9.10 {"installer":{"name":"uv","version":"0.9.10"},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for iflow_mcp_mcp_k8s_server-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 8288c78795c0311178448d6b65b5774079addcd7eb1cd22d4333d938cee181ba
MD5 791f138ff759b3ed4c4a2cbc5af97fea
BLAKE2b-256 c4b6786ec3e67a0ea0e170a5b7b9c88d0f54314171d06d3ffe1a0aa165539f9f

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page