From 020d3e5350f376429bd8939ec787b275a202021b Mon Sep 17 00:00:00 2001 From: Claude Date: Mon, 23 Nov 2026 08:34:32 +0000 Subject: [PATCH 1/4] docs(specs): tick spec 037 tasks against merged work Co-Authored-By: Claude Opus 5.5 Signed-off-by: Claude --- docs/agent-architecture.md | 2 +- .../contracts/api-mcp-token-auth.md | 6 +- .../research.md | 2 +- .../037-scope-mcp-server-permissions/spec.md | 2 +- .../037-scope-mcp-server-permissions/tasks.md | 86 +++++++++---------- 5 files changed, 49 insertions(+), 49 deletions(-) diff --git a/docs/agent-architecture.md b/docs/agent-architecture.md index 677cda80f..4767eab82 100644 --- a/docs/agent-architecture.md +++ b/docs/agent-architecture.md @@ -61,7 +61,7 @@ This document is the **first stop** for AI agents modifying or extending Gamepla | Change the website | `website/AGENTS.md` (submodule) | | Add a DB migration | `api/specs.md`, `api/internal/db/migrations/README.md` | | Change CI or a workflow | `docs/contributing.md` ("CI and workflows", "How CI picks tests") | -| Change personal MCP tokens or the MCP read routes (`api/internal/auth/mcptokens.go`, `api/internal/handlers/mcp_tokens.go`, `api/internal/handlers/pods.go`) | `api/specs.md`, `docs/security.md` ("mcp-server (optional)") | +| Change personal MCP tokens or the MCP read routes (`api/internal/auth/mcptokens.go`, `api/internal/handlers/mcp_tokens.go`, `api/internal/handlers/pods.go`, `web/src/routes/McpTokens.tsx`, the MCP tokens dialog in `web/src/routes/Users.tsx`) | `api/specs.md`, `web/specs.md`, `docs/security.md` ("mcp-server (optional)") | | Change MCP server RBAC or namespace scope (`charts/gameplane/templates/mcp-server.yaml`, `charts/gameplane/tests/mcp-server-rbac.sh`) | `docs/security.md` ("mcp-server (optional)"), `mcp-server/specs.md` | | Decide where new code goes | `docs/layout.md` | diff --git a/specs/037-scope-mcp-server-permissions/contracts/api-mcp-token-auth.md b/specs/037-scope-mcp-server-permissions/contracts/api-mcp-token-auth.md index 03f1be728..5050163f6 100644 --- a/specs/037-scope-mcp-server-permissions/contracts/api-mcp-token-auth.md +++ b/specs/037-scope-mcp-server-permissions/contracts/api-mcp-token-auth.md @@ -19,7 +19,7 @@ All mutating routes keep the CSRF check. RBAC rules: new self rules next to `/us - Invalid, expired, revoked, epoch-mismatched or unknown tokens all get the same `401 server.common.unauthenticated` body as a missing session (FR-014). Store failures get `503 server.generic.503`, as for sessions. - Rate limit: token requests count against the existing per-user limiter; failed token lookups count against the per-IP auth limiter, like failed logins. -## Token guard (`mcpTokenGuard`, runs after `Authenticate`, before `rbac.Middleware`) +## Token guard (`MCPTokenGuard`, runs after `Authenticate`, before `rbac.Middleware`) A token-authenticated request passes only when the method is GET or HEAD, it is not a WebSocket upgrade, and its route pattern is on this allow-list: @@ -33,11 +33,11 @@ A token-authenticated request passes only when the method is GET or HEAD, it is /backups /backups/{name} /schedules /schedules/{name} /restores /restores/{name} -/modules /modules/{name} /modules/sources +/modules /modules/{name} /modules/sources (/modules/catalog is refused) /users/me/servers /pods /pods/{name} /kube-events -/admin/system-logs/{component} +/admin/system-logs/{api|operator} ``` Everything else → `403 server.forbidden`, audited with reason `mcp-refused`. The list is a Go slice next to the guard, and a unit test fails if a route on it is not GET-only in the router. diff --git a/specs/037-scope-mcp-server-permissions/research.md b/specs/037-scope-mcp-server-permissions/research.md index 1bca10208..8c2b7b3ac 100644 --- a/specs/037-scope-mcp-server-permissions/research.md +++ b/specs/037-scope-mcp-server-permissions/research.md @@ -26,7 +26,7 @@ Facts below were read from `master` at `73389d7a` (2026-11-22) and from the `mcp ### R2. How the API accepts a token -- **Decision:** `Authenticate` keeps the cookie path unchanged. When there is no session cookie and the request carries `Authorization: Bearer gpmcp_…`, it looks the token up (digest, not expired, not revoked, `session_epoch` still matches the user), loads permissions with `LoadPerms`, marks the request context as token-authenticated, and sets the audit actor to ` (mcp)`. A new `mcpTokenGuard` middleware, mounted right after `Authenticate`, rejects every token-authenticated request whose method is not GET/HEAD or whose route is not in the allow-list (contracts/api-mcp-token-auth.md). WebSocket upgrades are never on the list. +- **Decision:** `Authenticate` keeps the cookie path unchanged. When there is no session cookie and the request carries `Authorization: Bearer gpmcp_…`, it looks the token up (digest, not expired, not revoked, `session_epoch` still matches the user), loads permissions with `LoadPerms`, marks the request context as token-authenticated, and sets the audit actor to ` (mcp)`. A new `MCPTokenGuard` middleware, mounted right after `Authenticate`, rejects every token-authenticated request whose method is not GET/HEAD or whose route is not in the allow-list (contracts/api-mcp-token-auth.md). WebSocket upgrades are never on the list. - **Rationale:** permissions come from the same `rbac.Middleware`, owner fallback and handlers as the dashboard (FR-011, FR-020). The allow-list makes "read-only" a property of the API, not of the MCP client. Loading permissions per request gives FR-013 for free. - **Alternatives:** method-only guard (some GETs are sensitive, such as capture file downloads or console WebSocket upgrades; rejected); a separate `/mcp/*` API surface (duplicates every permission rule; rejected by OD-2). diff --git a/specs/037-scope-mcp-server-permissions/spec.md b/specs/037-scope-mcp-server-permissions/spec.md index 2f1b77e9e..af299a217 100644 --- a/specs/037-scope-mcp-server-permissions/spec.md +++ b/specs/037-scope-mcp-server-permissions/spec.md @@ -157,4 +157,4 @@ When the Gameplane API itself is broken, a cluster admin can still use the MCP s - The Cluster and NetworkCapture kinds stay out of the MCP server's tools, as today. - The dashboard's existing permission keys and per-cluster grants are the only source of user permissions. This spec adds no new permission key for managing personal MCP tokens beyond what is needed for users to manage their own (decided in planning). - Code changes span the `GameplanePanel/mcp` repo (server) and `GameplanePanel/Gameplane` (chart, API, docs, and the `mcp-server` submodule pointer after mcp PRs merge). Gameplane PR #993, which makes `mcp-server/` a submodule, merges first. -- Any dashboard screen this needs (the personal MCP token screen) is designed in `design.pen` before code, per the design-first rule. +- Any dashboard screen this needs (the personal MCP token screen) is designed in `design.fig` before code, per the design-first rule. diff --git a/specs/037-scope-mcp-server-permissions/tasks.md b/specs/037-scope-mcp-server-permissions/tasks.md index c6ef0c8da..f4d8e0495 100644 --- a/specs/037-scope-mcp-server-permissions/tasks.md +++ b/specs/037-scope-mcp-server-permissions/tasks.md @@ -20,16 +20,16 @@ ## Phase 1: Setup -- [ ] T001 Confirm the docs PR for this spec folder is merged to `master`, then create the four branches from fresh `master` (Gameplane) and `main` (mcp) named in **Delivery** above; record the base SHAs in the PR A description. +- [X] T001 Confirm the docs PR for this spec folder is merged to `master`, then create the four branches from fresh `master` (Gameplane) and `main` (mcp) named in **Delivery** above; record the base SHAs in the PR A description. (done: branches created from master after #1044 merged (0aecce96)) - [X] T002 List every existing test that encodes behaviour this spec changes, with file, test name, assertion and the needed change, and get valgul's written sign-off on each before editing any of them. Candidates found by grep on master `73389d7a`: `mcp-server/main_test.go` (`TestRegisteredToolsAreReadOnly`, `TestToolsListAndGetHappyPath`, `TestListEventsHandler_StripsAndBounds`; expected to stay unchanged because `*kube.Client` keeps satisfying the new `Reader` interface and break-glass with no allow-list behaves as today), `mcp-server/internal/kube/client_test.go`, `test/e2e/optional_components_e2e_test.go` (subtest `mcp`, lines 342-400; comment mentions the ClusterRole), `api/internal/auth/sessions_*_test.go` (cookie-only `Authenticate`), `api/internal/rbac/rbac_test.go` and `catalog_test.go` (rule table cross-checks). If none needs a change, write "none needed" with the reason per file in `specs/037-scope-mcp-server-permissions/T002-test-signoff.md`. --- ## Phase 2: Foundational (blocks every story) -- [ ] T003 Add the portable migration `api/internal/db/migrations/common/023_mcp_tokens.sql` creating `mcp_tokens` exactly as in data-model.md (columns, FK cascade, unique `digest`, unique `(user_id, name)`, index on `user_id`); no dialect functions, timestamps bound from Go. -- [ ] T004 [P] In the mcp repo, add `mcp-server/internal/reader/reader.go` with the `Reader` interface (`ListCRD`, `GetCRD`, `ListPods`, `GetPod`, `ListEvents`, `PodLogs`, each taking an optional cluster and, where relevant, server) and change `newMCPServer`, `registerTools` and every handler in `mcp-server/main.go`, `mcp-server/tools.go`, `mcp-server/fixadvice.go` to take `reader.Reader` instead of `*kube.Client`; `*kube.Client` implements it unchanged (cluster arguments other than local return "cluster not available in break-glass mode"). -- [ ] T005 [P] Add the optional `cluster` argument to every tool input, `server` to `list_pods`, `list_events` and `get_pod_logs`, in `mcp-server/tools.go`, per contracts/mcp-server-modes.md; tool names stay unchanged. +- [X] T003 Add the portable migration `api/internal/db/migrations/common/023_mcp_tokens.sql` creating `mcp_tokens` exactly as in data-model.md (columns, FK cascade, unique `digest`, unique `(user_id, name)`, index on `user_id`); no dialect functions, timestamps bound from Go. (done: #1045, api/internal/db/migrations/common/023_mcp_tokens.sql) +- [X] T004 [P] In the mcp repo, add `mcp-server/internal/reader/reader.go` with the `Reader` interface (`ListCRD`, `GetCRD`, `ListPods`, `GetPod`, `ListEvents`, `PodLogs`, each taking an optional cluster and, where relevant, server) and change `newMCPServer`, `registerTools` and every handler in `mcp-server/main.go`, `mcp-server/tools.go`, `mcp-server/fixadvice.go` to take `reader.Reader` instead of `*kube.Client`; `*kube.Client` implements it unchanged (cluster arguments other than local return "cluster not available in break-glass mode"). (done in mcp #5 (059524ce tree): mcp-server/internal/reader/reader.go, panel_invariants_test.go; handlers take reader.Reader) +- [X] T005 [P] Add the optional `cluster` argument to every tool input, `server` to `list_pods`, `list_events` and `get_pod_logs`, in `mcp-server/tools.go`, per contracts/mcp-server-modes.md; tool names stay unchanged. (done in mcp #5: mcp-server/tools.go (cluster arg on all tools, server arg on list_pods/list_events/get_pod_logs)) **Checkpoint**: `go build ./...` passes in `api/` and in `mcp-server/` (`GOWORK=off`). @@ -41,12 +41,12 @@ **Independent Test**: quickstart.md §1 (`kubectl auth can-i` matrix, `list_pods` with and without a namespace). -- [ ] T006 [US1] In `charts/gameplane/templates/mcp-server.yaml`, replace ClusterRole/ClusterRoleBinding `{{ .Release.Name }}-mcp-server-read` with: ClusterRole + ClusterRoleBinding `{{ .Release.Name }}-mcp-server-catalog-read` (get/list/watch on `gametemplates`, `modules`, `modulesources`); Role + RoleBinding `{{ .Release.Name }}-mcp-server-read` in `.Release.Namespace` (get/list/watch `pods`, `events`; get `pods/log`); and the same Role + RoleBinding plus `gameservers`, `backups`, `backupschedules`, `restores` in each namespace from `include "gameplane.operatorGameNamespaces" . | fromJsonArray`. No write verb anywhere; keep the `api.standalone` and `mcpServer.enabled` guards and the header comments updated. -- [ ] T007 [US1] In the same template, add env `GAMEPLANE_MCP_NAMESPACES` to the Deployment container: comma-joined release namespace + managed game namespaces (uniq). -- [ ] T008 [P] [US1] In `mcp-server/internal/kube/client.go`, add a namespace allow-list read from `GAMEPLANE_MCP_NAMESPACES` (comma-separated, trimmed, empty = unrestricted): an explicit namespace outside it returns error `namespace not in scope` before any API call; "all namespaces" for pods, events and namespaced CRDs loops over the allow-list and merges results (events then pass through the existing `boundAndSortEvents`); a listed namespace that does not exist or is forbidden is skipped and reported in the result notice, not fatal. -- [ ] T009 [P] [US1] New tests in `mcp-server/internal/kube/allowlist_test.go`: out-of-scope namespace refused with no client call; all-namespaces merges only allowed ones; unset env keeps today's behaviour; missing namespace skipped with notice. -- [ ] T010 [US1] New chart check script `charts/gameplane/tests/mcp-server-rbac.sh` (same shape as `charts/gameplane/tests/monitoring-rules.sh`, called from the chart job in `.github/workflows/ci.yaml` next to it): render with `mcpServer.enabled=true` and `operator.gameNamespaces={tenant-b}`, assert no ClusterRole grants `pods`, `events` or `pods/log`, Roles exist in the release namespace, `gameplane-games` and `tenant-b`, and no rule has a write verb. -- [ ] T011 [US1] New E2E `TestOptionalComponents_MCPNamespaceScope` in `test/e2e/optional_components_scope_e2e_test.go` (bucket `optional-components`, register in `test/e2e/buckets.sh`): `kubectl auth can-i` matrix from quickstart.md §1 for the MCP ServiceAccount, `list_pods` with no namespace returns only in-scope pods, `list_pods namespace=kube-system` returns a tool error, and the old ClusterRole `gameplane-mcp-server-read` is gone after `helm upgrade`. `t.Parallel()` only if the bucket's lifecycle test allows it (bucket comment at `buckets.sh:424`). +- [X] T006 [US1] In `charts/gameplane/templates/mcp-server.yaml`, replace ClusterRole/ClusterRoleBinding `{{ .Release.Name }}-mcp-server-read` with: ClusterRole + ClusterRoleBinding `{{ .Release.Name }}-mcp-server-catalog-read` (get/list/watch on `gametemplates`, `modules`, `modulesources`); Role + RoleBinding `{{ .Release.Name }}-mcp-server-read` in `.Release.Namespace` (get/list/watch `pods`, `events`; get `pods/log`); and the same Role + RoleBinding plus `gameservers`, `backups`, `backupschedules`, `restores` in each namespace from `include "gameplane.operatorGameNamespaces" . | fromJsonArray`. No write verb anywhere; keep the `api.standalone` and `mcpServer.enabled` guards and the header comments updated. (done in #1046: charts/gameplane/templates/mcp-server.yaml (catalog ClusterRole, namespaced Roles)) +- [X] T007 [US1] In the same template, add env `GAMEPLANE_MCP_NAMESPACES` to the Deployment container: comma-joined release namespace + managed game namespaces (uniq). (done in #1046: charts/gameplane/templates/mcp-server.yaml:125 GAMEPLANE_MCP_NAMESPACES) +- [X] T008 [P] [US1] In `mcp-server/internal/kube/client.go`, add a namespace allow-list read from `GAMEPLANE_MCP_NAMESPACES` (comma-separated, trimmed, empty = unrestricted): an explicit namespace outside it returns error `namespace not in scope` before any API call; "all namespaces" for pods, events and namespaced CRDs loops over the allow-list and merges results (events then pass through the existing `boundAndSortEvents`); a listed namespace that does not exist or is forbidden is skipped and reported in the result notice, not fatal. (done in mcp #5: mcp-server/internal/kube/client.go (ErrNamespaceNotInScope, GAMEPLANE_MCP_NAMESPACES parsing)) +- [X] T009 [P] [US1] New tests in `mcp-server/internal/kube/allowlist_test.go`: out-of-scope namespace refused with no client call; all-namespaces merges only allowed ones; unset env keeps today's behaviour; missing namespace skipped with notice. (done in mcp #5: mcp-server/internal/kube/allowlist_test.go (TestAllowlistRejectsOutOfScopeNamespace, TestAllowlistMergesOnlyAllowedNamespaces, TestAllowlistSkipsMissingAndForbiddenNamespaces)) +- [X] T010 [US1] New chart check script `charts/gameplane/tests/mcp-server-rbac.sh` (same shape as `charts/gameplane/tests/monitoring-rules.sh`, called from the chart job in `.github/workflows/ci.yaml` next to it): render with `mcpServer.enabled=true` and `operator.gameNamespaces={tenant-b}`, assert no ClusterRole grants `pods`, `events` or `pods/log`, Roles exist in the release namespace, `gameplane-games` and `tenant-b`, and no rule has a write verb. (done in #1046: charts/gameplane/tests/mcp-server-rbac.sh, called from .github/workflows/ci.yaml:1240) +- [X] T011 [US1] New E2E `TestOptionalComponents_MCPNamespaceScope` in `test/e2e/optional_components_scope_e2e_test.go` (bucket `optional-components`, register in `test/e2e/buckets.sh`): `kubectl auth can-i` matrix from quickstart.md §1 for the MCP ServiceAccount, `list_pods` with no namespace returns only in-scope pods, `list_pods namespace=kube-system` returns a tool error, and the old ClusterRole `gameplane-mcp-server-read` is gone after `helm upgrade`. `t.Parallel()` only if the bucket's lifecycle test allows it (bucket comment at `buckets.sh:424`). (done in #1046 as TestOptionalComponents_MCPScope (test/e2e/optional_components_scope_e2e_test.go:56; name differs from task)) **Checkpoint**: US1 delivered by the mcp PR + PR C chart changes. @@ -60,36 +60,36 @@ ### API (PR A) -- [ ] T012 [US2] Create `api/internal/auth/mcptokens.go`: token generation (`gpmcp_` + 43 base64url chars from `crypto/rand`), SHA-256 digest, `CreateToken(ctx, userID, name, days)` (days ∈ {7, 30, 90, 365}, name 1-64 chars trimmed, max 10 active per user, copy `session_epoch`), `ListTokens(ctx, userID)`, `RevokeToken(ctx, userID, tokenID)`, `lookupToken(ctx, raw)` (valid only if digest matches, not revoked, not expired, epoch equals user's), `touchLastUsed` (at most once a minute per token). Wrap errors with `%w`. -- [ ] T013 [US2] In `api/internal/auth/sessions.go` `Authenticate`: when there is no session cookie and the `Authorization` header is `Bearer gpmcp_…`, authenticate through `lookupToken`, load perms with `LoadPerms`, put the user plus `ViaMCPToken`/`MCPTokenID` on the context, and `SetActor(ctx, username+" (mcp)")`. Same 401/503 bodies as the cookie path. Cookie behaviour unchanged. -- [ ] T014 [US2] Add `MCPTokenGuard` in `api/internal/auth/mcptokens.go`: for token requests, allow only GET/HEAD, no WebSocket upgrade, and route patterns on the allow-list in contracts/api-mcp-token-auth.md (match on `chi.RouteContext` pattern after routing, or an equivalent path matcher kept next to the list); else 403 `server.forbidden`. Mount it in `api/cmd/main.go` right after `sessions.Authenticate` (`api/cmd/main.go:389`). -- [ ] T015 [US2] Audit in `api/internal/auth/mcptokens.go` + `api/internal/audit/`: one `mcp-session` row per (token, `X-Gameplane-MCP-Session`) per 24 hours (in-memory TTL set), and an `mcp-refused` row for every refused token request (guard, RBAC or invalid token), per data-model.md. -- [ ] T016 [US2] Create `api/internal/handlers/mcp_tokens.go` with `GET/POST /users/me/mcp-tokens`, `DELETE /users/me/mcp-tokens/{id}`, `GET /users/{id}/mcp-tokens`, `DELETE /users/{id}/mcp-tokens/{tokenId}` per contracts/api-mcp-token-auth.md (the secret only in the POST response; token requests can never reach these routes). Mount in `api/cmd/main.go` next to `MountUsers`. -- [ ] T017 [US2] Add RBAC rules in `api/internal/rbac/rbac.go`: self rules for `/users/me/mcp-tokens` (GET, POST, DELETE prefix) next to lines 192-197 with `perm: ""`; `pods` and `kube-events` segments → `servers:read` (namespaced); control-plane namespace on those two segments requires `*` on the local cluster. -- [ ] T018 [US2] Create `api/internal/handlers/pods.go` with `GET /pods`, `GET /pods/{name}`, `GET /kube-events`, `GET /servers/{name}/pods`, `GET /servers/{name}/logs/pod/tail` per contracts/api-reads.md (cluster via `resolveCluster`, namespace via `scope.Resolve` or the admin-only control-plane namespace, managedFields stripped, events newest 100 with `truncated`/`total`, log tail default 200 lines, max 5000, newest 256 KiB, `text/plain`). Mount in `api/cmd/main.go`. -- [ ] T019 [P] [US2] New unit tests `api/internal/auth/mcptokens_test.go`: format, digest-only storage, each invalid state (expired, revoked, epoch bumped, user deleted), lifetime and name validation, 10-token limit, `last_used_at` throttle, guard allow and deny (POST, WebSocket, unlisted GET), and a test that every allow-list route is registered GET-only in the router. +- [X] T012 [US2] Create `api/internal/auth/mcptokens.go`: token generation (`gpmcp_` + 43 base64url chars from `crypto/rand`), SHA-256 digest, `CreateToken(ctx, userID, name, days)` (days ∈ {7, 30, 90, 365}, name 1-64 chars trimmed, max 10 active per user, copy `session_epoch`), `ListTokens(ctx, userID)`, `RevokeToken(ctx, userID, tokenID)`, `lookupToken(ctx, raw)` (valid only if digest matches, not revoked, not expired, epoch equals user's), `touchLastUsed` (at most once a minute per token). Wrap errors with `%w`. (done: api/internal/auth/mcptokens.go (CreateMCPToken, ListMCPTokens, RevokeMCPToken, lookupMCPToken; names differ from task)) +- [X] T013 [US2] In `api/internal/auth/sessions.go` `Authenticate`: when there is no session cookie and the `Authorization` header is `Bearer gpmcp_…`, authenticate through `lookupToken`, load perms with `LoadPerms`, put the user plus `ViaMCPToken`/`MCPTokenID` on the context, and `SetActor(ctx, username+" (mcp)")`. Same 401/503 bodies as the cookie path. Cookie behaviour unchanged. (done: api/internal/auth/sessions.go:183 (bearerMCPToken in Authenticate)) +- [X] T014 [US2] Add `MCPTokenGuard` in `api/internal/auth/mcptokens.go`: for token requests, allow only GET/HEAD, no WebSocket upgrade, and route patterns on the allow-list in contracts/api-mcp-token-auth.md (match on `chi.RouteContext` pattern after routing, or an equivalent path matcher kept next to the list); else 403 `server.forbidden`. Mount it in `api/cmd/main.go` right after `sessions.Authenticate` (`api/cmd/main.go:389`). (done: api/internal/auth/mcptokens.go (MCPTokenGuard, MCPTokenRoutes); mounted api/cmd/main.go:399) +- [X] T015 [US2] Audit in `api/internal/auth/mcptokens.go` + `api/internal/audit/`: one `mcp-session` row per (token, `X-Gameplane-MCP-Session`) per 24 hours (in-memory TTL set), and an `mcp-refused` row for every refused token request (guard, RBAC or invalid token), per data-model.md. (done: api/internal/auth/mcptokens.go (firstMCPSession, mcpAudit, mcp-refused)) +- [X] T016 [US2] Create `api/internal/handlers/mcp_tokens.go` with `GET/POST /users/me/mcp-tokens`, `DELETE /users/me/mcp-tokens/{id}`, `GET /users/{id}/mcp-tokens`, `DELETE /users/{id}/mcp-tokens/{tokenId}` per contracts/api-mcp-token-auth.md (the secret only in the POST response; token requests can never reach these routes). Mount in `api/cmd/main.go` next to `MountUsers`. (done: api/internal/handlers/mcp_tokens.go; mounted via MountUsers (api/internal/handlers/mcp_tokens.go:25-29)) +- [X] T017 [US2] Add RBAC rules in `api/internal/rbac/rbac.go`: self rules for `/users/me/mcp-tokens` (GET, POST, DELETE prefix) next to lines 192-197 with `perm: ""`; `pods` and `kube-events` segments → `servers:read` (namespaced); control-plane namespace on those two segments requires `*` on the local cluster. (done: api/internal/rbac/rbac.go:215-220 (MCP token self rules, pods and kube-events rules)) +- [X] T018 [US2] Create `api/internal/handlers/pods.go` with `GET /pods`, `GET /pods/{name}`, `GET /kube-events`, `GET /servers/{name}/pods`, `GET /servers/{name}/logs/pod/tail` per contracts/api-reads.md (cluster via `resolveCluster`, namespace via `scope.Resolve` or the admin-only control-plane namespace, managedFields stripped, events newest 100 with `truncated`/`total`, log tail default 200 lines, max 5000, newest 256 KiB, `text/plain`). Mount in `api/cmd/main.go`. (done: api/internal/handlers/pods.go (MountPods, api/cmd/main.go:413)) +- [X] T019 [P] [US2] New unit tests `api/internal/auth/mcptokens_test.go`: format, digest-only storage, each invalid state (expired, revoked, epoch bumped, user deleted), lifetime and name validation, 10-token limit, `last_used_at` throttle, guard allow and deny (POST, WebSocket, unlisted GET), and a test that every allow-list route is registered GET-only in the router. (done: api/internal/auth/mcptokens_test.go and mcptokens_review_test.go (route GET-only test at mcptokens_test.go:409)) - [ ] T020 [P] [US2] New envtest `api/internal/handlers/mcp_tokens_envtest_test.go`: create/list/revoke as self, admin list/revoke needs `users:read`/`users:manage`, a token cannot call token routes, CSRF still required for cookie POST/DELETE, audit rows written. - [ ] T021 [P] [US2] New envtest `api/internal/handlers/pods_envtest_test.go`: namespace-scoped `servers:read` user sees only that namespace; owner-only user reaches `/servers/{name}/pods` and log tail but not `/pods`; control-plane namespace denied for non-admin, allowed for `*`; unknown cluster → forbidden; log tail bounds; events truncation. -- [ ] T022 [US2] Add the client methods and types to `web/src/lib/api.ts` (`listMcpTokens`, `createMcpToken`, `revokeMcpToken`, `listUserMcpTokens`, `revokeUserMcpToken`). -- [ ] T023 [US2] New E2E `TestAPI_RBAC_MCPTokenReads` in `test/e2e/api_rbac_mcp_token_e2e_test.go` (bucket `api-rbac`, register in `test/e2e/buckets.sh`; uses 2 logins of the bucket budget): token user with `servers:read` in one namespace reads only that namespace through `/servers`, `/pods`, `/kube-events`; POST with the token → 403; role removal → next read 403; revoke → 401; password reset → 401. `t.Parallel()`, unique names. -- [ ] T024 [US2] Changelog `changelog/unreleased/-mcp-tokens-api.md` (personal MCP tokens, new read routes). +- [X] T022 [US2] Add the client methods and types to `web/src/lib/api.ts` (`listMcpTokens`, `createMcpToken`, `revokeMcpToken`, `listUserMcpTokens`, `revokeUserMcpToken`). (done: web/src/lib/api.ts:503-530 (listMcpTokens, createMcpToken, revokeMcpToken, listUserMcpTokens, revokeUserMcpToken)) +- [X] T023 [US2] New E2E `TestAPI_RBAC_MCPTokenReads` in `test/e2e/api_rbac_mcp_token_e2e_test.go` (bucket `api-rbac`, register in `test/e2e/buckets.sh`; uses 2 logins of the bucket budget): token user with `servers:read` in one namespace reads only that namespace through `/servers`, `/pods`, `/kube-events`; POST with the token → 403; role removal → next read 403; revoke → 401; password reset → 401. `t.Parallel()`, unique names. (done: test/e2e/api_rbac_mcp_token_e2e_test.go:21 TestAPI_RBAC_MCPTokenReads) +- [X] T024 [US2] Changelog `changelog/unreleased/-mcp-tokens-api.md` (personal MCP tokens, new read routes). (done: changelog/unreleased/1045-mcp-tokens-api.md) ### Design and dashboard (design branch, PR B) -- [ ] T025 [US2] Design in `design.fig` (OpenPencil per CLAUDE.md rule 1, canvas layout per the `pen-canvas-layout` skill): MCP tokens page (list with rows, empty state), Create token dialog (name, expiry 7/30/90/365 default 30), one-time reveal with copy and client config snippet, revoke confirm, mobile list, and the admin "MCP tokens" dialog on Users & RBAC, per contracts/ui-mcp-tokens.md; run `pen-componentize`, then `hack/design/fig-export.ts` and commit the export in `assets/design-export/` in the same commit. Stop for valgul's design sign-off before T026. -- [ ] T026 [US2] Build `web/src/routes/McpTokens.tsx` from the approved export, register `/settings/mcp-tokens` in `web/src/router/tree.tsx`, add the user-menu entry next to Theme settings, TanStack Query for list/create/revoke. -- [ ] T027 [US2] Add the admin "MCP tokens" dialog to the user row menu in `web/src/routes/Users.tsx` (list and revoke, revoke hidden without `users:manage`). -- [ ] T028 [P] [US2] Add every new string to the English i18n pack under `i18n/` with descriptions, keys `web.routes.mcp_tokens.*` and `web.routes.users.mcp_tokens.*`. -- [ ] T029 [P] [US2] New Vitest `web/src/routes/McpTokens.test.tsx` and `web/src/routes/Users_mcptokens.test.tsx`: list states, create flow shows the secret once, copy, revoke confirm, admin dialog permission gating. -- [ ] T030 [US2] Changelog `changelog/unreleased/-mcp-tokens-page.md`. +- [X] T025 [US2] Design in `design.fig` (OpenPencil per CLAUDE.md rule 1, canvas layout per the `pen-canvas-layout` skill): MCP tokens page (list with rows, empty state), Create token dialog (name, expiry 7/30/90/365 default 30), one-time reveal with copy and client config snippet, revoke confirm, mobile list, and the admin "MCP tokens" dialog on Users & RBAC, per contracts/ui-mcp-tokens.md; run `pen-componentize`, then `hack/design/fig-export.ts` and commit the export in `assets/design-export/` in the same commit. Stop for valgul's design sign-off before T026. (done: design merged in #1067 (design commit 9ffccf00, export in assets/design-export/); valgul signed off 2026-11-22 ("yeah go ahead")) +- [X] T026 [US2] Build `web/src/routes/McpTokens.tsx` from the approved export, register `/settings/mcp-tokens` in `web/src/router/tree.tsx`, add the user-menu entry next to Theme settings, TanStack Query for list/create/revoke. (done: web/src/routes/McpTokens.tsx, web/src/router/tree.tsx:168) +- [X] T027 [US2] Add the admin "MCP tokens" dialog to the user row menu in `web/src/routes/Users.tsx` (list and revoke, revoke hidden without `users:manage`). (done: web/src/routes/Users.tsx:342,496 (UserMcpTokensDialog)) +- [X] T028 [P] [US2] Add every new string to the English i18n pack under `i18n/` with descriptions, keys `web.routes.mcp_tokens.*` and `web.routes.users.mcp_tokens.*`. (done: i18n/locales/en/app.json (web.routes.mcp_tokens.* and web.routes.users.mcp_tokens keys present)) +- [X] T029 [P] [US2] New Vitest `web/src/routes/McpTokens.test.tsx` and `web/src/routes/Users_mcptokens.test.tsx`: list states, create flow shows the secret once, copy, revoke confirm, admin dialog permission gating. (done: web/src/routes/McpTokens.test.tsx, web/src/routes/Users_mcptokens.test.tsx) +- [X] T030 [US2] Changelog `changelog/unreleased/-mcp-tokens-page.md`. (done: changelog/unreleased/1067-mcp-tokens-page.md) ### MCP per-user mode (mcp repo PR) -- [ ] T031 [US2] Create `mcp-server/internal/panel/client.go`: `reader.Reader` over HTTPS to the API with `Authorization: Bearer` from `GAMEPLANE_MCP_TOKEN`, `X-Gameplane-MCP-Session` random per process, only `http.MethodGet`, TLS verified (optional `--panel-ca` PEM), HTTPS required except loopback, maps each method to the routes in contracts/mcp-server-modes.md (GameServer list falls back to `/users/me/servers` on 403; logs of API/operator pods go to `/admin/system-logs/{component}`), API errors returned as the API's message with the token redacted. -- [ ] T032 [US2] In `mcp-server/main.go` `runServe`: with `--panel-url`/`GAMEPLANE_PANEL_URL` set, require `GAMEPLANE_MCP_TOKEN` (exit with a clear error otherwise) and use the panel client; else break-glass `kube.Client`. Print the mode to stderr on start. -- [ ] T033 [P] [US2] New tests `mcp-server/internal/panel/client_test.go` against `httptest`: each method hits the right route with the right query, only GET is ever sent (tripwire scanning the package source for other `http.Method*` constants), token never appears in errors or logs, 401/403/404 mapping, owner fallback. -- [ ] T034 [P] [US2] New test `TestPanelClientHasNoMutatingMethods` in `mcp-server/main_test.go` (new function, existing ones untouched) reflecting over `panel.Client`'s method set like `TestClientHasNoMutatingMethods`. -- [ ] T035 [US2] Update `mcp-server/README.md` and `mcp-server/specs.md`: per-user mode setup (create a token, env vars, `docker run -i` example, MCP client config), break-glass mode and its namespace scope, remove the "cluster-wide accepted tradeoff" section (FR-032). +- [X] T031 [US2] Create `mcp-server/internal/panel/client.go`: `reader.Reader` over HTTPS to the API with `Authorization: Bearer` from `GAMEPLANE_MCP_TOKEN`, `X-Gameplane-MCP-Session` random per process, only `http.MethodGet`, TLS verified (optional `--panel-ca` PEM), HTTPS required except loopback, maps each method to the routes in contracts/mcp-server-modes.md (GameServer list falls back to `/users/me/servers` on 403; logs of API/operator pods go to `/admin/system-logs/{component}`), API errors returned as the API's message with the token redacted. (done in mcp #5: mcp-server/internal/panel/client.go) +- [X] T032 [US2] In `mcp-server/main.go` `runServe`: with `--panel-url`/`GAMEPLANE_PANEL_URL` set, require `GAMEPLANE_MCP_TOKEN` (exit with a clear error otherwise) and use the panel client; else break-glass `kube.Client`. Print the mode to stderr on start. (done in mcp #5: mcp-server/main.go runServe (lines 131-149)) +- [X] T033 [P] [US2] New tests `mcp-server/internal/panel/client_test.go` against `httptest`: each method hits the right route with the right query, only GET is ever sent (tripwire scanning the package source for other `http.Method*` constants), token never appears in errors or logs, 401/403/404 mapping, owner fallback. (done in mcp #5: mcp-server/internal/panel/client_test.go (TestReaderMethodsHitPanelPaths, TestNewValidatesURLAndToken, etc.); GET-only tripwire in source_test.go) +- [X] T034 [P] [US2] New test `TestPanelClientHasNoMutatingMethods` in `mcp-server/main_test.go` (new function, existing ones untouched) reflecting over `panel.Client`'s method set like `TestClientHasNoMutatingMethods`. (done in mcp #5 as TestPanelClientHasNoMutatingMethods in mcp-server/panel_invariants_test.go:22 (not main_test.go)) +- [X] T035 [US2] Update `mcp-server/README.md` and `mcp-server/specs.md`: per-user mode setup (create a token, env vars, `docker run -i` example, MCP client config), break-glass mode and its namespace scope, remove the "cluster-wide accepted tradeoff" section (FR-032). (done in mcp #5: mcp-server/README.md (per-user and break-glass sections), mcp-server/specs.md) **Checkpoint**: US2 testable end to end once PR A, PR B and the mcp PR are merged and PR C bumps the pointer. @@ -101,10 +101,10 @@ **Independent Test**: quickstart.md §3. -- [ ] T036 [US3] In `mcp-server/internal/panel/client.go`: with no `cluster` argument, call `/clusters`, run the read on each listed cluster concurrently (bounded, 4 at a time, 10 s each), return results grouped by cluster plus `unavailable: [ids]`; with no `namespace`, use `/namespaces?cluster=` for that cluster. +- [X] T036 [US3] In `mcp-server/internal/panel/client.go`: with no `cluster` argument, call `/clusters`, run the read on each listed cluster concurrently (bounded, 4 at a time, 10 s each), return results grouped by cluster plus `unavailable: [ids]`; with no `namespace`, use `/namespaces?cluster=` for that cluster. (done in mcp #5: mcp-server/internal/panel/fanout.go (fanOut, bounded semaphore)) - [ ] T037 [US3] Shape grouped results in `mcp-server/tools.go` (`{clusters: {: …}, unavailable: […]}`), keeping single-cluster output unchanged when `cluster` is given. -- [ ] T038 [P] [US3] New tests `mcp-server/internal/panel/fanout_test.go`: two clusters merged and labelled, one unreachable reported not fatal, forbidden cluster indistinguishable from unknown. -- [ ] T039 [US3] New E2E `TestMultiCluster_MCPTokenRemoteGrant` in `test/e2e/multicluster_mcp_e2e_test.go` (bucket `multicluster`, register in `test/e2e/buckets.sh`): user with a remote grant for one namespace reads it with `?cluster=` through the token, gets forbidden on an ungranted cluster with the same body as an unknown ID, and a namespace-only server grant cannot read `/cluster` data. +- [X] T038 [P] [US3] New tests `mcp-server/internal/panel/fanout_test.go`: two clusters merged and labelled, one unreachable reported not fatal, forbidden cluster indistinguishable from unknown. (done in mcp #5: mcp-server/internal/panel/fanout_test.go) +- [X] T039 [US3] New E2E `TestMultiCluster_MCPTokenRemoteGrant` in `test/e2e/multicluster_mcp_e2e_test.go` (bucket `multicluster`, register in `test/e2e/buckets.sh`): user with a remote grant for one namespace reads it with `?cluster=` through the token, gets forbidden on an ungranted cluster with the same body as an unknown ID, and a namespace-only server grant cannot read `/cluster` data. (done in #1045/#1046 line: test/e2e/multicluster_mcp_e2e_test.go:31 TestMultiCluster_MCPTokenRemoteGrant) --- @@ -114,19 +114,19 @@ **Independent Test**: quickstart.md §1 with the API Deployment scaled to 0. -- [ ] T040 [US4] New E2E subtest in a new function `TestOptionalComponents_MCPBreakGlassWithoutAPI` in `test/e2e/optional_components_scope_e2e_test.go`: scale `gameplane-api` to 0, open a break-glass session, `list_pods namespace=` succeeds, `kube-system` refused, scale back. -- [ ] T041 [P] [US4] Rewrite the `mcp-server (optional)` section of `docs/security.md` (line ~1126): two modes, per-user mode enforced by the API, break-glass gated by `kubectl exec` rights and limited to the release and game namespaces, no cluster-wide grant. -- [ ] T042 [P] [US4] Add an "MCP access" paragraph to `docs/multicluster-ui.md` "User access": MCP tokens follow the same per-cluster grants. +- [X] T040 [US4] New E2E subtest in a new function `TestOptionalComponents_MCPBreakGlassWithoutAPI` in `test/e2e/optional_components_scope_e2e_test.go`: scale `gameplane-api` to 0, open a break-glass session, `list_pods namespace=` succeeds, `kube-system` refused, scale back. (done as part of `TestOptionalComponents_MCPScope` in test/e2e/optional_components_scope_e2e_test.go (#1046) rather than a separate function: it scales the API to 0, checks release-namespace reads and kube-system refusal, and scales back) +- [X] T041 [P] [US4] Rewrite the `mcp-server (optional)` section of `docs/security.md` (line ~1126): two modes, per-user mode enforced by the API, break-glass gated by `kubectl exec` rights and limited to the release and game namespaces, no cluster-wide grant. (done in #1046: docs/security.md (mcp-server (optional) section, line 1136)) +- [X] T042 [P] [US4] Add an "MCP access" paragraph to `docs/multicluster-ui.md` "User access": MCP tokens follow the same per-cluster grants. (done in #1046: docs/multicluster-ui.md:94 (MCP access paragraph)) --- ## Phase 7: Polish and cross-cutting -- [ ] T043 Bump the `mcp-server` submodule pointer in PR C after the mcp PR merges (`submodule-bump` skill, argument `mcp-server`). -- [ ] T044 Changelog `changelog/unreleased/-mcp-namespace-scope.md` titled `Breaking: MCP server no longer has cluster-wide read access`, with the upgrade note (old ClusterRole removed; per-user mode via tokens). -- [ ] T045 [P] Update `docs/agent-architecture.md` task map with the new files (`auth/mcptokens.go`, `handlers/pods.go`, `handlers/mcp_tokens.go`, `routes/McpTokens.tsx`). -- [ ] T046 Run `/speckit-analyze` against spec, plan and this file; fix findings in the spec folder. -- [ ] T047 Walk quickstart.md on CI results (E2E buckets `api-rbac`, `multicluster`, `optional-components` green), then archive the spec folder with the `spec-archive` skill after the last PR merges. +- [X] T043 Bump the `mcp-server` submodule pointer in PR C after the mcp PR merges (`submodule-bump` skill, argument `mcp-server`). (done: root master pointer bumped to mcp-server 59524ce by 8236e830 (mcp #5)) +- [X] T044 Changelog `changelog/unreleased/-mcp-namespace-scope.md` titled `Breaking: MCP server no longer has cluster-wide read access`, with the upgrade note (old ClusterRole removed; per-user mode via tokens). (done in #1046: changelog/unreleased/1046-mcp-namespace-scope.md (Breaking: title)) +- [X] T045 [P] Update `docs/agent-architecture.md` task map with the new files (`auth/mcptokens.go`, `handlers/pods.go`, `handlers/mcp_tokens.go`, `routes/McpTokens.tsx`). (done: task-map row in docs/agent-architecture.md lists the API files plus `web/src/routes/McpTokens.tsx` and the Users.tsx MCP tokens dialog) +- [X] T046 Run `/speckit-analyze` against spec, plan and this file; fix findings in the spec folder. (done: read spec/plan/tasks/contracts against shipped code; fixed stale names in spec folder: spec.md:160 design.pen to design.fig; contracts/api-mcp-token-auth.md guard name to MCPTokenGuard, /modules/catalog exclusion noted, /admin/system-logs/{api|operator}; research.md R2 MCPTokenGuard. Open mismatches reported, not changed: envtest vs unit test naming (plan.md Testing, research R8), OPEN-DECISIONS A still says Pencil) +- [X] T047 Walk quickstart.md on CI results (E2E buckets `api-rbac`, `multicluster`, `optional-components` green), then archive the spec folder with the `spec-archive` skill after the last PR merges. (done: CI green on #1046 head d75b30fe (e2e optional-components, multicluster, api-rbac amd64+arm64 success) and #1067 head 9622afa5 (e2e api-rbac success); archive of specs/037-scope-mcp-server-permissions follows in this branch) --- From a88494bc926fff65c16c7dd9fb2dd0359c125c57 Mon Sep 17 00:00:00 2001 From: Claude Date: Mon, 23 Nov 2026 09:22:55 +0000 Subject: [PATCH 2/4] docs(specs): mark spec 037 shipped deviations done and fix stale wording Co-Authored-By: Claude Opus 5.5 Signed-off-by: Claude --- .../037-scope-mcp-server-permissions/OPEN-DECISIONS.md | 2 +- .../contracts/mcp-server-modes.md | 2 +- specs/037-scope-mcp-server-permissions/data-model.md | 2 +- specs/037-scope-mcp-server-permissions/plan.md | 4 ++-- specs/037-scope-mcp-server-permissions/quickstart.md | 2 +- specs/037-scope-mcp-server-permissions/research.md | 2 +- specs/037-scope-mcp-server-permissions/tasks.md | 10 +++++----- 7 files changed, 12 insertions(+), 12 deletions(-) diff --git a/specs/037-scope-mcp-server-permissions/OPEN-DECISIONS.md b/specs/037-scope-mcp-server-permissions/OPEN-DECISIONS.md index 32dfe9f38..c88d7209f 100644 --- a/specs/037-scope-mcp-server-permissions/OPEN-DECISIONS.md +++ b/specs/037-scope-mcp-server-permissions/OPEN-DECISIONS.md @@ -6,7 +6,7 @@ Only a decision valgul answers is written here as settled. OD-1 to OD-3 were ask Today a session has no Gameplane user: it reads with the pod's Kubernetes identity. -- A. Personal MCP token: the user creates a read-only, expiring, revocable token in the dashboard (their profile) and puts it in their MCP client config. The token never grants more than the user's current permissions. Needs a small dashboard screen (Pencil design first). (Recommended: works for local and SSO users alike, revocable per token, no browser needed in the MCP client.) +- A. Personal MCP token: the user creates a read-only, expiring, revocable token in the dashboard (their profile) and puts it in their MCP client config. The token never grants more than the user's current permissions. Needs a small dashboard screen (design.fig design first). (Recommended: works for local and SSO users alike, revocable per token, no browser needed in the MCP client.) - B. Sign in from the MCP client with the user's normal login (password or SSO in a browser window, like `kubectl` OIDC plugins). No new token screen, but each client must handle a browser login and SSO-only installs need a device-login flow. - C. Map the Kubernetes identity that opens `kubectl exec` to a Gameplane user. No Gameplane login at all, but only works for users who already have Kubernetes access, which most Gameplane users do not. diff --git a/specs/037-scope-mcp-server-permissions/contracts/mcp-server-modes.md b/specs/037-scope-mcp-server-permissions/contracts/mcp-server-modes.md index 0d3511fa6..2d3118a5a 100644 --- a/specs/037-scope-mcp-server-permissions/contracts/mcp-server-modes.md +++ b/specs/037-scope-mcp-server-permissions/contracts/mcp-server-modes.md @@ -21,7 +21,7 @@ | `get_pod_logs` | `/servers/{server}/logs/pod/tail` (new `server` argument required in this mode), or `/admin/system-logs/{component}` for API/operator pods | as today, within the allow-list | | `propose_fix` | reads through the same calls, so it never sees more than the user | as today | -- No `cluster` → per-user mode calls `/clusters`, runs the call on each, and returns `{cluster: [...]}` groups plus `unavailable: [clusterIDs]`. Break-glass ignores `cluster` other than the local one and says so. +- No `cluster` → per-user mode calls `/clusters`, runs the call on each, and merges the results with each item labelled by its cluster (`clusterAnnotation`); clusters that fail (other than 403/404) are reported in the merged list's resource version as `unavailable clusters: ` (`mcp-server/internal/panel/fanout.go`). Break-glass ignores `cluster` other than the local one and says so. - No `namespace` → per-user mode uses the namespaces the user may read on that cluster (from `/namespaces`); break-glass loops over its allow-list. - Refusals are returned as tool errors with the API's message (`not authenticated`, `permission denied`, `namespace not in scope`, `cluster not found or not permitted`). diff --git a/specs/037-scope-mcp-server-permissions/data-model.md b/specs/037-scope-mcp-server-permissions/data-model.md index 657e354ac..6cc29ed13 100644 --- a/specs/037-scope-mcp-server-permissions/data-model.md +++ b/specs/037-scope-mcp-server-permissions/data-model.md @@ -44,7 +44,7 @@ Portable SQL per `api/internal/db/migrations/README.md` (no dialect functions; t |---|---|---| | `GAMEPLANE_PANEL_URL` / `--panel-url` | env or flag | Per-user mode when set. HTTPS required except loopback. | | `GAMEPLANE_MCP_TOKEN` | env only | Required in per-user mode; `serve` refuses to start without it. | -| `--panel-ca` | flag | Optional PEM bundle for a private CA. | +| `GAMEPLANE_PANEL_CA` / `--panel-ca` | env or flag | Optional PEM bundle for a private CA. | | `GAMEPLANE_MCP_NAMESPACES` | env, rendered by the chart | Break-glass mode namespace allow-list (release namespace + managed game namespaces). Unset = unrestricted standalone kubeconfig run. | ## Chart RBAC objects (break-glass, replaces `-mcp-server-read` ClusterRole + binding) diff --git a/specs/037-scope-mcp-server-permissions/plan.md b/specs/037-scope-mcp-server-permissions/plan.md index ac810923a..8dc3b6594 100644 --- a/specs/037-scope-mcp-server-permissions/plan.md +++ b/specs/037-scope-mcp-server-permissions/plan.md @@ -18,7 +18,7 @@ The MCP server gets two modes. The normal **per-user mode** runs on the user's m **Storage**: SQLite / PostgreSQL through the API store; one new portable migration `common/023_mcp_tokens.sql` ([data-model.md](data-model.md)). -**Testing**: Go unit tests and API envtest (`api/internal/handlers/*_envtest_test.go`), mcp repo unit tests (`httptest` panel, fake clientset break-glass), web Vitest, chart `helm template` checks, E2E in `test/e2e/` buckets `api-rbac`, `multicluster`, `optional-components`. CI only (rule 8). +**Testing**: Go unit tests (API token routes and read routes in `api/internal/handlers/mcp_tokens_test.go` and `pods_test.go` with a fake clientset), mcp repo unit tests (`httptest` panel, fake clientset break-glass), web Vitest, chart `helm template` checks, E2E in `test/e2e/` buckets `api-rbac`, `multicluster`, `optional-components`. CI only (rule 8). **Target Platform**: Kubernetes (k3s to multi-node), standalone panel; MCP server per-user mode on Linux/macOS/Windows hosts via the published container image. @@ -98,7 +98,7 @@ GameplanePanel/Gameplane **Structure Decision**: work splits by repository and by reviewable unit, delivered as stacked PRs (one thread, valgul's multi-PR rule for specs): -1. **Gameplane PR A, API** (`feat/037-mcp-token-api`): migration, token auth + guard, token routes, read routes, RBAC rules, audit, envtests, E2E `api-rbac`, changelog. +1. **Gameplane PR A, API** (`feat/037-mcp-token-api`): migration, token auth + guard, token routes, read routes, RBAC rules, audit, unit tests, E2E `api-rbac`, changelog. 2. **Design** (`design/037-mcp-tokens`, merged into PR B): `design.fig` screens + export. 3. **Gameplane PR B, dashboard** (on A): MCP tokens page, admin dialog, i18n, Vitest. 4. **mcp PR** (`feat/per-user-mode` in GameplanePanel/mcp): Reader, panel client, break-glass allow-list, tools, docs, tests. diff --git a/specs/037-scope-mcp-server-permissions/quickstart.md b/specs/037-scope-mcp-server-permissions/quickstart.md index 70bf14927..324022670 100644 --- a/specs/037-scope-mcp-server-permissions/quickstart.md +++ b/specs/037-scope-mcp-server-permissions/quickstart.md @@ -30,7 +30,7 @@ Then in a break-glass session, `list_pods` with no namespace returns only those ## 3. Multicluster (Story 3) -Give `ops-a` a supplemental grant on the remote cluster for `gameplane-games`. `list_gameplane_resources kind=GameServer` with no cluster returns groups for both clusters; with `cluster=` it returns "cluster not found or not permitted". Stop the remote cluster's gateway: the call still answers, listing it under `unavailable`. +Give `ops-a` a supplemental grant on the remote cluster for `gameplane-games`. `list_gameplane_resources kind=GameServer` with no cluster returns groups for both clusters; with `cluster=` it returns "cluster not found or not permitted". Stop the remote cluster's gateway: the call still answers, reporting it as `unavailable clusters: ` in the result. ## 4. Docs diff --git a/specs/037-scope-mcp-server-permissions/research.md b/specs/037-scope-mcp-server-permissions/research.md index 8c2b7b3ac..b6bc4305f 100644 --- a/specs/037-scope-mcp-server-permissions/research.md +++ b/specs/037-scope-mcp-server-permissions/research.md @@ -63,4 +63,4 @@ Facts below were read from `master` at `73389d7a` (2026-11-22) and from the `mcp ### R8. Testing -- API: unit tests for token parse/lookup/guard; `handlers/*_envtest_test.go` for the new reads (namespace scoping, owner fallback, admin-only main namespace, remote cluster deny). MCP repo: `panel.Client` tests against `httptest`, tripwire for GET-only, namespace allow-list tests. E2E (constitution I): new tests in the `api-rbac` bucket (token user sees only its namespace; revoked token refused) and `multicluster` bucket (remote grant). Chart: `helm template` checks in the existing chart test job that no ClusterRole grants pods/events/logs. +- API: unit tests for token parse/lookup/guard; `handlers/mcp_tokens_test.go` and `handlers/pods_test.go` (fake clientset) for the token routes and new reads (namespace scoping, owner fallback, admin-only main namespace, remote cluster deny). MCP repo: `panel.Client` tests against `httptest`, tripwire for GET-only, namespace allow-list tests. E2E (constitution I): new tests in the `api-rbac` bucket (token user sees only its namespace; revoked token refused) and `multicluster` bucket (remote grant). Chart: `helm template` checks in the existing chart test job that no ClusterRole grants pods/events/logs. diff --git a/specs/037-scope-mcp-server-permissions/tasks.md b/specs/037-scope-mcp-server-permissions/tasks.md index f4d8e0495..e7049041c 100644 --- a/specs/037-scope-mcp-server-permissions/tasks.md +++ b/specs/037-scope-mcp-server-permissions/tasks.md @@ -68,8 +68,8 @@ - [X] T017 [US2] Add RBAC rules in `api/internal/rbac/rbac.go`: self rules for `/users/me/mcp-tokens` (GET, POST, DELETE prefix) next to lines 192-197 with `perm: ""`; `pods` and `kube-events` segments → `servers:read` (namespaced); control-plane namespace on those two segments requires `*` on the local cluster. (done: api/internal/rbac/rbac.go:215-220 (MCP token self rules, pods and kube-events rules)) - [X] T018 [US2] Create `api/internal/handlers/pods.go` with `GET /pods`, `GET /pods/{name}`, `GET /kube-events`, `GET /servers/{name}/pods`, `GET /servers/{name}/logs/pod/tail` per contracts/api-reads.md (cluster via `resolveCluster`, namespace via `scope.Resolve` or the admin-only control-plane namespace, managedFields stripped, events newest 100 with `truncated`/`total`, log tail default 200 lines, max 5000, newest 256 KiB, `text/plain`). Mount in `api/cmd/main.go`. (done: api/internal/handlers/pods.go (MountPods, api/cmd/main.go:413)) - [X] T019 [P] [US2] New unit tests `api/internal/auth/mcptokens_test.go`: format, digest-only storage, each invalid state (expired, revoked, epoch bumped, user deleted), lifetime and name validation, 10-token limit, `last_used_at` throttle, guard allow and deny (POST, WebSocket, unlisted GET), and a test that every allow-list route is registered GET-only in the router. (done: api/internal/auth/mcptokens_test.go and mcptokens_review_test.go (route GET-only test at mcptokens_test.go:409)) -- [ ] T020 [P] [US2] New envtest `api/internal/handlers/mcp_tokens_envtest_test.go`: create/list/revoke as self, admin list/revoke needs `users:read`/`users:manage`, a token cannot call token routes, CSRF still required for cookie POST/DELETE, audit rows written. -- [ ] T021 [P] [US2] New envtest `api/internal/handlers/pods_envtest_test.go`: namespace-scoped `servers:read` user sees only that namespace; owner-only user reaches `/servers/{name}/pods` and log tail but not `/pods`; control-plane namespace denied for non-admin, allowed for `*`; unknown cluster → forbidden; log tail bounds; events truncation. +- [X] T020 [P] [US2] New envtest `api/internal/handlers/mcp_tokens_envtest_test.go`: create/list/revoke as self, admin list/revoke needs `users:read`/`users:manage`, a token cannot call token routes, CSRF still required for cookie POST/DELETE, audit rows written. (done as shipped, accepted by valgul 2026-11-23: unit tests in `api/internal/handlers/mcp_tokens_test.go` (#1045) instead of envtest) +- [X] T021 [P] [US2] New envtest `api/internal/handlers/pods_envtest_test.go`: namespace-scoped `servers:read` user sees only that namespace; owner-only user reaches `/servers/{name}/pods` and log tail but not `/pods`; control-plane namespace denied for non-admin, allowed for `*`; unknown cluster → forbidden; log tail bounds; events truncation. (done as shipped, accepted by valgul 2026-11-23: unit tests with a fake clientset in `api/internal/handlers/pods_test.go` (#1045) instead of envtest) - [X] T022 [US2] Add the client methods and types to `web/src/lib/api.ts` (`listMcpTokens`, `createMcpToken`, `revokeMcpToken`, `listUserMcpTokens`, `revokeUserMcpToken`). (done: web/src/lib/api.ts:503-530 (listMcpTokens, createMcpToken, revokeMcpToken, listUserMcpTokens, revokeUserMcpToken)) - [X] T023 [US2] New E2E `TestAPI_RBAC_MCPTokenReads` in `test/e2e/api_rbac_mcp_token_e2e_test.go` (bucket `api-rbac`, register in `test/e2e/buckets.sh`; uses 2 logins of the bucket budget): token user with `servers:read` in one namespace reads only that namespace through `/servers`, `/pods`, `/kube-events`; POST with the token → 403; role removal → next read 403; revoke → 401; password reset → 401. `t.Parallel()`, unique names. (done: test/e2e/api_rbac_mcp_token_e2e_test.go:21 TestAPI_RBAC_MCPTokenReads) - [X] T024 [US2] Changelog `changelog/unreleased/-mcp-tokens-api.md` (personal MCP tokens, new read routes). (done: changelog/unreleased/1045-mcp-tokens-api.md) @@ -102,7 +102,7 @@ **Independent Test**: quickstart.md §3. - [X] T036 [US3] In `mcp-server/internal/panel/client.go`: with no `cluster` argument, call `/clusters`, run the read on each listed cluster concurrently (bounded, 4 at a time, 10 s each), return results grouped by cluster plus `unavailable: [ids]`; with no `namespace`, use `/namespaces?cluster=` for that cluster. (done in mcp #5: mcp-server/internal/panel/fanout.go (fanOut, bounded semaphore)) -- [ ] T037 [US3] Shape grouped results in `mcp-server/tools.go` (`{clusters: {: …}, unavailable: […]}`), keeping single-cluster output unchanged when `cluster` is given. +- [X] T037 [US3] Shape grouped results in `mcp-server/tools.go` (`{clusters: {: …}, unavailable: […]}`), keeping single-cluster output unchanged when `cluster` is given. (done as shipped, accepted by valgul 2026-11-23: mcp#5 merges per-cluster results with a cluster label on each item and reports failed clusters as `unavailable clusters: ` (`mcp-server/internal/panel/fanout.go`), not a `{clusters, unavailable}` object) - [X] T038 [P] [US3] New tests `mcp-server/internal/panel/fanout_test.go`: two clusters merged and labelled, one unreachable reported not fatal, forbidden cluster indistinguishable from unknown. (done in mcp #5: mcp-server/internal/panel/fanout_test.go) - [X] T039 [US3] New E2E `TestMultiCluster_MCPTokenRemoteGrant` in `test/e2e/multicluster_mcp_e2e_test.go` (bucket `multicluster`, register in `test/e2e/buckets.sh`): user with a remote grant for one namespace reads it with `?cluster=` through the token, gets forbidden on an ungranted cluster with the same body as an unknown ID, and a namespace-only server grant cannot read `/cluster` data. (done in #1045/#1046 line: test/e2e/multicluster_mcp_e2e_test.go:31 TestMultiCluster_MCPTokenRemoteGrant) @@ -125,8 +125,8 @@ - [X] T043 Bump the `mcp-server` submodule pointer in PR C after the mcp PR merges (`submodule-bump` skill, argument `mcp-server`). (done: root master pointer bumped to mcp-server 59524ce by 8236e830 (mcp #5)) - [X] T044 Changelog `changelog/unreleased/-mcp-namespace-scope.md` titled `Breaking: MCP server no longer has cluster-wide read access`, with the upgrade note (old ClusterRole removed; per-user mode via tokens). (done in #1046: changelog/unreleased/1046-mcp-namespace-scope.md (Breaking: title)) - [X] T045 [P] Update `docs/agent-architecture.md` task map with the new files (`auth/mcptokens.go`, `handlers/pods.go`, `handlers/mcp_tokens.go`, `routes/McpTokens.tsx`). (done: task-map row in docs/agent-architecture.md lists the API files plus `web/src/routes/McpTokens.tsx` and the Users.tsx MCP tokens dialog) -- [X] T046 Run `/speckit-analyze` against spec, plan and this file; fix findings in the spec folder. (done: read spec/plan/tasks/contracts against shipped code; fixed stale names in spec folder: spec.md:160 design.pen to design.fig; contracts/api-mcp-token-auth.md guard name to MCPTokenGuard, /modules/catalog exclusion noted, /admin/system-logs/{api|operator}; research.md R2 MCPTokenGuard. Open mismatches reported, not changed: envtest vs unit test naming (plan.md Testing, research R8), OPEN-DECISIONS A still says Pencil) -- [X] T047 Walk quickstart.md on CI results (E2E buckets `api-rbac`, `multicluster`, `optional-components` green), then archive the spec folder with the `spec-archive` skill after the last PR merges. (done: CI green on #1046 head d75b30fe (e2e optional-components, multicluster, api-rbac amd64+arm64 success) and #1067 head 9622afa5 (e2e api-rbac success); archive of specs/037-scope-mcp-server-permissions follows in this branch) +- [X] T046 Run `/speckit-analyze` against spec, plan and this file; fix findings in the spec folder. (done: read spec/plan/tasks/contracts against shipped code; fixed stale names in spec folder: spec.md:160 design.pen to design.fig; contracts/api-mcp-token-auth.md guard name to MCPTokenGuard, /modules/catalog exclusion noted, /admin/system-logs/{api|operator}; research.md R2 MCPTokenGuard. later fixed after valgul accepted the shipped tests 2026-11-23: plan.md Testing and PR A line, research R8, OPEN-DECISIONS A, data-model GAMEPLANE_PANEL_CA, contracts/mcp-server-modes.md and quickstart.md unavailable-cluster wording) +- [X] T047 Walk quickstart.md on CI results (E2E buckets `api-rbac`, `multicluster`, `optional-components` green), then archive the spec folder with the `spec-archive` skill after the last PR merges. (done: CI green on #1046 head d75b30fe (e2e optional-components, multicluster, api-rbac amd64+arm64 success) and #1067 head 9622afa5 (e2e api-rbac success); archived to specs/done_037-scope-mcp-server-permissions in the same PR) --- From a825a2d9ad481adf61ba897fca92925d96735640 Mon Sep 17 00:00:00 2001 From: Claude Date: Mon, 23 Nov 2026 09:23:29 +0000 Subject: [PATCH 3/4] chore(specs): archive 037 to done_037 Co-Authored-By: Claude Opus 5.5 Signed-off-by: Claude --- .../OPEN-DECISIONS.md | 0 .../T002-test-signoff.md | 0 .../checklists/requirements.md | 0 .../contracts/api-mcp-token-auth.md | 0 .../contracts/api-reads.md | 0 .../contracts/mcp-server-modes.md | 0 .../contracts/ui-mcp-tokens.md | 0 .../data-model.md | 0 .../plan.md | 4 ++-- .../quickstart.md | 0 .../research.md | 0 .../spec.md | 0 .../tasks.md | 4 ++-- 13 files changed, 4 insertions(+), 4 deletions(-) rename specs/{037-scope-mcp-server-permissions => done_037-scope-mcp-server-permissions}/OPEN-DECISIONS.md (100%) rename specs/{037-scope-mcp-server-permissions => done_037-scope-mcp-server-permissions}/T002-test-signoff.md (100%) rename specs/{037-scope-mcp-server-permissions => done_037-scope-mcp-server-permissions}/checklists/requirements.md (100%) rename specs/{037-scope-mcp-server-permissions => done_037-scope-mcp-server-permissions}/contracts/api-mcp-token-auth.md (100%) rename specs/{037-scope-mcp-server-permissions => done_037-scope-mcp-server-permissions}/contracts/api-reads.md (100%) rename specs/{037-scope-mcp-server-permissions => done_037-scope-mcp-server-permissions}/contracts/mcp-server-modes.md (100%) rename specs/{037-scope-mcp-server-permissions => done_037-scope-mcp-server-permissions}/contracts/ui-mcp-tokens.md (100%) rename specs/{037-scope-mcp-server-permissions => done_037-scope-mcp-server-permissions}/data-model.md (100%) rename specs/{037-scope-mcp-server-permissions => done_037-scope-mcp-server-permissions}/plan.md (98%) rename specs/{037-scope-mcp-server-permissions => done_037-scope-mcp-server-permissions}/quickstart.md (100%) rename specs/{037-scope-mcp-server-permissions => done_037-scope-mcp-server-permissions}/research.md (100%) rename specs/{037-scope-mcp-server-permissions => done_037-scope-mcp-server-permissions}/spec.md (100%) rename specs/{037-scope-mcp-server-permissions => done_037-scope-mcp-server-permissions}/tasks.md (99%) diff --git a/specs/037-scope-mcp-server-permissions/OPEN-DECISIONS.md b/specs/done_037-scope-mcp-server-permissions/OPEN-DECISIONS.md similarity index 100% rename from specs/037-scope-mcp-server-permissions/OPEN-DECISIONS.md rename to specs/done_037-scope-mcp-server-permissions/OPEN-DECISIONS.md diff --git a/specs/037-scope-mcp-server-permissions/T002-test-signoff.md b/specs/done_037-scope-mcp-server-permissions/T002-test-signoff.md similarity index 100% rename from specs/037-scope-mcp-server-permissions/T002-test-signoff.md rename to specs/done_037-scope-mcp-server-permissions/T002-test-signoff.md diff --git a/specs/037-scope-mcp-server-permissions/checklists/requirements.md b/specs/done_037-scope-mcp-server-permissions/checklists/requirements.md similarity index 100% rename from specs/037-scope-mcp-server-permissions/checklists/requirements.md rename to specs/done_037-scope-mcp-server-permissions/checklists/requirements.md diff --git a/specs/037-scope-mcp-server-permissions/contracts/api-mcp-token-auth.md b/specs/done_037-scope-mcp-server-permissions/contracts/api-mcp-token-auth.md similarity index 100% rename from specs/037-scope-mcp-server-permissions/contracts/api-mcp-token-auth.md rename to specs/done_037-scope-mcp-server-permissions/contracts/api-mcp-token-auth.md diff --git a/specs/037-scope-mcp-server-permissions/contracts/api-reads.md b/specs/done_037-scope-mcp-server-permissions/contracts/api-reads.md similarity index 100% rename from specs/037-scope-mcp-server-permissions/contracts/api-reads.md rename to specs/done_037-scope-mcp-server-permissions/contracts/api-reads.md diff --git a/specs/037-scope-mcp-server-permissions/contracts/mcp-server-modes.md b/specs/done_037-scope-mcp-server-permissions/contracts/mcp-server-modes.md similarity index 100% rename from specs/037-scope-mcp-server-permissions/contracts/mcp-server-modes.md rename to specs/done_037-scope-mcp-server-permissions/contracts/mcp-server-modes.md diff --git a/specs/037-scope-mcp-server-permissions/contracts/ui-mcp-tokens.md b/specs/done_037-scope-mcp-server-permissions/contracts/ui-mcp-tokens.md similarity index 100% rename from specs/037-scope-mcp-server-permissions/contracts/ui-mcp-tokens.md rename to specs/done_037-scope-mcp-server-permissions/contracts/ui-mcp-tokens.md diff --git a/specs/037-scope-mcp-server-permissions/data-model.md b/specs/done_037-scope-mcp-server-permissions/data-model.md similarity index 100% rename from specs/037-scope-mcp-server-permissions/data-model.md rename to specs/done_037-scope-mcp-server-permissions/data-model.md diff --git a/specs/037-scope-mcp-server-permissions/plan.md b/specs/done_037-scope-mcp-server-permissions/plan.md similarity index 98% rename from specs/037-scope-mcp-server-permissions/plan.md rename to specs/done_037-scope-mcp-server-permissions/plan.md index 8dc3b6594..a1235b425 100644 --- a/specs/037-scope-mcp-server-permissions/plan.md +++ b/specs/done_037-scope-mcp-server-permissions/plan.md @@ -2,7 +2,7 @@ **Branch**: `spec-037/scope-mcp-server-permissions` | **Date**: 2026-11-22 | **Spec**: [spec.md](spec.md) -**Input**: Feature specification from `specs/037-scope-mcp-server-permissions/spec.md` +**Input**: Feature specification from `specs/done_037-scope-mcp-server-permissions/spec.md` **Open decisions**: planning raised OD-4 (token lifetimes, settled: 7, 30, 90 or 365 days) and OD-5 (who may create tokens, settled: every signed-in user) in [OPEN-DECISIONS.md](OPEN-DECISIONS.md). Everything else in this plan follows the settled OD-1 to OD-3. @@ -50,7 +50,7 @@ Re-checked after Phase 1 design: no new violations. ### Documentation (this feature) ```text -specs/037-scope-mcp-server-permissions/ +specs/done_037-scope-mcp-server-permissions/ ├── spec.md ├── OPEN-DECISIONS.md ├── plan.md # this file diff --git a/specs/037-scope-mcp-server-permissions/quickstart.md b/specs/done_037-scope-mcp-server-permissions/quickstart.md similarity index 100% rename from specs/037-scope-mcp-server-permissions/quickstart.md rename to specs/done_037-scope-mcp-server-permissions/quickstart.md diff --git a/specs/037-scope-mcp-server-permissions/research.md b/specs/done_037-scope-mcp-server-permissions/research.md similarity index 100% rename from specs/037-scope-mcp-server-permissions/research.md rename to specs/done_037-scope-mcp-server-permissions/research.md diff --git a/specs/037-scope-mcp-server-permissions/spec.md b/specs/done_037-scope-mcp-server-permissions/spec.md similarity index 100% rename from specs/037-scope-mcp-server-permissions/spec.md rename to specs/done_037-scope-mcp-server-permissions/spec.md diff --git a/specs/037-scope-mcp-server-permissions/tasks.md b/specs/done_037-scope-mcp-server-permissions/tasks.md similarity index 99% rename from specs/037-scope-mcp-server-permissions/tasks.md rename to specs/done_037-scope-mcp-server-permissions/tasks.md index e7049041c..b214b708d 100644 --- a/specs/037-scope-mcp-server-permissions/tasks.md +++ b/specs/done_037-scope-mcp-server-permissions/tasks.md @@ -1,6 +1,6 @@ # Tasks: Scope MCP server permissions -**Input**: Design documents from `/specs/037-scope-mcp-server-permissions/` +**Input**: Design documents from `/specs/done_037-scope-mcp-server-permissions/` **Prerequisites**: plan.md, spec.md, research.md, data-model.md, contracts/, quickstart.md. All open decisions (OD-1 to OD-5) settled by valgul on 2026-11-17 and 2026-11-22. @@ -21,7 +21,7 @@ ## Phase 1: Setup - [X] T001 Confirm the docs PR for this spec folder is merged to `master`, then create the four branches from fresh `master` (Gameplane) and `main` (mcp) named in **Delivery** above; record the base SHAs in the PR A description. (done: branches created from master after #1044 merged (0aecce96)) -- [X] T002 List every existing test that encodes behaviour this spec changes, with file, test name, assertion and the needed change, and get valgul's written sign-off on each before editing any of them. Candidates found by grep on master `73389d7a`: `mcp-server/main_test.go` (`TestRegisteredToolsAreReadOnly`, `TestToolsListAndGetHappyPath`, `TestListEventsHandler_StripsAndBounds`; expected to stay unchanged because `*kube.Client` keeps satisfying the new `Reader` interface and break-glass with no allow-list behaves as today), `mcp-server/internal/kube/client_test.go`, `test/e2e/optional_components_e2e_test.go` (subtest `mcp`, lines 342-400; comment mentions the ClusterRole), `api/internal/auth/sessions_*_test.go` (cookie-only `Authenticate`), `api/internal/rbac/rbac_test.go` and `catalog_test.go` (rule table cross-checks). If none needs a change, write "none needed" with the reason per file in `specs/037-scope-mcp-server-permissions/T002-test-signoff.md`. +- [X] T002 List every existing test that encodes behaviour this spec changes, with file, test name, assertion and the needed change, and get valgul's written sign-off on each before editing any of them. Candidates found by grep on master `73389d7a`: `mcp-server/main_test.go` (`TestRegisteredToolsAreReadOnly`, `TestToolsListAndGetHappyPath`, `TestListEventsHandler_StripsAndBounds`; expected to stay unchanged because `*kube.Client` keeps satisfying the new `Reader` interface and break-glass with no allow-list behaves as today), `mcp-server/internal/kube/client_test.go`, `test/e2e/optional_components_e2e_test.go` (subtest `mcp`, lines 342-400; comment mentions the ClusterRole), `api/internal/auth/sessions_*_test.go` (cookie-only `Authenticate`), `api/internal/rbac/rbac_test.go` and `catalog_test.go` (rule table cross-checks). If none needs a change, write "none needed" with the reason per file in `specs/done_037-scope-mcp-server-permissions/T002-test-signoff.md`. --- From ca525d0d07c62bd4da623d00298c8d7fb3b09c39 Mon Sep 17 00:00:00 2001 From: Claude Date: Mon, 23 Nov 2026 09:48:57 +0000 Subject: [PATCH 4/4] chore: bump mcp-server to keep unavailable-clusters notice on truncation Picks up GameplanePanel/mcp#7. Co-Authored-By: Claude Opus 5.5 Signed-off-by: Claude --- changelog/unreleased/1081-mcp-events-unavailable-notice.md | 3 +++ mcp-server | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) create mode 100644 changelog/unreleased/1081-mcp-events-unavailable-notice.md diff --git a/changelog/unreleased/1081-mcp-events-unavailable-notice.md b/changelog/unreleased/1081-mcp-events-unavailable-notice.md new file mode 100644 index 000000000..c281f761e --- /dev/null +++ b/changelog/unreleased/1081-mcp-events-unavailable-notice.md @@ -0,0 +1,3 @@ +# MCP server keeps the unavailable-cluster warning on long event lists + +When `list_events` runs across clusters with a personal MCP token and returns more than 100 events, the result now still says which clusters could not be read, after the truncation notice. Before, the truncation notice replaced that warning. [PR #1081](https://github.com/GameplanePanel/Gameplane/pull/1081) diff --git a/mcp-server b/mcp-server index 59524cef4..454c33d66 160000 --- a/mcp-server +++ b/mcp-server @@ -1 +1 @@ -Subproject commit 59524cef456ecbb2d212cbf79fd8473f8fc2c196 +Subproject commit 454c33d66a7214a0a85e3e37e0fa3a807dd3c6ad