Skip to main content

Module domain

Module domain 

Source
Expand description

Domain layer: value objects, aggregates and pure functions.

This layer has zero I/O dependencies. Time, randomness and session-id generation are injected from outside it rather than called globally, so every function here is deterministic and testable.

Populated by T04 (protocol version value objects), T05-T08 (feature profile, negotiation, canonical IR, per-revision codecs), T10 (the session aggregate: lifecycle, in-flight requests, cancellation, progress) and T11 (the registry’s pure half: primitives, visibility, snapshots).

Re-exports§

pub use bridge::Agreement;
pub use bridge::Leg;
pub use bridge::RefusedBy;
pub use bridge::Withheld;
pub use bridge::agree;
pub use feature::DegradePolicy;
pub use feature::FEATURES;
pub use feature::Feature;
pub use feature::FeatureProfile;
pub use feature::FeatureSpec;
pub use feature::Negotiation;
pub use feature::resolve;
pub use idempotency::Claim;
pub use idempotency::ClaimToken;
pub use idempotency::CompletedResults;
pub use idempotency::IdempotencyError;
pub use idempotency::IdempotencyKey;
pub use idempotency::StaleClaim;
pub use mcp::AuthorizationModel;
pub use mcp::BearerMethod;
pub use mcp::ClientRegistration;
pub use mcp::MCP_METHOD_HEADER;
pub use mcp::MCP_NAME_HEADER;
pub use mcp::McpSessionId;
pub use mcp::McpSessionIdError;
pub use mcp::ResourceMetadata;
pub use mcp::ResourceUri;
pub use mcp::ResourceUriError;
pub use mcp::RoutingHeaderError;
pub use mcp::RoutingHeaders;
pub use mcp::RoutingName;
pub use mcp::RoutingTarget;
pub use mcp::VISIBLE_ASCII_RANGE;
pub use mcp::WELL_KNOWN;
pub use mcp::authorization_model;
pub use mcp::client_method_defined_in;

Modules§

a2a
A2A domain — the version negotiation model, the per-revision A2aFeatureProfile, and the value objects that the wire codecs (T28) lower into.
acp
domain::acp — the protocol-neutral ACP value objects.
bridge
What a bridge can honestly promise.
feature
Feature — the protocol behaviours a session may or may not have, and resolve — the pure function that decides which of them it has.
idempotency
Running a peer-observable side effect at most once per key.
ir
The canonical, version-agnostic IR.
jsonrpc
The protocol-neutral JSON-RPC layer.
mcp
The parts of MCP that exist as wire headers rather than as IR.
names
The event name a legacy-transport frame carries, or the unnamed default.
oauth
OAuth machinery that is not MCP-specific.
registry
The registry’s pure half: what a primitive is, who may see it, and the immutable set a publish hands to readers.
session
The session aggregate: lifecycle, in-flight requests, cancellation, progress.
stateless_meta_keys
The capability names the stateless _meta is allowed to carry.

Structs§

CapabilitySet
A set of advertised capabilities.
EventId
A stream event’s position, as a client quotes it back.
EventName
A validated event: value.
EventRing
A bounded, replayable buffer of stream events.
FrameDecoder
Reassembles newline-delimited frames from arbitrarily chopped-up bytes.
MaxFrameSize
The largest frame a decoder will accept, in bytes, excluding the terminator.
MessageEndpoint
The endpoint event’s data, parsed once and used verbatim.
NegotiatedSession
A session that has agreed on a version and a feature profile.
PeerInfo
What a peer calls itself.
RateLimit
A request allowance: limit requests per window.
RecommendedCapacity
A capacity for a stream whose payload size the caller has not measured.
ReleaseDate
A spec revision’s release date.
StatelessRequest
What a stateless 2026-07-28 request said about itself.
StreamEvent
One event, with the id a client would quote to resume after it.
SupportedVersions
A non-empty, sorted, duplicate-free set of protocol versions.
TransportSpec
A transport named at an adapter boundary.

Enums§

Capability
A capability name as the specification spells it.
EventNameError
Why a string is not usable as an event: name.
FramingError
A frame that could not be framed.
MaxFrameSizeError
Why a MaxFrameSize could not be built.
MessageEndpointError
Why a string is not a usable message endpoint.
NegotiationError
Why negotiation could not produce a session.
ParseProtocolVersionError
Why a string is not a ProtocolVersion.
ParseReleaseDateError
Why a string is not a YYYY-MM-DD release date.
ProtocolVersion
A published MCP revision, or one published after this build was compiled.
Replay
What a client asking to resume actually gets.
RequestId
A JSON-RPC request id: a number or a string.
ServerDecision
What the server decided to speak.
Side
Which side of the connection a capability is declared on.
SpecError
Why a transport spec could not be read.
SupportedVersionsError
Why a set of supported versions was rejected.
TransportKind
A transport the specification defines.
UnknownVersionError
Why a date cannot become ProtocolVersion::Unknown.
Verdict
What check concluded.

Constants§

CAPABILITY_TABLE
A capability and the revisions whose schemas define it.
CLIENT_CAPABILITY_WIRE
How one client capability appears in a ClientCapabilities object.
RECOMMENDED_CAPACITY
Events to retain for a stream whose payload size is unmeasured.
SERVER_CAPABILITY_WIRE
How one server capability appears in a ServerCapabilities object.

Functions§

assumed_version
The version a request is assumed to be, given whatever signals it carries.
assumed_version_without_signal
The version a request is assumed to be when it carries no version signal at all.
check_protocol_header
Checks an MCP-Protocol-Version header against the negotiated version.
check_rate_limit
The outcome of one check.
defined_in
Whether version’s schema defines capability.
discover_defined_in
Whether server/discover exists in this revision.
encode_frame
Appends one frame — the document, then the terminator — to out.
handshake_defined_in
Whether version has an initialize handshake at all.
is_reserved_meta_key
Whether a _meta key is one the stateless lifecycle reserves.
negotiate_client
Client-side version negotiation.
negotiate_server
Server-side version negotiation.
negotiate_stateless
Stateless per-request negotiation, as 2026-07-28 defines it.
transport_allowed
Whether the specification defines transport for version.