mc

mcp-k8s-go

Kubernetes cluster operations through MCP

Publishermcp-k8s-go
Submitted date4/13/2025

Bridging the Gap: Kubernetes Integration with LLMs via the Model Context Protocol

Unlock the power of Large Language Models (LLMs) within your Kubernetes environment using the Model Context Protocol (MCP). This Golang-based server provides a seamless interface for LLMs to interact with your cluster, enabling intelligent automation, insightful analysis, and more.

Key Features

This MCP server empowers LLMs with the ability to:

  • Contextual Awareness:
    • List available Kubernetes contexts, providing a clear understanding of the accessible environments.
    • Enumerate Kubernetes namespaces, allowing for targeted operations within specific areas of your cluster.
  • Resource Management:
    • List and retrieve any Kubernetes resource, from pods and services to deployments and custom resources.
    • Leverage custom mappings for common resources like pods, services, and deployments for simplified access.
  • Node Insights:
    • List Kubernetes nodes, providing a comprehensive view of the cluster's infrastructure.
  • Pod Interaction:
    • List Kubernetes pods, enabling targeted analysis and management.
    • Retrieve Kubernetes pod logs, facilitating debugging and performance monitoring.
    • Execute commands within Kubernetes pods, enabling dynamic interaction and automation.
  • Event Monitoring:
    • Get Kubernetes events, providing real-time insights into cluster activity.

Interactive Exploration with Inspector

Quickly explore the capabilities of this MCP server using the Inspector tool:

npx @modelcontextprotocol/inspector npx @strowk/mcp-k8s

This command launches the Inspector, allowing you to interact with the server and discover its functionalities.

Seamless Integration with Claude

This MCP server is designed for easy integration with Claude, enabling you to leverage the power of LLMs within your Kubernetes workflows.

Installation Options

Choose the installation method that best suits your environment:

MethodPrerequisitesClaude Setup
SmitheryNode.jsAutomatic
mcp-getNode.jsAutomatic
Pre-built NPMNode.jsManual
GitHub ReleasesNoneManual
Build from SourceGolangManual
DockerDockerManual

Detailed Installation Guides

Using Smithery

Automated installation via Smithery:

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

Using mcp-get

Automated installation via mcp-get:

npx @michaellatman/mcp-get@latest install @strowk/mcp-k8s

Pre-built NPM Package

  1. Install the package globally:

    npm install -g @strowk/mcp-k8s
  2. Verify the installation:

    mcp-k8s --version
  3. Configure Claude by adding the following to your claude_desktop_config.json:

    { "mcpServers": { "mcp_k8s": { "command": "mcp-k8s", "args": [] } } }

    Alternatively, use npx for execution:

    npx @strowk/mcp-k8s

    And configure Claude:

    { "mcpServers": { "mcp_k8s": { "command": "npx", "args": [ "@strowk/mcp-k8s" ] } } }

GitHub Releases

  1. Download the appropriate binary from the GitHub releases page.

  2. Extract the archive and place the mcp-k8s-go binary in your system's PATH.

  3. Configure Claude by adding the following to your claude_desktop_config.json:

    { "mcpServers": { "mcp_k8s": { "command": "mcp-k8s-go", "args": [] } } }

Building from Source

  1. Ensure you have Golang installed.

  2. Obtain and install the project:

    go get github.com/strowk/mcp-k8s-go go install github.com/strowk/mcp-k8s-go
  3. Configure Claude by adding the following to your claude_desktop_config.json:

    { "mcpServers": { "mcp_k8s_go": { "command": "mcp-k8s-go", "args": [] } } }

Using Docker

  1. Run the Docker image, mounting your Kubernetes configuration:

    docker run -i -v ~/.kube/config:/home/nonroot/.kube/config --rm mcpk8s/server:latest

    Note: Windows users may need to adjust the path to their kubeconfig file (e.g., //c/Users/<username>/.kube/config in Git Bash).

  2. Configure Claude by adding the following to your claude_desktop_config.json:

    { "mcpServers": { "mcp_k8s_go": { "command": "docker", "args": [ "run", "-i", "-v", "~/.kube/config:/home/nonroot/.kube/config", "--rm", "mcpk8s/server:latest" ] } } }

Configuration Options

  • Environment Variables:
    • KUBECONFIG: Specifies the path to your Kubernetes configuration file (defaults to ~/.kube/config).
  • Command-line Options:
    • --allowed-contexts=<ctx1,ctx2,...>: Restricts access to specific Kubernetes contexts. If omitted, all contexts are accessible.
    • --help: Displays help information.
    • --version: Displays version information.

By integrating this MCP server, you can unlock a new level of intelligence and automation within your Kubernetes environment, empowering LLMs to drive efficiency and innovation.

Visit More

View All