Skip to content

Commit ffad1d1

Browse files
authored
Merge pull request #1 from ardaguclu/sync-downstream
Sync downstream with the latest changes in upstream
2 parents 9e3811a + 9cc7192 commit ffad1d1

40 files changed

+1868
-337
lines changed

.tekton/kubernetes-mcp-server-ols-pull-request.yaml

Lines changed: 608 additions & 0 deletions
Large diffs are not rendered by default.

.tekton/kubernetes-mcp-server-ols-push.yaml

Lines changed: 605 additions & 0 deletions
Large diffs are not rendered by default.

AGENTS.md

Lines changed: 128 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,128 @@
1+
# Project Agents.md for Kubernetes MCP Server
2+
3+
This Agents.md file provides comprehensive guidance for AI assistants and coding agents (like Claude, Gemini, Cursor, and others) to work with this codebase.
4+
5+
This repository contains the kubernetes-mcp-server project,
6+
a powerful Go-based Model Context Protocol (MCP) server that provides native Kubernetes and OpenShift cluster management capabilities without external dependencies.
7+
This MCP server enables AI assistants (like Claude, Gemini, Cursor, and others) to interact with Kubernetes clusters using the Model Context Protocol (MCP).
8+
9+
## Project Structure and Repository layout
10+
11+
- Go package layout follows the standard Go conventions:
12+
- `cmd/kubernetes-mcp-server/` – main application entry point using Cobra CLI framework.
13+
- `pkg/` – libraries grouped by domain.
14+
- `config/` – configuration management.
15+
- `helm/` - Helm chart operations integration.
16+
- `http/` - HTTP server and authorization middleware.
17+
- `kubernetes/` - Kubernetes client management, authentication, and access control.
18+
- `mcp/` - Model Context Protocol (MCP) server implementation with tool registration and STDIO/HTTP support.
19+
- `output/` - output formatting and rendering.
20+
- `.github/` – GitHub-related configuration (Actions workflows, issue templates...).
21+
- `docs/` – documentation files.
22+
- `npm/` – Node packages that wraps the compiled binaries for distribution through npmjs.com.
23+
- `python/` – Python package providing a script that downloads the correct platform binary from the GitHub releases page and runs it for distribution through pypi.org.
24+
- `Dockerfile` - container image description file to distribute the server as a container image.
25+
- `Makefile` – tasks for building, formatting, linting and testing.
26+
27+
## Feature development
28+
29+
Implement new functionality in the Go sources under `cmd/` and `pkg/`.
30+
The JavaScript (`npm/`) and Python (`python/`) directories only wrap the compiled binary for distribution (npm and PyPI).
31+
Most changes will not require touching them unless the version or packaging needs to be updated.
32+
33+
## Building
34+
35+
Use the provided Makefile targets:
36+
37+
```bash
38+
# Format source and build the binary
39+
make build
40+
41+
# Build for all supported platforms
42+
make build-all-platforms
43+
```
44+
45+
`make build` will run `go fmt` and `go mod tidy` before compiling.
46+
The resulting executable is `kubernetes-mcp-server`.
47+
48+
## Running
49+
50+
The README demonstrates running the server via
51+
[`mcp-inspector`](https://modelcontextprotocol.io/docs/tools/inspector):
52+
53+
```bash
54+
make build
55+
npx @modelcontextprotocol/inspector@latest $(pwd)/kubernetes-mcp-server
56+
```
57+
58+
To run the server locally, you can use `npx`, `uvx` or execute the binary directly:
59+
60+
```bash
61+
# Using npx (Node.js package runner)
62+
npx -y kubernetes-mcp-server@latest
63+
64+
# Using uvx (Python package runner)
65+
uvx kubernetes-mcp-server@latest
66+
67+
# Binary execution
68+
./kubernetes-mcp-server
69+
```
70+
71+
This MCP server is designed to run both locally and remotely.
72+
73+
### Local Execution
74+
75+
When running locally, the server connects to a Kubernetes or OpenShift cluster using the kubeconfig file.
76+
It reads the kubeconfig from the `--kubeconfig` flag, the `KUBECONFIG` environment variable, or defaults to `~/.kube/config`.
77+
78+
This means that `npx -y kubernetes-mcp-server@latest` on a workstation will talk to whatever cluster your current kubeconfig points to (e.g. a local Kind cluster).
79+
80+
### Remote Execution
81+
82+
When running remotely, the server can be deployed as a container image in a Kubernetes or OpenShift cluster.
83+
The server can be run as a Deployment, StatefulSet, or any other Kubernetes resource that suits your needs.
84+
The server will automatically use the in-cluster configuration to connect to the Kubernetes API server.
85+
86+
## Tests
87+
88+
Run all Go tests with:
89+
90+
```bash
91+
make test
92+
```
93+
94+
The test suite relies on the `setup-envtest` tooling from `sigs.k8s.io/controller-runtime`.
95+
The first run downloads a Kubernetes `envtest` environment from the internet, so network access is required.
96+
Without it some tests will fail during setup.
97+
98+
## Linting
99+
100+
Static analysis is performed with `golangci-lint`:
101+
102+
```bash
103+
make lint
104+
```
105+
106+
The `lint` target downloads the specified `golangci-lint` version if it is not already present under `_output/tools/bin/`.
107+
108+
## Dependencies
109+
110+
When introducing new modules run `make tidy` so that `go.mod` and `go.sum` remain tidy.
111+
112+
## Coding style
113+
114+
- Go modules target Go **1.24** (see `go.mod`).
115+
- Tests are written with the standard library `testing` package.
116+
- Build, test and lint steps are defined in the Makefile—keep them working.
117+
118+
## Distribution Methods
119+
120+
The server is distributed as a binary executable, a Docker image, an npm package, and a Python package.
121+
122+
- **Native binaries** for Linux, macOS, and Windows are available in the GitHub releases.
123+
- A **container image** (Docker) is built and pushed to the `quay.io/manusa/kubernetes_mcp_server` repository.
124+
- An **npm** package is available at [npmjs.com](https://www.npmjs.com/package/kubernetes-mcp-server).
125+
It wraps the platform-specific binary and provides a convenient way to run the server using `npx`.
126+
- A **Python** package is available at [pypi.org](https://pypi.org/project/kubernetes-mcp-server/).
127+
It provides a script that downloads the correct platform binary from the GitHub releases page and runs it.
128+
It provides a convenient way to run the server using `uvx` or `python -m kubernetes_mcp_server`.

README.md

Lines changed: 23 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
# Kubernetes MCP Server
22

3-
[![GitHub License](https://img.shields.io/github/license/manusa/kubernetes-mcp-server)](https://github.com/manusa/kubernetes-mcp-server/blob/main/LICENSE)
3+
[![GitHub License](https://img.shields.io/github/license/containers/kubernetes-mcp-server)](https://github.com/containers/kubernetes-mcp-server/blob/main/LICENSE)
44
[![npm](https://img.shields.io/npm/v/kubernetes-mcp-server)](https://www.npmjs.com/package/kubernetes-mcp-server)
55
[![PyPI - Version](https://img.shields.io/pypi/v/kubernetes-mcp-server)](https://pypi.org/project/kubernetes-mcp-server/)
6-
[![GitHub release (latest SemVer)](https://img.shields.io/github/v/release/manusa/kubernetes-mcp-server?sort=semver)](https://github.com/manusa/kubernetes-mcp-server/releases/latest)
7-
[![Build](https://github.com/manusa/kubernetes-mcp-server/actions/workflows/build.yaml/badge.svg)](https://github.com/manusa/kubernetes-mcp-server/actions/workflows/build.yaml)
6+
[![GitHub release (latest SemVer)](https://img.shields.io/github/v/release/containers/kubernetes-mcp-server?sort=semver)](https://github.com/containers/kubernetes-mcp-server/releases/latest)
7+
[![Build](https://github.com/containers/kubernetes-mcp-server/actions/workflows/build.yaml/badge.svg)](https://github.com/containers/kubernetes-mcp-server/actions/workflows/build.yaml)
88

99
[✨ Features](#features) | [🚀 Getting Started](#getting-started) | [🎥 Demos](#demos) | [⚙️ Configuration](#configuration) | [🛠️ Tools](#tools) | [🧑‍💻 Development](#development)
1010

@@ -90,6 +90,25 @@ code --add-mcp '{"name":"kubernetes","command":"npx","args":["kubernetes-mcp-ser
9090
code-insiders --add-mcp '{"name":"kubernetes","command":"npx","args":["kubernetes-mcp-server@latest"]}'
9191
```
9292

93+
### Cursor
94+
95+
Install the Kubernetes MCP server extension in Cursor by pressing the following link:
96+
97+
[![Install MCP Server](https://cursor.com/deeplink/mcp-install-dark.svg)](https://cursor.com/install-mcp?name=kubernetes-mcp-server&config=JTdCJTIyY29tbWFuZCUyMiUzQSUyMm5weCUyMC15JTIwa3ViZXJuZXRlcy1tY3Atc2VydmVyJTQwbGF0ZXN0JTIyJTdE)
98+
99+
Alternatively, you can install the extension manually by editing the `mcp.json` file:
100+
101+
```json
102+
{
103+
"mcpServers": {
104+
"kubernetes-mcp-server": {
105+
"command": "npx",
106+
"args": ["-y", "kubernetes-mcp-server@latest"]
107+
}
108+
}
109+
}
110+
```
111+
93112
### Goose CLI
94113

95114
[Goose CLI](https://blog.marcnuri.com/goose-on-machine-ai-agent-cli-introduction) is the easiest (and cheapest) way to get rolling with artificial intelligence (AI) agents.
@@ -137,7 +156,7 @@ In this demo, I'll show you how to set up Kubernetes MCP server in VS code just
137156

138157
The Kubernetes MCP server can be configured using command line (CLI) arguments.
139158

140-
You can run the CLI executable either by using `npx`, `uvx`, or by downloading the [latest release binary](https://github.com/manusa/kubernetes-mcp-server/releases/latest).
159+
You can run the CLI executable either by using `npx`, `uvx`, or by downloading the [latest release binary](https://github.com/containers/kubernetes-mcp-server/releases/latest).
141160

142161
```shell
143162
# Run the Kubernetes MCP server using npx (in case you have npm and node installed)

cmd/kubernetes-mcp-server/main.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import (
66
"github.com/spf13/pflag"
77
"k8s.io/cli-runtime/pkg/genericiooptions"
88

9-
"github.com/manusa/kubernetes-mcp-server/pkg/kubernetes-mcp-server/cmd"
9+
"github.com/containers/kubernetes-mcp-server/pkg/kubernetes-mcp-server/cmd"
1010
)
1111

1212
func main() {

go.mod

Lines changed: 28 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
1-
module github.com/manusa/kubernetes-mcp-server
1+
module github.com/containers/kubernetes-mcp-server
22

33
go 1.24.1
44

55
require (
66
github.com/BurntSushi/toml v1.5.0
7-
github.com/coreos/go-oidc/v3 v3.14.1
7+
github.com/coreos/go-oidc/v3 v3.15.0
88
github.com/fsnotify/fsnotify v1.9.0
9-
github.com/go-jose/go-jose/v4 v4.0.5
10-
github.com/mark3labs/mcp-go v0.34.0
9+
github.com/go-jose/go-jose/v4 v4.1.1
10+
github.com/mark3labs/mcp-go v0.36.0
1111
github.com/pkg/errors v0.9.1
1212
github.com/spf13/afero v1.14.0
1313
github.com/spf13/cobra v1.9.1
@@ -22,24 +22,26 @@ require (
2222
k8s.io/klog/v2 v2.130.1
2323
k8s.io/kubectl v0.33.3
2424
k8s.io/metrics v0.33.3
25-
k8s.io/utils v0.0.0-20241104100929-3ea5e8cea738
25+
k8s.io/utils v0.0.0-20250604170112-4c0f3b243397
2626
sigs.k8s.io/controller-runtime v0.21.0
2727
sigs.k8s.io/controller-runtime/tools/setup-envtest v0.0.0-20250211091558-894df3a7e664
28-
sigs.k8s.io/yaml v1.5.0
28+
sigs.k8s.io/yaml v1.6.0
2929
)
3030

3131
require (
32-
dario.cat/mergo v1.0.1 // indirect
32+
dario.cat/mergo v1.0.2 // indirect
3333
github.com/Azure/go-ansiterm v0.0.0-20250102033503-faa5f7b0171c // indirect
3434
github.com/MakeNowJust/heredoc v1.0.0 // indirect
3535
github.com/Masterminds/goutils v1.1.1 // indirect
3636
github.com/Masterminds/semver/v3 v3.3.0 // indirect
3737
github.com/Masterminds/sprig/v3 v3.3.0 // indirect
3838
github.com/Masterminds/squirrel v1.5.4 // indirect
3939
github.com/asaskevich/govalidator v0.0.0-20230301143203-a9d515a09cc2 // indirect
40+
github.com/bahlo/generic-list-go v0.2.0 // indirect
4041
github.com/blang/semver/v4 v4.0.0 // indirect
41-
github.com/chai2010/gettext-go v1.0.2 // indirect
42-
github.com/containerd/containerd v1.7.27 // indirect
42+
github.com/buger/jsonparser v1.1.1 // indirect
43+
github.com/chai2010/gettext-go v1.0.3 // indirect
44+
github.com/containerd/containerd v1.7.28 // indirect
4345
github.com/containerd/errdefs v0.3.0 // indirect
4446
github.com/containerd/log v0.1.0 // indirect
4547
github.com/containerd/platforms v0.2.1 // indirect
@@ -53,10 +55,10 @@ require (
5355
github.com/fxamacker/cbor/v2 v2.7.0 // indirect
5456
github.com/go-errors/errors v1.4.2 // indirect
5557
github.com/go-gorp/gorp/v3 v3.1.0 // indirect
56-
github.com/go-logr/logr v1.4.2 // indirect
57-
github.com/go-openapi/jsonpointer v0.21.0 // indirect
58-
github.com/go-openapi/jsonreference v0.20.2 // indirect
59-
github.com/go-openapi/swag v0.23.0 // indirect
58+
github.com/go-logr/logr v1.4.3 // indirect
59+
github.com/go-openapi/jsonpointer v0.21.1 // indirect
60+
github.com/go-openapi/jsonreference v0.21.0 // indirect
61+
github.com/go-openapi/swag v0.23.1 // indirect
6062
github.com/gobwas/glob v0.2.3 // indirect
6163
github.com/gogo/protobuf v1.3.2 // indirect
6264
github.com/google/btree v1.1.3 // indirect
@@ -71,6 +73,7 @@ require (
7173
github.com/hashicorp/go-multierror v1.1.1 // indirect
7274
github.com/huandu/xstrings v1.5.0 // indirect
7375
github.com/inconshreveable/mousetrap v1.1.0 // indirect
76+
github.com/invopop/jsonschema v0.13.0 // indirect
7477
github.com/jmoiron/sqlx v1.4.0 // indirect
7578
github.com/josharian/intern v1.0.0 // indirect
7679
github.com/json-iterator/go v1.1.12 // indirect
@@ -79,7 +82,7 @@ require (
7982
github.com/lann/ps v0.0.0-20150810152359-62de8c46ede0 // indirect
8083
github.com/lib/pq v1.10.9 // indirect
8184
github.com/liggitt/tabwriter v0.0.0-20181228230101-89fcab3d43de // indirect
82-
github.com/mailru/easyjson v0.7.7 // indirect
85+
github.com/mailru/easyjson v0.9.0 // indirect
8386
github.com/mattn/go-colorable v0.1.13 // indirect
8487
github.com/mattn/go-isatty v0.0.17 // indirect
8588
github.com/mattn/go-runewidth v0.0.9 // indirect
@@ -101,6 +104,7 @@ require (
101104
github.com/shopspring/decimal v1.4.0 // indirect
102105
github.com/sirupsen/logrus v1.9.3 // indirect
103106
github.com/spf13/cast v1.7.1 // indirect
107+
github.com/wk8/go-ordered-map/v2 v2.1.8 // indirect
104108
github.com/x448/float16 v0.8.4 // indirect
105109
github.com/xeipuuv/gojsonpointer v0.0.0-20190905194746-02993c407bfb // indirect
106110
github.com/xeipuuv/gojsonreference v0.0.0-20180127040603-bd5ef7bd5415 // indirect
@@ -109,24 +113,24 @@ require (
109113
github.com/yosida95/uritemplate/v3 v3.0.2 // indirect
110114
go.yaml.in/yaml/v2 v2.4.2 // indirect
111115
go.yaml.in/yaml/v3 v3.0.3 // indirect
112-
golang.org/x/crypto v0.39.0 // indirect
113-
golang.org/x/net v0.41.0 // indirect
114-
golang.org/x/oauth2 v0.28.0 // indirect
115-
golang.org/x/sys v0.33.0 // indirect
116-
golang.org/x/term v0.32.0 // indirect
117-
golang.org/x/text v0.26.0 // indirect
118-
golang.org/x/time v0.9.0 // indirect
119-
google.golang.org/genproto/googleapis/rpc v0.0.0-20241209162323-e6fa225c2576 // indirect
116+
golang.org/x/crypto v0.40.0 // indirect
117+
golang.org/x/net v0.42.0 // indirect
118+
golang.org/x/oauth2 v0.30.0 // indirect
119+
golang.org/x/sys v0.34.0 // indirect
120+
golang.org/x/term v0.33.0 // indirect
121+
golang.org/x/text v0.27.0 // indirect
122+
golang.org/x/time v0.12.0 // indirect
123+
google.golang.org/genproto/googleapis/rpc v0.0.0-20250721164621-a45f3dfb1074 // indirect
120124
google.golang.org/grpc v1.68.1 // indirect
121-
google.golang.org/protobuf v1.36.5 // indirect
125+
google.golang.org/protobuf v1.36.6 // indirect
122126
gopkg.in/evanphx/json-patch.v4 v4.12.0 // indirect
123127
gopkg.in/inf.v0 v0.9.1 // indirect
124128
gopkg.in/yaml.v3 v3.0.1 // indirect
125129
k8s.io/apiserver v0.33.3 // indirect
126130
k8s.io/component-base v0.33.3 // indirect
127131
k8s.io/kube-openapi v0.0.0-20250318190949-c8a335a9a2ff // indirect
128132
oras.land/oras-go/v2 v2.6.0 // indirect
129-
sigs.k8s.io/json v0.0.0-20241010143419-9aa6b5e7a4b3 // indirect
133+
sigs.k8s.io/json v0.0.0-20241014173422-cfa47c3a1cc8 // indirect
130134
sigs.k8s.io/kustomize/api v0.19.0 // indirect
131135
sigs.k8s.io/kustomize/kyaml v0.19.0 // indirect
132136
sigs.k8s.io/randfill v1.0.0 // indirect

0 commit comments

Comments
 (0)