Kubernetes MCP Server

by endo-sys

241 downloads
Not rated
GitHub

Description

# Kubernetes 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…

About

# Kubernetes 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…

Details

Author
endo-sys
Downloads
241
Categories
Cloud Service

- Get, describe, and filter pods
- Execute commands in pods
- Get pod logs and metrics
- Scale deployments and manage rollouts
- Expose deployments as services
- Port forward to services
- Create and delete namespaces
- Cordon, uncordon, and drain nodes

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 MCP Server
    Command (node, npx, python, etc.)

    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

Clone the repository, install dependencies with pip install -r requirements.txt, then run the server via MCP Inspector, install it in Claude Desktop, or execute directly. Once connected, issue natural language commands like “Get all pods in the default namespace” or “Scale the backend deployment to 3 replicas.”

Claude Desktop / Cursor

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

{
    "mcpServers": {
        "kubernetes mcp server": {
            "kubernecetes-mcp-server": {
                "command": "python",
                "args": [
                    "-m",
                    "mcp.inspector",
                    "src/k8s_mcp_server.py"
                ]
            }
        }
    }
}

McpServers

{
    "kubernecetes-mcp-server": {
        "command": "python",
        "args": [
            "-m",
            "mcp.inspector",
            "src/k8s_mcp_server.py"
        ]
    }
}

Kubernetes 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

1. Clone this repository 2. Install dependencies: ``bash pip install -r requirements.txt `

Usage

Running the Server

1. Development mode with MCP Inspector:
`bash python -m mcp.inspector src/k8s_mcp_server.py ` 2. Install in Claude Desktop: `bash python -m mcp.install src/k8s_mcp_server.py ` 3. Run directly: `bash 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.
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.