ADR 0006: a read-only MCP server
Status
Accepted (2026-10-24).
Context
The AI ecosystem of the fleet (warehouse-ops-agent first) reaches a bounded
context through MCP, not through bespoke REST clients: every sibling context
that exposes an HTTP API also ships an MCP server over the same reads.
vendor-connectivity had none. The service already answers seven GETs through
its REST adapter (pollPurchaseOrders, getPurchaseOrder, listVendorNodes,
getNode, getScorecard, getTransaction, getVendor), so an MCP adapter
is another driving adapter over the same application queries, not new domain.
Decision
- A second driving adapter, a separate binary.
internal/adapters/inbound/mcpis built on the official MCP Go SDK (github.com/modelcontextprotocol/go-sdkv1.8.0) and served over Streamable HTTP only (no stdio, no SSE) bycmd/mcp, mounted at/mcpand/with an open/healthz. It is a second deployable besidecmd/api; the Helm chart gains anmcpDeployment, Service and (off-by-default) HTTPRoute. - Seven read tools, one per GET of the Vendor API, nothing else.
poll_purchase_orders(vendorId, nodeId?, createdAfter?, nextToken?, limit?),get_purchase_order(vendorId, poNumber),list_vendor_nodes(vendorId),get_vendor_node(vendorId, nodeId),get_node_scorecard(vendorId, nodeId),get_transaction(vendorId, transactionId)andget_vendor(vendorId). Arguments and results are lowerCamelCase like the REST contract; typed errors carry the REST problem slug (not-found,validation-failed,node-not-owned-by-vendor,upstream-unavailable,upstream-refused) as the prefix of the tool error, so a client sees one vocabulary over both surfaces.pollis a read here, exactly as the Vendor API's own operationId is. The submissions, the vendor lifecycle and the node registrations stay on REST. - Read-only is structural. Reads and writes share the application
Service, so the adapter holds aReadsinterface naming EXACTLY the seven read methods the REST adapter's GET routes call — through it no write use case can even be named.TestReadsSurfacePinsTheReadMethodspins the interface,TestNoWriteUseCaseIsNamedpins that no write use case appears in the adapter's sources,TestToolSurfacepins the exact tool set (budget 7), the read-only annotations and the absence of write verbs in tool names, andTestToolRegistryGoldenpins the whole advertised registry byte for byte. The integration test proves the binary reads, on a real Postgres, what the write use cases persisted and adds no outbox row. - No Kafka, no loops.
cmd/mcpnever starts the outbox relay, the submission loop, the order-expiry sweep, the retention sweep or the local-copy consumers, and never dials Kafka (the chart renders noKAFKA_BROKERSor consumer group on the mcp pod). Those stay incmd/api. The one outbound call a read can make is the scorecard relay to node-performance, the same synchronous call the REST GET makes. - No auth. No keys, no bearer checks (the fleet-wide revert of
2026-09-11;
TestNoAuthMiddlewareReintroduced). Access control is the in-cluster ClusterIP boundary; Kong rewrites/api/mcp/vendor-connectivityto the SDK's canonical/mcp. - Boot.
DATABASE_URLis mandatory (no in-memory mode), plus the four neighbour URLs the shared Service reads; migrations and the first ping are wrapped in the boot retry, andMIGRATIONS_DATABASE_URLcarries the direct DSN for the advisory lock behind PgBouncer, exactly ascmd/apidoes.
Consequences
- Agents can answer "which orders are open for this vendor, what does node X's scorecard look like, did this acknowledgement's transaction succeed" without REST glue.
- Adding a tool is a reviewed act: the tool budget, the curated list and the golden file all change together (an amendment of this ADR).
- Acknowledging an order, feeding inventory and confirming shipments stay REST operations with idempotency keys; the MCP surface cannot write.