ADR 0008: MCP server adoption (unauthenticated, additive)
Status
Amended by ADR 0016:
cmd/mcprequiresDATABASE_URL; the in-memory fallback below no longer exists.
Accepted (2026-10-05). Records a decision already in effect: cmd/mcp has
shipped since Phase 2/3 with no ADR, found by the 2026-10-04
ADR-conformance audit.
Context
The fleet exposes every bounded context to warehouse-ops-agent (and any
other MCP client) through a second, independent deployable binary over
Streamable HTTP, alongside the REST API, never bundled into the same
process. warehouse-planning already does this (cmd/mcp) but had never
written down why.
Decision
cmd/mcpis a second composition root, independent ofcmd/api: it wires the SAME use cases (usecases.CreateCapacityPlan,RegisterProcessCapacityConstraint, ...) to the SAME adapters (in-memory whenDATABASE_URLis unset, Postgres otherwise), through a dedicated inbound adapter (internal/adapters/inbound/mcp) instead of the REST router.- It serves 11 tools today (
internal/adapters/inbound/mcp/tools.go,registerTools/registerReadModelTools/registerDemandTools): reads (get_effective_process_capacity,get_process_path_capacity,get_capacity_plan,list_station_standards,get_storage_capacity,get_expected_demand) and writes (register_process_capacity_constraint,register_process_path,create_capacity_plan,publish_capacity_plan,declare_station_standard). A write tool goes through the exact same use case and transactional-outbox path (ADR 0007) as its REST equivalent -- there is no second, parallel write path. - No authentication of any kind -- no API key, no bearer token. This
matches the fleet-wide decision (reverted 2026-09-11 across every
context) that REST and MCP are both unauthenticated; access control is
the in-cluster
ClusterIPnetwork boundary, not an application-layer check.internal/architecture/fitness_test.go'sTestNoAuthMiddlewareReintroducedfails CI if auth middleware is ever added back to either router. cmd/mcpnever starts the outbox relay and never dials Kafka itself: a write tool's use case inserts its CloudEvents into the outbox inside itsUnitOfWork, and the relay that drainsoutbox_eventsonto Kafka runs only incmd/api. This keepscmd/mcpa thin, horizontally-scalable front door with no Kafka broker dependency of its own.cmd/mcpruns the idempotentgolang-migratestep on its own boot (same ascmd/api), so it can come up against a fresh database beforecmd/apihas; golang-migrate's advisory lock makes the two processes' concurrent migration attempts safe (seedocs/adr/0010-migrations-over-direct-connection.md).internal/architecture/fitness_test.go'sTestMCPAdapterDependencyRulekeeps this adapter additive: it may depend on the application/domain layers only (never on outbound adapters, never oncmd), and nothing else in this codebase may import it -- a sibling package importinginternal/adapters/inbound/mcpwould silently make the MCP surface load-bearing for something other thancmd/mcpitself.
Consequences
- Two binaries now read this ADR instead of only
cmd/api's composition root comments. - A future auth requirement (should one ever arrive) needs a NEW ADR explicitly superseding point 3 here, not a silent code change.
Alternatives considered and rejected
- Bundle MCP into
cmd/api's HTTP server (one process, two route trees): couples the two surfaces' scaling and failure domains; the fleet convention (every sibling context) is two independent deployables. - Bearer-token auth on MCP only: rejected fleet-wide in the 2026-09-11 revert; MCP and REST get the same (lack of) auth so operators reason about one boundary, not two.