mcp k8s go
This project is intended as a both MCP server connecting to Kubernetes and a library to build more servers for any custom resources in Kubernetes.
This project is intended as a both MCP server connecting to Kubernetes and a library to build more servers for any custom resources in Kubernetes.
x000D x000D
x000D x000D
_x000D_ Features ⚙_x000D_ Browse With Inspector ⚙_x000D_ Use With Claude ⚙_x000D_ Contributing ↗_x000D_
x000D x000D
_x000D_
_x000D_
_x000D_
_x000D_
_x000D_
_x000D_
_x000D_
x000D x000D
x000D MCP ? prompt ?️ resource ? tool x000D x000D - ?️? List Kubernetes contexts_x000D_ - ?? List Kubernetes namespaces_x000D_ - ? List and get any Kubernetes resources_x000D_ - includes custom mappings for resources like pods, services, deployments, but any resource can be listed and retrieved_x000D_ - ? List Kubernetes nodes_x000D_ - ? List Kubernetes pods_x000D_ - ? Get Kubernetes events_x000D_ - ? Get Kubernetes pod logs_x000D_ - ? Run command in Kubernetes pod_x000D_ x000D
x000D
To use latest published version with Inspector you can run this:x000D
x000D
bash_x000D_
npx @modelcontextprotocol/inspector npx @strowk/mcp-k8s_x000D_
x000D
x000D
, or to use version built from sources, then in root folder of this project:x000D
x000D
bash_x000D_
tools/inspector/run.sh_x000D_
x000D
x000D
x000D
x000D x000D To use this MCP server with Claude Desktop (or any other client) you might need to choose which way of installation to use.x000D x000D You have multiple options:x000D x000D | | Smithery | mcp-get | Pre-built NPM | Pre-built in Github | From sources | Using Docker |x000D | ------------ | -------------------------------------- | ------------------------------------ | ---------------------------------------------- | ------------------------------------------------------- | ------------------------------------------------ | ---------------------------------------- |x000D | Claude Setup | Auto | Auto | Manual | Manual | Manual | Manual |x000D | Prerequisite | Node.js | Node.js | Node.js | None | Golang | Docker |x000D x000D
x000D
To install MCP K8S Go for Claude Desktop automatically via Smithery:x000D
x000D
bash_x000D_
npx -y @smithery/cli install @strowk/mcp-k8s --client claude_x000D_
x000D
x000D
x000D
To install MCP K8S Go for Claude Desktop automatically via mcp-get:x000D
x000D
bash_x000D_
npx @michaellatman/mcp-get@latest install @strowk/mcp-k8s_x000D_
x000D
x000D
x000D
x000D
Use this if you have npm installed and want to use pre-built binaries:x000D
x000D
bash_x000D_
npm install -g @strowk/mcp-k8s_x000D_
x000D
x000D
Then check version by running mcp-k8s --version
and if this printed installed version, you can proceed to add configuration to claude_desktop_config.json
file:x000D
x000D
json_x000D_
{_x000D_
"mcpServers": {_x000D_
"mcp_k8s": {_x000D_
"command": "mcp-k8s",_x000D_
"args": []_x000D_
}_x000D_
}_x000D_
}_x000D_
x000D
x000D
, or using npx
with any client:x000D
x000D
bash_x000D_
npx @strowk/mcp-k8s_x000D_
x000D
x000D
For example for Claude:x000D
x000D
json_x000D_
{_x000D_
"mcpServers": {_x000D_
"mcp_k8s": {_x000D_
"command": "npx",_x000D_
"args": [_x000D_
"@strowk/mcp-k8s"_x000D_
]_x000D_
}_x000D_
}_x000D_
}_x000D_
x000D
x000D
x000D
Head to GitHub releases and download the latest release for your platform.x000D
x000D
Unpack the archive, which would contain binary named mcp-k8s-go
, put that binary somewhere in your PATH and then add the following configuration to the claude_desktop_config.json
file:x000D
x000D
json_x000D_
{_x000D_
"mcpServers": {_x000D_
"mcp_k8s": {_x000D_
"command": "mcp-k8s-go",_x000D_
"args": []_x000D_
}_x000D_
}_x000D_
}_x000D_
x000D
x000D
x000D
You would need Golang installed to build this project:x000D
x000D
bash_x000D_
go get github.com/strowk/mcp-k8s-go_x000D_
go install github.com/strowk/mcp-k8s-go_x000D_
x000D
x000D
, and then add the following configuration to the claude_desktop_config.json
file:x000D
x000D
json_x000D_
{_x000D_
"mcpServers": {_x000D_
"mcp_k8s_go": {_x000D_
"command": "mcp-k8s-go",_x000D_
"args": []_x000D_
}_x000D_
}_x000D_
}_x000D_
x000D
x000D
x000D
This server is built and published to Docker Hub since 0.3.1-beta.2 release with multi-arch images available for linux/amd64 and linux/arm64 architectures.x000D
x000D
You can use latest tag f.e like this:x000D
x000D
bash_x000D_
docker run -i -v ~/.kube/config:/home/nonroot/.kube/config --rm mcpk8s/server:latest_x000D_
x000D
x000D
Windows users might need to replace ~/.kube/config
with //c/Users/<username>/.kube/config
at least in Git Bash.x000D
x000D
For Claude:x000D
x000D
json_x000D_
{_x000D_
"mcpServers": {_x000D_
"mcp_k8s_go": {_x000D_
"command": "docker",_x000D_
"args": [_x000D_
"run",_x000D_
"-i",_x000D_
"-v",_x000D_
"~/.kube/config:/home/nonroot/.kube/config",_x000D_
"--rm",_x000D_
"mcpk8s/server:latest"_x000D_
]_x000D_
}_x000D_
}_x000D_
}_x000D_
x000D
x000D
x000D
The following environment variables are used by the MCP server:x000D
x000D
- KUBECONFIG
: Path to your Kubernetes configuration file (optional, defaults to ~/.kube/config)x000D
x000D
The following command-line options are supported:x000D
x000D
- --allowed-contexts=<ctx1,ctx2,...>
: Comma-separated list of allowed Kubernetes contexts that users can access. If not specified, all contexts are allowed.x000D
- --help
: Display help information_x000D_
- --version
: Display version information_x000D_