15. Remove the static-bearer REST/MCP auth layer
Status
Accepted. 2026-09-09. Undoes the fleet auth rollout recorded in ADR-0014 (REST) and the auth portion of ADR-0007 (MCP).
Decision
internal/adapters/inbound/auth/ — the shared Scope / Authenticator /
StaticKeyAuth / chi Middleware implementation — is deleted outright, not
deprecated. Both driving adapters that used it are simplified to have no
authentication concept at all:
- REST (
internal/adapters/inbound/http):NewRouterno longer accepts aWithAuthoption (removed) and no longer wraps any route group in an auth middleware; every route —/sites,/zones,/location-types,/placement-rules,/locations, and/healthz— is mounted directly, exactly as it would be withAUTH_MODE=off.NewReportsRouterfollows the same shape for the analytics reader. - MCP (
internal/adapters/inbound/mcp):internal/adapters/inbound/mcp/auth.gois deleted;Handler(server *mcp.Server)no longer takes anAuthenticatorand no longer checks a bearer credential before dispatching to the Streamable HTTP handler. Tool/resource registration no longer threads ascopeOffunction or gates on a requiredScope— every read tool, thelayout://facility/{siteCode}resource, and theexplore_layoutprompt are reachable unconditionally. - Composition roots (
cmd/facility,cmd/facility-reports,cmd/mcp): therestAuth(logger) auth.Middlewarehelper and allAUTH_MODE/API_READ_KEY/API_READWRITE_KEY/MCP_READ_KEY/MCP_READWRITE_KEYenvironment parsing are removed. These binaries no longer read or reference any credential material. - Helm chart (
charts/facility-layout/): theauth:values block, themcp.readKey/mcp.readWriteKey/mcp.existingSecretvalues,templates/mcp-secret.yaml, the authstringDataentries intemplates/secret.yaml, theAUTH_MODEConfigMap key, and thefacility-layout.authSecretName/facility-layout.authEnabled/facility-layout.authEnv/facility-layout.mcpSecretNamehelpers are all removed.helm lintand ahelm templaterender (main + MCP + analytics enabled) are clean with no bearer-key material anywhere in the rendered manifests. - Docs:
apis/openapi.yamldrops the top-levelsecurity:requirement, the per-operationsecurity: []override on/healthz(now redundant), andcomponents.securitySchemes.bearerAuth.README.mddrops the REST authentication section, theAUTH_MODE/API_READ_KEY/API_READWRITE_KEYenv-var rows, and the MCP bearer-key instructions, updating thecurl/helmexamples to the now-unauthenticated shape..spectral.yaml/CIapi-lintandhelm lintboth pass against the trimmed spec and chart.
This repository's own outbound adapters carry no peer-service API-key logic
(internal/adapters/outbound/ has no Authorization/Bearer/*_API_KEY
references before or after this change) — facility-layout only ever
authenticated inbound callers, so nothing on the outbound side needed
touching.
ADR-0014 and the auth-related passages of ADR-0007 are left in place as historical record of the decision this reverts; they are not rewritten.
Consequences
Easier
- One less package, one less composition-root concern, one less chart Secret/ConfigMap surface to keep in sync across nine repositories.
- Local development and every existing handler/tool test needs no key
scaffolding at all — the removed
auth_test.gorouter-table tests andscope_test.goMCP gating tests are simply gone rather than needing to be kept passing in a permanently-offmode.
Harder / accepted
- No credential enforcement remains on either surface. Anything able to reach the REST port or the MCP port in-cluster can read and mutate the warehouse map, and can call every MCP tool, with no application-layer gate. This depends entirely on network-level isolation (ClusterIP, Kubernetes NetworkPolicy if configured, no public ingress) to keep this service's blast radius contained. That boundary is not enforced by this repository.
- Callers that were sending
Authorization: Bearer ...headers (e.g. an MCP client configured with aMCP_READ_KEY, or a REST client configured withAPI_READ_KEY) are unaffected functionally — the header is now simply ignored — but any client-side code that treated a missing/invalid key as a hard requirement should be updated; there is no scope concept to configure anymore. - Re-introducing authentication later (a genuine need re-emerges, or the fleet decision is reversed again) means re-adding the middleware from scratch or restoring it from this ADR's parent commit — this change does not preserve an easy toggle.
Related
- ADR-0007 — MCP as an inbound adapter (introduced the static-bearer-key seam this ADR removes the auth portion of; the adapter shape itself is unchanged).
- ADR-0014 — REST identity adoption (the decision this ADR reverts).
- warehouse-ops-agent ADR 0005 — the fleet-wide decision ADR-0014 adopted; this repository no longer participates in it.