MCP-K8S is an AI-driven Kubernetes resource management tool that allows users to operate any resources in Kubernetes clusters through natural language interaction, including native resources (like Deployment, Service) and custom resources (CRD). No need to memorize complex commands - just describe your needs, and AI will accurately execute the corresponding cluster operations, greatly enhancing the usability of Kubernetes.
mcp-k8s
- A Model Context Protocol Server for Seamless Cluster Interactionmcp-k8s
bridges the gap between Large Language Models (LLMs) and Kubernetes clusters, enabling intuitive and powerful management through natural language. This open-source project provides a robust and secure Model Control Protocol (MCP) server, empowering users to interact with their Kubernetes infrastructure in a revolutionary way.
kubeconfig
files, adhering to established security best practices.kubectl
syntax.mcp-k8s
is a robust MCP server designed for seamless interaction with Kubernetes clusters. It leverages standard input/output (stdio) for communication and provides a comprehensive suite of tools for managing Kubernetes resources.
mcp-go
SDK: Utilizes the mcp-go
SDK (https://github.com/mark3labs/mcp-go) for streamlined MCP server development.client-go
Library: Leverages the official Kubernetes client-go
library for secure and reliable communication with Kubernetes clusters.server
package from mcp-go
.client-go
library.get_api_resources
: Retrieves a comprehensive list of all supported API resource types within the cluster.get_resource
: Retrieves detailed information about a specific Kubernetes resource.list_resources
: Lists all instances of a particular resource type.create_resource
: Creates new Kubernetes resources (can be disabled).update_resource
: Updates existing Kubernetes resources (can be disabled).delete_resource
: Deletes Kubernetes resources (can be disabled).mcp-k8s
supports two communication modes:
In stdio mode, mcp-k8s
communicates with the client through standard input/output streams. This is the default mode and is suitable for most use cases.
# Run in stdio mode (default) { "mcpServers": { "mcp-k8s": { "command": "/path/to/mcp-k8s", "args": [ "-kubeconfig", "/path/to/kubeconfig", "-enable-create", "-enable-delete", "-enable-update", "-enable-list" ] } } }
In SSE (Server-Sent Events) mode, mcp-k8s
exposes an HTTP endpoint to mcp client. You can deploy the service on a remote server (but you need to pay attention to security).
# Run in SSE mode ./bin/mcp-k8s -kubeconfig=/path/to/kubeconfig -transport=sse -port=8080 -host=localhost -enable-create -enable-delete -enable-list -enable-update # This command will open all operations
mcp config
{ "mcpServers": { "mcp-k8s": { "url": "http://localhost:8080/sse", "args": [] } } }
SSE mode configuration:
-transport
: Set to "sse" to enable SSE mode-port
: HTTP server port (default: 8080)--host
: HTTP server host (default: "localhost")Download pre-built binaries for your platform from the releases page for immediate use.
git clone https://github.com/silenceper/mcp-k8s.git cd mcp-k8s go build -o bin/mcp-k8s cmd/server/main.go
-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
).-enable-list
: Enable resource list operations (default: true
).-transport
: Transport type (stdio
or sse
) (default: "stdio"
).-host
: Host for SSE transport (default "localhost"
).-port
: TCP port for SSE transport (default 8080
).mcp-k8s
is an stdio-based MCP server that seamlessly integrates with any MCP-compatible LLM client. Refer to your MCP client's documentation for specific integration instructions.
Follow our WeChat Official Account for the latest updates and insights!
📇 A gateway demo for MCP SSE Server.
🐍 ☁️ A lightweight mcp server that tells you exactly what time is it.
#️⃣ 🏠 A C# SDK for building MCP servers on .NET 9 with NativeAOT compatibility ⚡ 🔌
☕ Java SDK for building MCP servers using Quarkus.