Skip to content

Commit 5889fdb

Browse files
authored
chore(doc): add AGENTS.md (#204)
Signed-off-by: Brett Tofel <[email protected]>
1 parent 1f670eb commit 5889fdb

File tree

1 file changed

+93
-0
lines changed

1 file changed

+93
-0
lines changed

AGENTS.md

Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
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`, …).
10+
- `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.
16+
17+
## Feature development
18+
19+
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.
23+
24+
## Building
25+
26+
Use the provided Makefile targets:
27+
28+
```bash
29+
# Format source and build the binary
30+
make build
31+
32+
# Build for all supported platforms
33+
make build-all-platforms
34+
```
35+
36+
`make build` will run `go fmt` and `go mod tidy` before compiling. The
37+
resulting executable is `kubernetes-mcp-server`.
38+
39+
## Running
40+
41+
The README demonstrates running the server via
42+
[`mcp-inspector`](https://modelcontextprotocol.io/docs/tools/inspector):
43+
44+
```bash
45+
make build
46+
npx @modelcontextprotocol/inspector@latest $(pwd)/kubernetes-mcp-server
47+
```
48+
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+
59+
## Tests
60+
61+
Run all Go tests with:
62+
63+
```bash
64+
make test
65+
```
66+
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.
71+
72+
## Linting
73+
74+
Static analysis is performed with `golangci-lint`:
75+
76+
```bash
77+
make lint
78+
```
79+
80+
The `lint` target downloads the specified `golangci-lint` version if it is not
81+
already present under `_output/tools/bin/`.
82+
83+
## Dependencies
84+
85+
When introducing new modules run `go mod tidy` (or `make tidy`) so that
86+
`go.mod` and `go.sum` remain tidy.
87+
88+
## Coding style
89+
90+
- Go modules target Go **1.24** (see `go.mod`).
91+
- Tests are written with the standard library `testing` package.
92+
- Build, test and lint steps are defined in the Makefile—keep them working.
93+

0 commit comments

Comments
 (0)