Module mcp
Expand description
Typed IR for a schema’s MCP operator surface (ADR 0002, cratestack#1033 phase 1, cratestack#1036).
Three declarations feed it: the top-level mcp { name = "..." expose = [tools, resources] } block (McpConfig, McpName), @mcp(tool[: "name"][, description: "..."]) on a procedure (ProcedureMcpExposure), and @@mcp(resource: "segment"[, max_page_size: N]) on a model (ModelMcpExposure).
These are typed rather than left as Attribute { raw } / a raw-text
ConfigBlock because MCP exposure decides what an agent can reach: a
declaration that parses and is then read by nothing is the failure mode
this IR exists to rule out (ADR 0002 Q4 — @no_idempotency sat inert for
two release cycles exactly that way). cratestack-parser extracts the
@mcp/@@mcp attributes out of the raw attribute lists when it builds
these, so there is one representation to read, never a raw copy that a
consumer could re-parse and disagree with.
Every field is Option with #[serde(default, skip_serializing_if)] on
its owner, so an IR snapshot written before MCP existed (committed
migrations/*/schema.snapshot.json) deserializes unchanged and a schema
that declares no MCP serializes byte-identically to before.
Structs§
- McpConfig
- The top-level
mcp { }block. - McpName
- The
name = "..."entry of themcp { }block. - Model
McpExposure @@mcp(resource: "...")on a model: expose it as a read-only MCP resource.- Procedure
McpExposure @mcp(tool ...)on a procedure: expose it as an MCP tool.
Constants§
- MCP_
MAX_ PAGE_ SIZE - Hard ceiling on a collection resource’s page size (ADR 0002 Q3). A model
may lower its own maximum with
max_page_size:, never raise it past this; a larger value is a validation error, not a clamp.