A Model Context Protocol (MCP) server for executing Kubernetes commands from Claude Desktop or any MCP-compatible client.
You can install this tool directly using Go:
go install github.com/BhagyaAmarasinghe/mcp-kubernetes@latestRun the MCP Kubernetes server:
mcp-kubernetesBy default, the server runs using stdio transport. You can specify a different port for HTTP transport with the -port flag:
mcp-kubernetes -port 8080- Configure Claude Desktop to use the MCP Kubernetes server by adding it to your
claude_desktop_config.json:
{
"mcpServers": {
"kubernetes": {
"command": "mcp-kubernetes"
}
}
}- You can now use Claude to execute Kubernetes commands, such as:
- "Show me the pods in the default namespace"
- "List all services across all namespaces"
- "Check the status of my deployment named my-app"
The MCP Kubernetes server supports the following MCP requests:
Executes a kubectl command:
{
"command": "get pods -n default"
}Retrieves a list of available Kubernetes contexts:
{}Gets the current Kubernetes context:
{}Sets the current Kubernetes context:
{
"context": "minikube"
}This MCP server executes kubectl commands directly on your machine, so it should only be used in trusted environments. It does not implement authentication or authorization controls by default.
- Go 1.23 or higher
- kubectl installed and in your PATH
- A valid kubeconfig file
MIT