Skip to content

Commit 4a7e051

Browse files
authored
chore(doc): polish the Agents.md file (#222)
Signed-off-by: Marc Nuri <marc@marcnuri.com>
1 parent 49dcff3 commit 4a7e051

File tree

1 file changed

+71
-36
lines changed

1 file changed

+71
-36
lines changed

AGENTS.md

Lines changed: 71 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,34 @@
1-
# AGENTS
2-
3-
This repository contains a Go implementation of a Model Context Protocol (MCP)
4-
server for Kubernetes and OpenShift.
5-
6-
## Repository layout
7-
8-
- `cmd/kubernetes-mcp-server/` – entry point and Cobra CLI.
9-
- `pkg/` – libraries grouped by domain (`kubernetes`, `mcp`, `output`, …).
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.
1025
- `Makefile` – tasks for building, formatting, linting and testing.
11-
- `npm/` – Node packages that wrap the compiled binary. The `kubernetes-mcp-server` package
12-
defines a small launcher in `bin/index.js` which resolves the platform specific
13-
optional dependency (`kubernetes-mcp-server-<os>-<arch>`) and executes it.
14-
- `python/` – Python package providing a script that downloads the correct
15-
platform binary from the GitHub releases page and runs it.
1626

1727
## Feature development
1828

1929
Implement new functionality in the Go sources under `cmd/` and `pkg/`.
20-
The JavaScript and Python directories only wrap the compiled binary for
21-
distribution (npm and PyPI). Most changes will not require touching them
22-
unless the version or packaging needs to be updated.
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.
2332

2433
## Building
2534

@@ -33,8 +42,8 @@ make build
3342
make build-all-platforms
3443
```
3544

36-
`make build` will run `go fmt` and `go mod tidy` before compiling. The
37-
resulting executable is `kubernetes-mcp-server`.
45+
`make build` will run `go fmt` and `go mod tidy` before compiling.
46+
The resulting executable is `kubernetes-mcp-server`.
3847

3948
## Running
4049

@@ -46,15 +55,33 @@ make build
4655
npx @modelcontextprotocol/inspector@latest $(pwd)/kubernetes-mcp-server
4756
```
4857

49-
The server is typically run locally and connects to the cluster using the same
50-
configuration loading rules as `kubectl`. When started with `npx` or `uvx` it
51-
downloads and executes a platform specific binary. The running process then
52-
reads the kubeconfig resolved from the `--kubeconfig` flag, the `KUBECONFIG`
53-
environment variable or the default `~/.kube/config` file. If those are not
54-
present and the process executes inside a pod it falls back to in-cluster
55-
configuration. This means that `npx kubernetes-mcp-server` on a workstation will
56-
talk to whatever cluster your current kubeconfig points to (e.g. a local Kind
57-
cluster).
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.
5885

5986
## Tests
6087

@@ -64,10 +91,9 @@ Run all Go tests with:
6491
make test
6592
```
6693

67-
The test suite relies on the `setup-envtest` tooling from
68-
`sigs.k8s.io/controller-runtime`. The first run downloads a Kubernetes
69-
`envtest` environment from the internet, so network access is required. Without
70-
it some tests will fail during setup.
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.
7197

7298
## Linting
7399

@@ -77,17 +103,26 @@ Static analysis is performed with `golangci-lint`:
77103
make lint
78104
```
79105

80-
The `lint` target downloads the specified `golangci-lint` version if it is not
81-
already present under `_output/tools/bin/`.
106+
The `lint` target downloads the specified `golangci-lint` version if it is not already present under `_output/tools/bin/`.
82107

83108
## Dependencies
84109

85-
When introducing new modules run `go mod tidy` (or `make tidy`) so that
86-
`go.mod` and `go.sum` remain tidy.
110+
When introducing new modules run `make tidy` so that `go.mod` and `go.sum` remain tidy.
87111

88112
## Coding style
89113

90114
- Go modules target Go **1.24** (see `go.mod`).
91115
- Tests are written with the standard library `testing` package.
92116
- Build, test and lint steps are defined in the Makefile—keep them working.
93117

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`.

0 commit comments

Comments
 (0)