mcp-k8s-go
Author: strowk
Description: Golang-based Model-Context-Protocol (MCP) server that exposes Kubernetes clusters as a set of chat-accessible resources and tools (list/get/create/modify resources, fetch logs, exec, etc.).
Stars: 330
Forks: 41
License: MIT License
Category: Open Source
GitHub Website Documentation NPM
Overview
Transform Your Kubernetes Development with Augment Code + MCP-K8s-Go
Turn Augment Code into your ultimate Kubernetes development companion with this powerful MCP server that connects your AI assistant directly to your K8s clusters. No more context switching between your IDE, terminal, and kubectl commands—Augment can now manage your entire Kubernetes workflow while you focus on writing code.
Seamless K8s Integration in Your Coding Flow
With MCP-K8s-Go configured in Augment Code, your AI assistant gains direct access to your Kubernetes environments. Ask Augment to "check if my microservice pods are healthy in the staging namespace" and watch it query your cluster, analyze pod status, and even pull logs to identify issues—all without leaving your coding session. When debugging a deployment issue, simply tell Augment "show me the recent events and logs for the failing pods" and it will gather comprehensive diagnostics from your cluster in seconds.
The real power emerges during active development: as you modify your application code, Augment can simultaneously check resource utilization, validate configurations, execute commands in running pods, and even create new resources based on your code changes. Whether you're troubleshooting a memory leak by examining pod metrics, testing API endpoints by exec'ing into containers, or scaling deployments based on load patterns, Augment becomes your intelligent Kubernetes operator that understands both your code and your infrastructure.
Configuration for Augment Code
Install the server via npm and add this to your Augment Code settings:
{
"mcpServers": {
"k8s": {
"command": "npx",
"args": ["@strowk/mcp-k8s"],
"env": {
"KUBECONFIG": "/path/to/your/.kube/config"
}
}
}
}
For production environments, use the --allowed-contexts and --readonly flags to restrict Augment's cluster access while maintaining powerful debugging capabilities. Now you can code with confidence knowing your AI assistant has full visibility into your Kubernetes infrastructure.
Installation
Prerequisites
• Go 1.22 or later installed
• Access to a Kubernetes cluster and a valid kubeconfig (~/.kube/config)
• (Optional) Docker if you prefer container deploymentGet the source & build from GitHub
git clone https://github.com/strowk/mcp-k8s-go.git cd mcp-k8s-go go build -o mcp-k8s ./cmd/serverOr install directly:
go install github.com/strowk/mcp-k8s-go/cmd/server@latestInstall via NPM (Node.js wrapper / CLI convenience)
npm install -g @strowk/mcp-k8sContainer image (quick start)
docker pull ghcr.io/strowk/mcp-k8s-go:latest docker run -p 8080:8080 -v $HOME/.kube:/root/.kube ghcr.io/strowk/mcp-k8s-go:latestBasic configuration
The server looks for the following environment variables (use a .env file or your CI/CD secrets):
• KUBECONFIG – path to kubeconfig (defaults to ~/.kube/config)
• MCP_PORT – port to expose the MCP HTTP interface (default 8080)
• LOG_LEVEL – debug | info | warn | error (default info)Start the server
MCP_PORT=8080 ./mcp-k8sVerify
Open http://localhost:8080/healthz – returns 200 OK when the MCP server is healthy and able to reach the Kubernetes API.
Available Tools
- List Kubernetes contexts
Return the list of kubeconfig contexts available to the server - List Kubernetes namespaces
Return the namespaces present in the selected Kubernetes context - List, get, create and modify any Kubernetes resources
Full CRUD operations for arbitrary Kubernetes resources, including custom mappings for pods, services, deployments, etc. - List Kubernetes nodes
Return the nodes in the current Kubernetes cluster - List Kubernetes pods
Return pod objects within the chosen namespace - Get Kubernetes events
Retrieve event objects from the Kubernetes API - Get Kubernetes pod logs
Fetch log output for a specified pod/container - Run command in Kubernetes pod
Execute an arbitrary command inside a running pod
License: MIT License
Updated: 7/30/2025