MCP tools
cmd/mcp serves a read-only Model Context Protocol server over Streamable HTTP
only (ADR 0006). It is unauthenticated like the rest of the fleet: the
in-cluster ClusterIP boundary is the access control.
| Listen address | MCP_ADDR, default :8090 |
| Endpoint | /mcp (also mounted at /) |
| Probe | GET /healthz returns 200 {"status":"ok"} |
| Needs | DATABASE_URL only; it dials no Kafka and registers no write seam |
| Gateway | /api/mcp/seller-inbound in warehouse-infra (helm-values/seller-inbound.yaml, mcp.route.path); the ops agent calls http://seller-inbound-mcp.warehouse-systems.svc.cluster.local:8090/mcp |
| Deployed by | the chart behind mcp.enabled (default off, on in warehouse-infra) |
Source: cmd/mcp/main.go, cmd/mcp/router.go, internal/adapters/inbound/mcp/{server,tools,errors}.go.
How this page was produced. The list below comes from the pinned tool registry
internal/adapters/inbound/mcp/testdata/tool_registry.golden.json, which TestToolRegistryGolden compares with the
server's tools/list on every test run; it was not captured from a running server. Run tools/list against a live
cmd/mcp to see the same six tools.
Annotations and authority
All six tools carry readOnlyHint: true, idempotentHint: true and openWorldHint: false. There is no write tool:
the governance tests in internal/adapters/inbound/mcp/governance_test.go (TestToolSurface with its write-verb and
write-seam sensors) fail on a write-named tool or a write seam, and TestMCPAdapterDependencyRule limits the adapter
to the application and domain layers. A tool call adds no outbox_events row.
Every tool also declares its agent authority level L1 (Agentic Standard v2,
ADR 0011): a pure read of this context's own state.
The declaration travels in tools/list as _meta under the key com.warehouse/authority; the same level is pinned
per tool in the golden registry and by the static sensor
internal/architecture/mcp_authority_fitness_test.go. Both A2A skills carry the equivalent tag authority:L1.
| Tool | Required input | Optional input | Annotation | Authority |
|---|---|---|---|---|
get_inbound_plan | planId | none | read-only | L1 |
get_inbound_shipment | shipmentId | none | read-only | L1 |
get_shipment_labels | shipmentId | none | read-only | L1 |
get_seller_scorecard | sellerId | window | read-only | L1 |
get_placement_plan | planId | none | read-only | L1 |
list_placement_plans | sellerId, catalogItemId | limit | read-only | L1 |
Every input schema is additionalProperties: false. The tools are bound to the same use cases as the REST GET
routes. A failure is an isError tool result whose text is <slug>: <detail> with the REST slug (not-found,
invalid-window, validation-failed); an untyped error is logged (mcp tool failed with an unexpected error) and
answered as internal-error: an unexpected internal error occurred.
get_inbound_plan
Reads one inbound plan.
- Input:
planId(string, required, for examplepln-0f3a91). - Output:
planId,sellerId,destinationNodeId,packingOption(INDIVIDUALorCASE_PACKED),state(DRAFT,CONFIRMED,CANCELLED),lines(eachcatalogItemId,gtin,qtyEaches),createdAt, andconfirmedAtandcancelledAt(string or null). - Errors: an unknown id is
not-found.
get_inbound_shipment
Reads one inbound shipment with its cartons.
- Input:
shipmentId(string, required, for exampleshp-0f3a91). - Output:
shipmentId,planId,sellerId,nodeId,state,createdAt,labelledAt,shippedAt,receivedAt(string or null) andcartons: each withsscc,parentSscc,kind,contents(catalogItemId,gtin,qtyEaches, optionallotandexpiry),grossWeightG,dimsMm(l,w,h),sealedandreceiptStatus. - Errors:
not-found.
get_shipment_labels
Reads the label data of a shipment, one entry per carton.
- Input:
shipmentId(required). - Output:
shipmentId,state,destinationNodeIdandlabels: each withlabelRef(LBL-<sscc>),sscc,gs1128(the element string(00)<sscc>),humanReadable,parentSscc,kind,contents,contentSummary,totalEachesanddestinationNodeId. - Errors:
not-found. The tool works in any shipment state, includingDRAFT.
get_seller_scorecard
Answers a seller's informational compliance scorecard (ADR 0005).
- Input:
sellerId(required, for exampleseller-77);window(optional,7dor30d, default30d). - Output:
sellerId,window,windowStart,windowEnd,shipmentsReceived,cartonsReported,cartonsReceived,receiptAccuracyRate(number or null: omitted when nothing was reported),discrepancyRatePerShipment(number or null: omitted when no shipment closed),discrepanciesByKind(kind to count),complianceViolationsandcomplianceTier(GOOD,WATCH,AT_RISK). - Errors: an unknown seller is
not-found; any other window isinvalid-window. A suspended seller has a scorecard.
get_placement_plan
Reads one placement plan (ADR 0012): the advisory that suggests, per vendor fulfilment node, how many units of one catalogue item a seller should send.
- Input:
planId(string, required, for examplepl-0f3a91). - Output:
planId,sellerId,catalogItemId,coverDays,windowDays(the observation window),basis(demand-heat-v1),state(SUGGESTED,ACCEPTED,SUPERSEDED),createdAt,acceptedAtandsupersededAt(string or null) andsuggestions: each withnodeId,regionId,suggestedUnitsand the evidenceregionDemandUnits,nodeAvailabilityUnitsandcoverDays. A plan with no demand has an emptysuggestionslist; that is a legal, recorded plan. - Errors: an unknown id is
not-found.
list_placement_plans
Lists the placement plans of one seller and catalogue item, newest first.
- Input:
sellerId(required, for exampleseller-77),catalogItemId(required, for exampleitem-1) andlimit(optional integer, 1 to 100; omitted means 50). - Output:
{items}, each item with the same shape asget_placement_plan.
Both placement tools read the same use cases as the REST GET /placement-plans/{planId} and
GET /placement-plans?sellerId=&catalogItemId=. They never compute or accept a plan: POST /placement-plans and
POST /placement-plans/{planId}/acceptances are REST-only. The tool source is
internal/adapters/inbound/mcp/tools_placement.go; both are pinned in
internal/adapters/inbound/mcp/testdata/tool_registry.golden.json.
Transport
The Streamable HTTP handler is stateless (ADR 0011):
no Mcp-Session-Id is issued, the server answers the 2026-07-28 revision's per-request handshake (server/discover,
no initialize needed) and a legacy initialize still answers 200. Nothing in the server relies on cross-call
session state; pinned by the raw-POST tests in internal/adapters/inbound/mcp/stateless_test.go.
Resource: seller compliance scorecard
warehouse://seller-inbound/scorecards/{sellerId} (application/json) is the one resource of this server: the
default-window (30d) compliance scorecard of ONE seller, built from the same GetSellerScorecard read use case as the
get_seller_scorecard tool and the REST GET /sellers/{sellerId}/scorecard. Bounded by construction: one seller,
the scorecard's fixed fields, JSON text — never a dump of a table. A malformed URI or an unknown seller is an error.
Prompt: assess_seller_compliance
The one prompt of this server is the operator SOP for this context: read the rolling-window scorecard, trace
discrepancies to their inbound plans and shipments, and escalate AT_RISK (or repeating violations) to the human
account manager. It takes one typed, required argument (sellerId); it names tools and never calls them, and nothing
it names can write (the write operations of this context are REST-only). prompts/get returns the SOP text with the
seller id interpolated; a missing argument degrades to a <sellerId> placeholder, never to a hidden call.
Known inconsistencies
- The descriptions of
get_inbound_shipment(and the A2Ainbound_statusskill, which reuses the wording) list the shipment statesPLANNED, PACKING, LABELLED, SHIPPED or RECEIVED. The aggregate's real states areDRAFT,LABELLED,SHIPPED,RECEIVING,CLOSEDandCLOSED_WITH_DISCREPANCY(internal/domain/inboundshipment/shipment.go), and those are what thestatefield returns. The descriptions are pinned by the golden file, so correcting them is a reviewed code change. cmd/mcplogsenvironmentasdevwhenENVIRONMENTis unset, while the telemetry resource sayslocal(Configuration).