From 2e57a224d60e74ddd8db45fcfbb9bf4fc8602374 Mon Sep 17 00:00:00 2001 From: Claude Date: Tue, 17 Nov 2026 21:39:01 +0000 Subject: [PATCH] docs: make the docs work from this repository The docs still assumed they lived inside Gameplane: relative ../docs links, go.work and Makefile claims, and no contributor guide. Point Gameplane paths at the Gameplane repository, describe the shared CI, add AGENTS.md (with a CLAUDE.md link) and, where missing, a README. Co-Authored-By: Claude Opus 5.5 Signed-off-by: Claude --- .testcoverage.yml | 2 +- AGENTS.md | 22 ++++++++++++++++++++++ CLAUDE.md | 1 + README.md | 4 +++- specs.md | 17 ++++++++--------- system-deps.toml | 4 ++-- 6 files changed, 37 insertions(+), 13 deletions(-) create mode 100644 AGENTS.md create mode 120000 CLAUDE.md diff --git a/.testcoverage.yml b/.testcoverage.yml index 4c3b4df..ed19efa 100644 --- a/.testcoverage.yml +++ b/.testcoverage.yml @@ -1,5 +1,5 @@ # Coverage threshold gate for the mcp-server module. -# Enforced by `make cover-go-check` via go-test-coverage/v2. +# Enforced in CI by Gameplane's shared go-component.yaml workflow (go-test-coverage/v2). # # The server is a thin, strictly read-only MCP tool surface: the tests cover # tool registration (including the read-only invariant — no mutating verb diff --git a/AGENTS.md b/AGENTS.md new file mode 100644 index 0000000..d4031a9 --- /dev/null +++ b/AGENTS.md @@ -0,0 +1,22 @@ +# mcp-server — AI assistant guide + +This repository holds the optional, strictly read-only MCP server (stdio) for cluster debugging. It is a split component of [GameplanePanel/Gameplane](https://github.com/GameplanePanel/Gameplane), checked out there as the `mcp-server/` submodule (the repository is named `mcp`, the folder is `mcp-server/`). What it does and its contracts: [`specs.md`](specs.md). + +## How it fits into Gameplane + +- **Own Go module**, not part of Gameplane's `go.work`. Build and test from this repository's root: `go build ./...` (inside a Gameplane checkout, prefix `GOWORK=off`). +- **CI** is `.github/workflows/ci.yaml`, a thin caller of Gameplane's shared [`go-component.yaml`](https://github.com/GameplanePanel/Gameplane/blob/master/.github/workflows/go-component.yaml), pinned by SHA: lint with Gameplane's root `.golangci.yml` and `.hadolint.yaml` (no copy here), race tests on amd64 and arm64 with the `.testcoverage.yml` gate, govulncheck, and an image build. Dependabot runs in this repository. +- **Images** `mcp-server` (`Dockerfile`, built by `make image-mcp-server`) are built and published from the Gameplane repository root: the Dockerfiles copy `mcp-server/...` from that build context. +- **Callers live in Gameplane:** paths such as `operator/`, `api/`, `charts/`, `docs/` and `web/` in `specs.md` and code comments refer to that repository. +- **Shipping a change:** PR to `main` here → after it merges, bump the `mcp-server` pointer in Gameplane (`git -C mcp-server checkout `, `git add mcp-server`) in a Gameplane PR. A user-visible change gets its `changelog/unreleased/` entry in that Gameplane PR. + +## Rules + +Gameplane's [`AGENTS.md`](https://github.com/GameplanePanel/Gameplane/blob/master/AGENTS.md) core rules apply here. The ones that matter most in this repository: + +- **CI verifies:** locally only compile checks (`go build ./...`); never run test or lint suites locally. +- **Fix, don't silence:** no `//nolint` and no per-repository `.golangci.yml`; `_test.go` files are exempt from `errcheck`/`gosec`/`unparam` through the shared config. +- **Go errors:** wrap with `%w`. +- **Tests:** never delete or weaken a test without the maintainer's explicit sign-off; fix the code. +- **Git:** signed commits (`git commit -s`), conventional prefixes (`feat:`, `fix:`, `chore:`, `docs:` …), one branch per unit of work, never amend pushed commits; delete the branch after merge. +- **Docs:** keep `specs.md` in step with behaviour changes in the same PR. diff --git a/CLAUDE.md b/CLAUDE.md new file mode 120000 index 0000000..47dc3e3 --- /dev/null +++ b/CLAUDE.md @@ -0,0 +1 @@ +AGENTS.md \ No newline at end of file diff --git a/README.md b/README.md index c935744..66eb0e5 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,7 @@ # mcp-server +> This repository is checked out as the `mcp-server/` submodule of [GameplanePanel/Gameplane](https://github.com/GameplanePanel/Gameplane). Paths such as `docs/`, `operator/`, `api/`, `charts/` and `web/` below refer to that repository. + The **mcp-server** [optional] is a strictly **read-only** [Model Context Protocol](https://modelcontextprotocol.io/) (MCP) server for Gameplane clusters. It lets an AI assistant read cluster state — 7 of Gameplane's 9 CRDs (not Cluster or NetworkCapture), Pods, Events, and pod logs — and get a @@ -59,7 +61,7 @@ but install it with that blast radius in mind: anyone who can MCP client already wired to it) can read logs and object state for *any* pod in the cluster, not just Gameplane-managed ones. If that's wider than you want, don't enable `mcpServer` on a cluster that also runs -unrelated, more sensitive workloads. See `docs/security.md` for the rest of +unrelated, more sensitive workloads. See [`docs/security.md`](https://github.com/GameplanePanel/Gameplane/blob/master/docs/security.md) for the rest of the threat model. ## Tools diff --git a/specs.md b/specs.md index cc8f490..ec2af12 100644 --- a/specs.md +++ b/specs.md @@ -1,5 +1,7 @@ # mcp-server — Specification +> This repository is checked out as the `mcp-server/` submodule of [GameplanePanel/Gameplane](https://github.com/GameplanePanel/Gameplane). Paths such as `docs/`, `operator/`, `api/`, `charts/` and `web/` below refer to that repository. + **Status:** pre-v1 (v0.4.1) **Module / package:** `github.com/GameplanePanel/gameplane/mcp-server` @@ -145,14 +147,14 @@ From `go.mod` (verified): | `k8s.io/client-go` | v0.37.0 | Kubernetes typed clientset, dynamic client, rest.Config | | `sigs.k8s.io/controller-runtime` | v0.25.1 | `ctrl.GetConfig()` for kubeconfig loading | -**Why these versions?** Pinned to match the operator's dependencies for consistency across the workspace (via `go.work`). +**Why these versions?** Kept in step with the Gameplane operator's Kubernetes dependencies; Dependabot in this repository proposes updates. ## Security considerations 1. **Read-only blast radius**: The ClusterRole grants get/list/watch cluster-wide (all namespaces), not just `gameplane-games`. Pod logs in any namespace may contain application secrets (API keys, connection strings); this is an accepted tradeoff on an opt-in component. 2. **No listening port**: No network surface to expose; reachable only via `kubectl exec`. 3. **Deployment model**: Opt-in via `mcpServer.enabled=true` in the Helm chart. Admin responsibility to decide if this is acceptable for their cluster. -4. **See `docs/security.md`** for the full threat model and per-cluster decisions (especially if cohabiting with unrelated sensitive workloads). +4. **See [`docs/security.md`](https://github.com/GameplanePanel/Gameplane/blob/master/docs/security.md)** for the full threat model and per-cluster decisions (especially if cohabiting with unrelated sensitive workloads). ## Testing & coverage @@ -165,12 +167,10 @@ From `go.mod` (verified): ### Test commands -Run via the workspace root Makefile: +Run from this repository's root (CI runs the same through Gameplane's shared `go-component.yaml` workflow): ```sh -make test-go # Runs all Go tests, including mcp-server -make cover # Full coverage report with gate checks -cd mcp-server && go test ./... # Isolated run +go test -race ./... ``` ### Key test cases @@ -185,9 +185,8 @@ From `main_test.go`: ## References -- **`mcp-server/README.md`** — run instructions, transport details, RBAC blast radius, tool descriptions. +- **[`README.md`](README.md)** — run instructions, transport details, RBAC blast radius, tool descriptions. - **`charts/gameplane/templates/mcp-server.yaml`** — Helm template (ServiceAccount, ClusterRole, Deployment). -- **`docs/security.md`** — threat model, mcp-server section, admin decision guidance. -- **`go.work`** — workspace that links all Go modules (operator, api, agent, mcp-server, etc.). +- **[`docs/security.md`](https://github.com/GameplanePanel/Gameplane/blob/master/docs/security.md)** — threat model, mcp-server section, admin decision guidance. - **Model Context Protocol spec** — https://modelcontextprotocol.io/ diff --git a/system-deps.toml b/system-deps.toml index e538372..c696005 100644 --- a/system-deps.toml +++ b/system-deps.toml @@ -6,10 +6,10 @@ component = "mcp-server" name = "go" kind = "toolchain" version = "go" -reason = "Compiles and tests the mcp-server module (go.work:3-21; inventory 2.1)." +reason = "Compiles and tests the mcp-server module." [[dep]] name = "golangci-lint" kind = "cli" version = "golangci_lint" -reason = "make lint-go runs golangci-lint in this module (Makefile:302-305; GO_MODULES at Makefile:43)." +reason = "golangci-lint runs on this module with Gameplane's root .golangci.yml (shared go-component.yaml workflow)."