Kubernetes

by abhijeetka

6 stars
200 downloads
Not rated
GitHub

About

Bridges natural language interactions with Kubernetes clusters by wrapping kubectl commands, enabling conversational management of pods, deployments, contexts, and troubleshooting without requiring exact syntax knowledge.

Details

Author
abhijeetka
Repository
abhijeetka/mcp-k8s-server
GitHub stars
6
Downloads
200
Categories
Cloud Service, Other, Infrastructure, Productivity, Design, Developer Tools, AI, Frontend

- 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.

Setting up with Highlight

This MCP is not yet compatible with Highlight’s one-click setup. However, you can still use it with Highlight by following these steps:

  1. Download and install Highlight from highlightai.com/download
  2. Navigate to the plugins tab and select "Add Custom Plugin"
  3. Configure the plugin with the settings below
    Plugin Name Kubernetes
    Command (node, npx, python, etc.) uv
    Arguments
    • Argument 1 --directory
    • Argument 2 ~/mcp/mcp-k8s-server
    • Argument 3 run
    • Argument 4 kubernetes.py

    Please refer to the README for specific instructions on how to obtain API keys or other required environment variables.

  4. Enable "Start Automatically" if you want the plugin to start when Highlight launches

From the repository

- 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 <context-name>.
- Get me the logs of pod <pod-name> in the production namespace.
- Get me the events in the production namespace.
- annotate pod <pod-name> with key1=value1 in the production namespace.
- remove annotation key1 from pod <pod-name> in the production namespace.
- add label key1=value1 to pod <pod-name> in the production namespace.
- remove label key1 from pod <pod-name> in the production namespace.
- expose deployment nginx-app in the production namespace on port 80.
- port-forward pod,deployment,service with name <resource-name> in the production namespace to local port 8080.
- delete pod, deployment, service, job, cronjob, statefulset, daemonset with name <resource-name> in the production namespace.

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

To install Kubernetes Server for Claude Desktop automatically via Smithery:

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

create_deployment

Create a new deployment with a specified name, image, namespace, and number of replicas.

update_deployment

Update an existing deployment to a specified version in a given namespace.

scale_deployment

Scale an existing deployment to a specified number of replicas in a given namespace.

get_pods

Retrieve a list of all pods in a specified namespace.

get_namespaces

Retrieve a list of all namespaces in the Kubernetes cluster.

get_nodes

Retrieve a list of all nodes in the Kubernetes cluster.

get_services

Retrieve a list of all services in the Kubernetes cluster.

get_deployments

Retrieve a list of all deployments in the Kubernetes cluster.

get_jobs

Retrieve a list of all jobs in the Kubernetes cluster.

get_cronjobs

Retrieve a list of all cronjobs in the Kubernetes cluster.

get_statefulsets

Retrieve a list of all statefulsets in the Kubernetes cluster.

get_daemonsets

Retrieve a list of all daemonsets in the Kubernetes cluster.

get_current_context

Retrieve the current context being used in the Kubernetes configuration.

list_contexts

List all contexts available in the Kubernetes configuration.

switch_context

Switch to a specified context in the Kubernetes configuration.

get_pod_logs

Retrieve the logs of a specified pod in a given namespace.

get_events

Retrieve events in a specified namespace.

annotate_pod

Add an annotation to a specified pod in a given namespace.

remove_annotation

Remove a specified annotation from a pod in a given namespace.

add_label

Add a label to a specified pod in a given namespace.

remove_label

Remove a specified label from a pod in a given namespace.

expose_deployment

Expose a specified deployment in a given namespace on a specified port.

port_forward

Forward ports for a specified resource (pod, deployment, or service) in a given namespace to a local port.

delete_resource

Delete a specified resource (pod, deployment, service, job, cronjob, statefulset, daemonset) in a given namespace.

Claude Desktop / Cursor

Paste into your MCP client config file to install this server.

{
    "mcpServers": {
        "kubernetes": {
            "cwd": null,
            "env": {},
            "args": [
                "--directory",
                "~/mcp/mcp-k8s-server",
                "run",
                "kubernetes.py"
            ],
            "shell": false,
            "command": "uv"
        }
    }
}

Linux

{
    "cwd": null,
    "env": [],
    "args": [
        "--directory",
        "~/mcp/mcp-k8s-server",
        "run",
        "kubernetes.py"
    ],
    "shell": false,
    "command": "uv"
}

Macos

{
    "cwd": null,
    "env": [],
    "args": [
        "--directory",
        "~/mcp/mcp-k8s-server",
        "run",
        "kubernetes.py"
    ],
    "shell": false,
    "command": "uv"
}

Windows

{
    "cwd": null,
    "env": [],
    "args": [
        "--directory",
        "~/mcp/mcp-k8s-server",
        "run",
        "kubernetes.py"
    ],
    "shell": false,
    "command": "uv"
}

MCP Kubernetes Server

![](https://badge.mcpx.dev?type=server 'MCP 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 <context-name>.
- Get me the logs of pod <pod-name> in the production namespace.
- Get me the events in the production namespace.
- annotate pod <pod-name> with key1=value1 in the production namespace.
- remove annotation key1 from pod <pod-name> in the production namespace.
- add label key1=value1 to pod <pod-name> in the production namespace.
- remove label key1 from pod <pod-name> in the production namespace.
- expose deployment nginx-app in the production namespace on port 80.
- port-forward pod,deployment,service with name <resource-name> in the production namespace to local port 8080.
- delete pod, deployment, service, job, cronjob, statefulset, daemonset with name <resource-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
No reviews yet — be the first

Sign in to leave a review

Use Google, GitHub, or an email account so ratings stay tied to real people.

Email sign in

No reviews posted yet.