Skip to main content

MCP tools

cmd/mcp is a second, independent deployable that exposes the read side of the context to AI agents over the Model Context Protocol (ADR 0005). It serves Streamable HTTP only (no stdio, no SSE) and is unauthenticated: access control is the in-cluster ClusterIP boundary, like REST and A2A.

PropertyValueSource
Listen addressMCP_ADDR, default :8090cmd/mcp/main.go
EndpointPOST /mcp and POST / (both mounted)cmd/mcp/router.go
ProbeGET /healthz returns {"status":"ok"}cmd/mcp/router.go
Server name / versioncustomer-ordering-mcp / 1.0.0initialize answer below
Behind the gatewaythe optional mcp chart component; mcp.route.enabled exposes /api/mcp/customer-ordering, rewritten to /mcpcharts/customer-ordering/templates/mcp-route.yaml
DependenciesPostgres only: it starts no relay or consumer, never dials Kafka or delivery-promise and wires no write use case, so it can never insert into the outboxcmd/mcp/main.go, internal/architecture/mcp_readonly_fitness_test.go

The three tools call the same read use cases the REST adapter uses (GetOrder, GetOrderTracking, GetShipTo), so an answer is the REST body of the corresponding route. All three carry the annotations readOnlyHint: true, idempotentHint: true, openWorldHint: false and declare the agent authority level L1 (a pure read of this context's own state) in _meta under com.warehouse/authority — the fleet's Agentic Standard v2 (ADR 0011).

Tools​

The answers below were captured from a live tools/list against cmd/mcp built from this branch.

ToolInputAnnotationAuthorityReadsREST equivalent
get_orderorderId (string, required)read-only, idempotentL1status, shopper, destination postal prefix, placed time, the cart lines (lineNo, catalogItemId, quantity) and every shipment group with its promise (promiseId, tier, shipBy, deliverByEarliest, deliverByLatest), line numbers, status, revisionNo and cancellation facts. No address.GET /orders/{orderId}
get_order_trackingorderId (string, required)read-only, idempotentL1per group: promise window, status, lockedAt, shippedAt, at-risk and unsourceable reasons, promiseVerdict and lateByMinutes, lostAt/returnedAt and outcomePackage, and the packages (trackingNumber, carrier, state, last scan node and time, deliveredAt, exceptionReason, and etaStart/etaEnd, the day-of delivery window, only while the package is out for delivery).GET /orders/{orderId}/tracking
get_ship_toorderId (string, required)read-only, idempotentL1the synthetic ship-to address (name, line1, line2, city, region, postalCode, countryCode, phone). Restricted to label printing in REST; it never appears in an event.GET /orders/{orderId}/ship-to

Every input schema is {"type":"object","properties":{"orderId":{"type":"string","description":"the order id, e.g. ord-3f9c1a2b"}},"required":["orderId"],"additionalProperties":false}; every tool also declares an output schema with additionalProperties: false.

There are no write tools. Placing an order, cancelling one and registering a shopper are REST operations of cmd/api; the order lifecycle is driven by the events it consumes (Integration).

Resource​

One scoped read model, loadable without a tool call (resources/list, resources/read; L1 by nature, like every read here):

URI templateMIMEModel
warehouse://customer-ordering/orders/{orderId}/trackingapplication/jsonthe order-tracking read model of ONE order — the same GetOrderTracking use case as get_order_tracking and GET /orders/{orderId}/tracking: per group the promise window, status, verdicts, signals and packages. Never a dump of a table; the ship-to address is not a resource.

An unknown or malformed order id is an error, exactly like the tool.

Prompt​

One operator SOP (prompts/list, prompts/get):

PromptArgumentReturns
triage_order_statusorderId (string, required)the standard operating procedure for answering a customer's question about one order: read the order, read its tracking, interpret the promise verdicts and signals, know what to escalate (a LOST group, a big lateness, any change request). It names tools but never calls them, and it cannot write.

Try it​

The handler is stateless (ADR 0011): no Mcp-Session-Id is issued, and the server answers both the 2026-07-28 per-request handshake and legacy initialize clients. A 2026-07-28 client can call tools/list directly — no initialize, no session:

curl -s -X POST localhost:8090/mcp \
-H 'Content-Type: application/json' -H 'Accept: application/json, text/event-stream' \
-H 'MCP-Protocol-Version: 2026-07-28' -H 'Mcp-Method: tools/list' \
-d '{"jsonrpc":"2.0","id":1,"method":"tools/list","params":{"_meta":{"io.modelcontextprotocol/protocolVersion":"2026-07-28","io.modelcontextprotocol/clientCapabilities":{}}}}'

Every tool in the answer carries its authority level: "_meta":{"com.warehouse/authority":"L1"}. A legacy initialize (for example 2025-06-18) still answers 200 — and issues no session id:

curl -s -X POST localhost:8090/mcp \
-H 'Content-Type: application/json' -H 'Accept: application/json, text/event-stream' \
-d '{"jsonrpc":"2.0","id":1,"method":"initialize","params":{"protocolVersion":"2025-06-18","capabilities":{},"clientInfo":{"name":"docs","version":"0"}}}' -i

Real initialize result (abridged; note there is no Mcp-Session-Id header — a legacy client that does not need one for these reads sees no other change):

HTTP/1.1 200 OK
Content-Type: text/event-stream

event: message
data: {"jsonrpc":"2.0","id":1,"result":{"capabilities":{"logging":{},"prompts":{"listChanged":true},"resources":{"listChanged":true},"tools":{"listChanged":true}},"instructions":"Customer ordering of the retail network (read-only): read a placed order with get_order ... Nothing here changes data: placing an order, cancelling one and registering a shopper are REST operations of customer-ordering ...","protocolVersion":"2025-06-18","serverInfo":{"name":"customer-ordering-mcp","version":"1.0.0"}}}

Errors​

A domain failure is a tool result with isError: true, not a JSON-RPC error. Real answer for an unknown order:

{"jsonrpc":"2.0","id":3,"result":{"content":[{"type":"text","text":"not-found: order ord-ghost: not found"}],"isError":true}}

An unknown or malformed order id is always not-found.

Configuration and observability​

cmd/mcp reads MCP_ADDR, DATABASE_URL (required), MIGRATIONS_DATABASE_URL, LOG_LEVEL and the four OTEL_*/version variables: see Configuration. Its service.name defaults to customer-ordering-mcp. Source: cmd/mcp/main.go, internal/adapters/inbound/mcp/.