mcp-k8s

mcp-k8s

A Kubernetes MCP (Model Control Protocol) server that enables interaction with Kubernetes clusters through MCP tools.

silenceper

Developer Tools
Visit Server

README

mcp-k8s

A Kubernetes MCP (Model Control Protocol) server that enables interaction with Kubernetes clusters through MCP tools.

Features

  • Query supported Kubernetes resource types (built-in resources and CRDs)
  • Perform CRUD operations on Kubernetes resources
  • Configurable write operations (create/update/delete can be enabled/disabled independently)
  • Connects to Kubernetes cluster using kubeconfig

Preview

Interaction through cursor

Use Cases

1. Kubernetes Resource Management via LLM

  • Interactive Resource Management: Manage Kubernetes resources through natural language interaction with LLM, eliminating the need to memorize complex kubectl commands
  • Batch Operations: Describe complex batch operation requirements in natural language, letting LLM translate them into specific resource operations
  • Resource Status Queries: Query cluster resource status using natural language and receive easy-to-understand responses

2. Automated Operations Scenarios

  • Intelligent Operations Assistant: Serve as an intelligent assistant for operators in daily cluster management tasks
  • Problem Diagnosis: Assist in cluster problem diagnosis through natural language problem descriptions
  • Configuration Review: Leverage LLM's understanding capabilities to help review and optimize Kubernetes resource configurations

3. Development and Testing Support

  • Quick Prototype Validation: Developers can quickly create and validate resource configurations through natural language
  • Environment Management: Simplify test environment resource management, quickly create, modify, and clean up test resources
  • Configuration Generation: Automatically generate resource configurations that follow best practices based on requirement descriptions

4. Education and Training Scenarios

  • Interactive Learning: Newcomers can learn Kubernetes concepts and operations through natural language interaction
  • Best Practice Guidance: LLM provides best practice suggestions during resource operations
  • Error Explanation: Provide easy-to-understand error explanations and correction suggestions when operations fail

Architecture

1. Project Overview

An stdio-based MCP server that connects to Kubernetes clusters and provides the following capabilities:

  • Query Kubernetes resource types (including built-in resources and CRDs)
  • CRUD operations on Kubernetes resources (with configurable write operations)

2. Technical Stack

  • Go
  • mcp-go SDK
  • Kubernetes client-go library
  • Stdio for communication

3. Core Components

  1. MCP Server: Uses mcp-go's server package to create an stdio-based MCP server
  2. K8s Client: Uses client-go to connect to Kubernetes clusters
  3. Tool Implementations: Implements various MCP tools for different Kubernetes operations

4. Available Tools

Resource Type Query Tools

  • get_api_resources: Get all supported API resource types in the cluster

Resource Operation Tools

  • get_resource: Get detailed information about a specific resource
  • list_resources: List all instances of a resource type
  • create_resource: Create new resources (can be disabled)
  • update_resource: Update existing resources (can be disabled)
  • delete_resource: Delete resources (can be disabled)

Getting Started

Direct Usage

You can directly download the binary for your platform from the releases page and use it immediately.

Build

git clone https://github.com/silenceper/mcp-k8s.git
cd mcp-k8s
go build -o bin/mcp-k8s cmd/server/main.go

Run

Default mode (read-only operations):

./bin/mcp-k8s --kubeconfig=/path/to/kubeconfig

Enable write operations:

./bin/mcp-k8s --kubeconfig=/path/to/kubeconfig --enable-create --enable-update --enable-delete

Command Line Arguments

  • --kubeconfig: Path to Kubernetes configuration file (uses default config if not specified)
  • --enable-create: Enable resource creation operations (default: false)
  • --enable-update: Enable resource update operations (default: false)
  • --enable-delete: Enable resource deletion operations (default: false)

Integration with MCP Clients

mcp-k8s is an stdio-based MCP server that can be integrated with any MCP-compatible LLM client. Refer to your MCP client's documentation for integration instructions.

Security Considerations

  • Write operations are strictly controlled through independent configuration switches
  • Uses RBAC to ensure K8s client has only necessary permissions
  • Validates all user inputs to prevent injection attacks

Follow WeChat Official Account

AI技术小林

Recommended Servers

playwright-mcp

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.

Official
Featured
TypeScript
Magic Component Platform (MCP)

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.

Official
Featured
Local
TypeScript
MCP Package Docs Server

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.

Featured
Local
TypeScript
Claude Code MCP

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.

Featured
Local
JavaScript
@kazuph/mcp-taskmanager

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

Featured
Local
JavaScript
Linear MCP Server

Linear MCP Server

Enables interaction with Linear's API for managing issues, teams, and projects programmatically through the Model Context Protocol.

Featured
JavaScript
mermaid-mcp-server

mermaid-mcp-server

A Model Context Protocol (MCP) server that converts Mermaid diagrams to PNG images.

Featured
JavaScript
Jira-Context-MCP

Jira-Context-MCP

MCP server to provide Jira Tickets information to AI coding agents like Cursor

Featured
TypeScript
Linear MCP Server

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.

Featured
JavaScript
Sequential Thinking MCP Server

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.

Featured
Python