Skip to content
Back to search

mcp-k8s-go

MCP server connecting to Kubernetes

Safety scan

A static text scan, not a guarantee. Select the badge to see what was scanned and every finding.

Checked today
Badge for your README
findsafeskills safety rating

Markdown

[![findsafeskills safety rating](/api/listings/strowk--mcp-k8s-go/badge.svg)](/listings/strowk--mcp-k8s-go)

HTML

<a href="/listings/strowk--mcp-k8s-go"><img src="/api/listings/strowk--mcp-k8s-go/badge.svg" alt="findsafeskills safety rating" /></a>

Install

i

What was scanned

The files the safety scan read, as written by the repository's author and shown as plain text. Lines with a finding are marked.

README.md · README · 225 lines

View this file on GitHub (read at the repository's current version: the scan did not record which commit it read)

This file has changed since it was scanned, so this is not exactly the text that was scanned, and no line is marked. The findings are listed with the safety scan above.

  1. <h4 align="center">Golang-based MCP server connecting to Kubernetes</h4>
  2. <h1 align="center">
  3. <img src="docs/images/logo.png" width="180"/>
  4. <br/>
  5. MCP K8S Go
  6. </h1>
  7. <p align="center">
  8. <a href="#features">Features</a> ⚙
  9. <a href="#browse-with-inspector">Browse With Inspector</a> ⚙
  10. <a href="#use-with-claude">Use With Claude</a> ⚙
  11. <a href="https://github.com/strowk/mcp-k8s-go/blob/main/CONTRIBUTING.md">Contributing ↗</a> ⚙
  12. <a href="https://modelcontextprotocol.io">About MCP ↗</a>
  13. </p>
  14. <p align="center">
  15. <a href="https://github.com/strowk/mcp-k8s-go/actions/workflows/dependabot/dependabot-updates"><img src="https://github.com/strowk/mcp-k8s-go/actions/workflows/dependabot/dependabot-updates/badge.svg"></a>
  16. <a href="https://github.com/strowk/mcp-k8s-go/actions/workflows/test.yaml"><img src="https://github.com/strowk/mcp-k8s-go/actions/workflows/test.yaml/badge.svg"></a>
  17. <a href="https://github.com/strowk/mcp-k8s-go/actions/workflows/golangci-lint.yaml"><img src="https://github.com/strowk/mcp-k8s-go/actions/workflows/golangci-lint.yaml/badge.svg"/></a>
  18. <br/>
  19. <a href="https://github.com/strowk/mcp-k8s-go/releases/latest"><img src="https://img.shields.io/github/v/release/strowk/mcp-k8s-go?logo=github&color=22ff22" alt="latest release badge"></a>
  20. <a href="https://github.com/strowk/mcp-k8s-go/blob/main/LICENSE"><img src="https://img.shields.io/github/license/strowk/mcp-k8s-go" alt="license badge"></a>
  21. </p>
  22. ## Features
  23. MCP 💬 prompt 🗂️ resource 🤖 tool
  24. - 🗂️🤖 List Kubernetes contexts
  25. - 💬🤖 List Kubernetes namespaces
  26. - 🤖 List, get, create and modify any Kubernetes resources
  27. - includes custom mappings for resources like pods, services, deployments
  28. - 🤖 List Kubernetes nodes
  29. - 💬 List Kubernetes pods
  30. - 🤖 Get Kubernetes events
  31. - 🤖 Get Kubernetes pod logs
  32. - 🤖 Run command in Kubernetes pod
  33. ## Tested Kubernetes Versions
  34. Integration tests run against these Kubernetes versions:
  35. <!-- TESTED_VERSIONS_START -->
  36. - v1.34.13
  37. - v1.35.10
  38. - v1.36.6
  39. - v1.37.2
  40. <!-- TESTED_VERSIONS_END -->
  41. ## Browse With Inspector
  42. To use latest published version with Inspector you can run this:
  43. ```bash
  44. npx @modelcontextprotocol/inspector npx @strowk/mcp-k8s
  45. ```
  46. ## Use With Claude
  47. <details><summary><b>
  48. Demo Usage
  49. </b></summary>
  50. Following chat with Claude Desktop demonstrates how it looks when selected particular context as a resource and then asked to check pod logs for errors in kube-system namespace:
  51. ![Claude Desktop](docs/images/claude-desktop-logs.png)
  52. </details>
  53. To use this MCP server with Claude Desktop (or any other client) you might need to choose which way of installation to use.
  54. You have multiple options:
  55. | | <a href="#prebuilt-from-npm">Pre-built NPM</a> | <a href="#from-github-releases">Pre-built in Github</a> | <a href="#building-from-source">From sources</a> | <a href="#using-docker">Using Docker</a> |
  56. | ------------ | ---------------------------------------------- | ------------------------------------------------------- | ------------------------------------------------ | ---------------------------------------- |
  57. | Prerequisite | Node.js | None | Golang | Docker |
  58. ### Manually with prebuilt binaries
  59. #### Prebuilt from npm
  60. Use this if you have npm installed and want to use pre-built binaries:
  61. ```bash
  62. npm install -g @strowk/mcp-k8s
  63. ```
  64. 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:
  65. ```json
  66. {
  67. "mcpServers": {
  68. "mcp_k8s": {
  69. "command": "mcp-k8s",
  70. "args": []
  71. }
  72. }
  73. }
  74. ```
  75. , or using `npx` with any client:
  76. ```bash
  77. npx @strowk/mcp-k8s
  78. ```
  79. For example for Claude:
  80. ```json
  81. {
  82. "mcpServers": {
  83. "mcp_k8s": {
  84. "command": "npx",
  85. "args": [
  86. "@strowk/mcp-k8s"
  87. ]
  88. }
  89. }
  90. }
  91. ```
  92. #### From GitHub releases
  93. Head to [GitHub releases](https://github.com/strowk/mcp-k8s-go/releases) and download the latest release for your platform.
  94. 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:
  95. ```json
  96. {
  97. "mcpServers": {
  98. "mcp_k8s": {
  99. "command": "mcp-k8s-go",
  100. "args": []
  101. }
  102. }
  103. }
  104. ```
  105. ### Building from source
  106. You would need Golang installed to build this project:
  107. ```bash
  108. go get github.com/strowk/mcp-k8s-go
  109. go install github.com/strowk/mcp-k8s-go
  110. ```
  111. , and then add the following configuration to the `claude_desktop_config.json` file:
  112. ```json
  113. {
  114. "mcpServers": {
  115. "mcp_k8s_go": {
  116. "command": "mcp-k8s-go",
  117. "args": []
  118. }
  119. }
  120. }
  121. ```
  122. ### Using Docker
  123. 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.
  124. You can use latest tag f.e like this:
  125. ```bash
  126. docker run -i -v ~/.kube/config:/home/nonroot/.kube/config --rm mcpk8s/server:latest
  127. ```
  128. Windows users might need to replace `~/.kube/config` with `//c/Users/<username>/.kube/config` at least in Git Bash.
  129. For Claude:
  130. ```json
  131. {
  132. "mcpServers": {
  133. "mcp_k8s_go": {
  134. "command": "docker",
  135. "args": [
  136. "run",
  137. "-i",
  138. "-v",
  139. "~/.kube/config:/home/nonroot/.kube/config",
  140. "--rm",
  141. "mcpk8s/server:latest"
  142. ]
  143. }
  144. }
  145. }
  146. ```
  147. ### Environment Variables and Command-line Options
  148. The following environment variables are used by the MCP server:
  149. - `KUBECONFIG`: Path to your Kubernetes configuration file (optional, defaults to ~/.kube/config)
  150. The following command-line options are supported:
  151. - `--allowed-contexts=<ctx1,ctx2,...>`: Comma-separated list of allowed Kubernetes contexts that users can access. If not specified, all contexts are allowed.
  152. - `--readonly`: Disables any tool which can write changes to the cluster
  153. - `--help`: Display help information
  154. - `--version`: Display version information
  155. - `--mask-secrets`: Mask secrets in the output (default: true). Use `--mask-secrets=false` to disable masking
  156. For example if you are configuring Claude Desktop, you can add the following configuration to `claude_desktop_config.json` file:
  157. ```json
  158. {
  159. "mcpServers": {
  160. "mcp_k8s": {
  161. "command": "mcp-k8s",
  162. "args": [
  163. "--allowed-contexts=dev,prod",
  164. "--readonly"
  165. ]
  166. }
  167. }
  168. }
  169. ```
  170. , which would allow only `dev` and `prod` contexts to be used and would disable any tool which can write changes to the cluster.

Ratings and comments

Sign in to rate this skill.

Sign in

Free to use. If it’s helped, pass it on.