Class McpRevision
- All Implemented Interfaces:
McpRevision
McpRevision implementation for MCP revision 2026-07-28.
Owns this revision's stateless JSON-RPC method table, per-request _meta negotiation,
SEP-2243 Mcp-Method/Mcp-Name header agreement checks, server/discover
dispatch, and error-code table. Every request is independently negotiated from its own
_meta; no handshake, session, or prior-request state exists.
Constructed per binding, not shared as a singleton. The bound servlet or mixin builds a
fresh instance on every revision() call, passing its McpOptions.getCapabilities()
result and its published McpCacheConfig into the constructor — see McpRestServlet
and McpEndpoint. A null capabilities override auto-derives server/discover
capabilities from the registered tool/prompt/resource/resource-template lists; a non-null
override is advertised as-is. The cache config is binding-owned: it is supplied once at
construction, is never null, and is treated as static and request-independent for the
lifetime of this instance — every page of a given list method resolves to identical cache values.
The instance retains no request-derived state.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intJSON-RPC error code: internal error.static final intJSON-RPC error code: invalid params.static final intJSON-RPC error code: invalid request.static final intMRTR error code: the echoedrequestState's embedded round counter is at or above the configured max-rounds cap.static final intJSON-RPC error code: method not found.static final intSEP-2322 error code: the client did not advertise a capability (elicitation) required to receive aninput_requiredresult.static final intJSON-RPC error code: parse error.static final intMRTR error code: the current request'sargumentsdo not hash to the same value as the arguments sealed at PAUSE time — the client has resumed with a different argument set than the one the paused operation originally authorized.static final intMRTR error code: the echoedrequestStatehas expired (past its sealedexpiresAtMs).static final intMRTR error code: an operator-configuredReplayCachereports that the echoedrequestStatehas already been consumed once before.static final intC8 error code: the server already hasmaxConcurrentSubscriptionslivesubscriptions/listenstreams.static final StringDefault server name reported byserver/discoverwhen the config supplies no server identity. -
Constructor Summary
ConstructorsConstructorDescriptionMcpRevision(ServerCapabilities capabilities) Constructor.McpRevision(ServerCapabilities capabilities, McpCacheConfig cacheConfig) Constructor.McpRevision(ServerCapabilities capabilities, McpCacheConfig cacheConfig, String instructions) Constructor.McpRevision(ServerCapabilities capabilities, McpCacheConfig cacheConfig, String instructions, McpMrtrConfig mrtrConfig) Constructor. -
Method Summary
Modifier and TypeMethodDescriptiondispatch(McpExchange exchange, McpServerConfig config, BeanStore ctx) Dispatches one JSON-RPC request.interrorCode(McpErrorKind kind) Maps a neutral failure classification to this revision's JSON-RPC error code.The MCP protocol revision string this implementation speaks.
-
Field Details
-
CODE_PARSE_ERROR
JSON-RPC error code: parse error. Never reported by this revision (seeMcpErrorKind.PARSE_ERROR).- See Also:
-
CODE_INVALID_REQUEST
JSON-RPC error code: invalid request.- See Also:
-
CODE_METHOD_NOT_FOUND
JSON-RPC error code: method not found.- See Also:
-
CODE_INVALID_PARAMS
JSON-RPC error code: invalid params.- See Also:
-
CODE_INTERNAL_ERROR
JSON-RPC error code: internal error.- See Also:
-
CODE_MISSING_REQUIRED_CLIENT_CAPABILITY
SEP-2322 error code: the client did not advertise a capability (elicitation) required to receive aninput_requiredresult. Pinned directly by the SEP-2322 schema (spec Open item #3).- See Also:
-
CODE_REQUEST_STATE_EXPIRED
MRTR error code: the echoedrequestStatehas expired (past its sealedexpiresAtMs). This plan's own pin, chosen from the JSON-RPC-reserved-32000..-32099server-error range adjacent to the schema-pinned-32021; not a SEP-2322-sourced value.- See Also:
-
CODE_MAX_ROUNDS_EXCEEDED
MRTR error code: the echoedrequestState's embedded round counter is at or above the configured max-rounds cap. This plan's own pin (same range/rationale asCODE_REQUEST_STATE_EXPIRED).- See Also:
-
CODE_TOO_MANY_SUBSCRIPTIONS
C8 error code: the server already hasmaxConcurrentSubscriptionslivesubscriptions/listenstreams. This plan's own pin (same-32000..-32099server-error range and rationale asCODE_REQUEST_STATE_EXPIRED/CODE_MAX_ROUNDS_EXCEEDED); not sourced from SEP-2575.- See Also:
-
CODE_REQUEST_STATE_REPLAYED
MRTR error code: an operator-configuredReplayCachereports that the echoedrequestStatehas already been consumed once before. Only ever thrown whenMcpMrtrConfig.getReplayCache()is non-null — replay rejection is opt-in (same range/rationale asCODE_REQUEST_STATE_EXPIRED).- See Also:
-
CODE_REQUEST_STATE_ARGUMENTS_MISMATCH
MRTR error code: the current request'sargumentsdo not hash to the same value as the arguments sealed at PAUSE time — the client has resumed with a different argument set than the one the paused operation originally authorized. Always checked, unlikeCODE_REQUEST_STATE_REPLAYED(same range/rationale asCODE_REQUEST_STATE_EXPIRED).- See Also:
-
DEFAULT_SERVER_NAME
Default server name reported byserver/discoverwhen the config supplies no server identity.- See Also:
-
-
Constructor Details
-
McpRevision
Constructor. Uses an emptyMcpCacheConfig(no cache hints emitted on any result) and no discovery instructions.- Parameters:
capabilities- Explicit capabilities to advertise onserver/discover, ornull to auto-derive from the registered tool/prompt/resource lists.
-
McpRevision
Constructor. Advertises no discovery instructions.- Parameters:
capabilities- Explicit capabilities to advertise onserver/discover, ornull to auto-derive from the registered tool/prompt/resource lists.cacheConfig- Binding-owned cache configuration. Must not benull .
-
McpRevision
public McpRevision(ServerCapabilities capabilities, McpCacheConfig cacheConfig, String instructions) Constructor. Uses a defaultMcpMrtrConfig(AES-GCM ephemeral codec, 5-minuterequestStateTTL, 10-round cap).- Parameters:
capabilities- Explicit capabilities to advertise onserver/discover, ornull to auto-derive from the registered tool/prompt/resource lists.cacheConfig- Binding-owned cache configuration. Must not benull .instructions- Optional free-formserver/discoverusage instructions, ornull to omit them.
-
McpRevision
public McpRevision(ServerCapabilities capabilities, McpCacheConfig cacheConfig, String instructions, McpMrtrConfig mrtrConfig) Constructor.- Parameters:
capabilities- Explicit capabilities to advertise onserver/discover, ornull to auto-derive from the registered tool/prompt/resource lists.cacheConfig- Binding-owned cache configuration. Must not benull .instructions- Optional free-formserver/discoverusage instructions, ornull to omit them.mrtrConfig- Binding-owned MRTR (Multi-Round-Trip Request) configuration. Must not benull .
-
-
Method Details
-
protocolVersion
Description copied from interface:McpRevisionThe MCP protocol revision string this implementation speaks.- Specified by:
protocolVersionin interfaceMcpRevision- Returns:
- The revision token (e.g.
"2025-06-18"). Nevernull .
-
errorCode
Description copied from interface:McpRevisionMaps a neutral failure classification to this revision's JSON-RPC error code.- Specified by:
errorCodein interfaceMcpRevision- Parameters:
kind- The failure classification. Nevernull .- Returns:
- The JSON-RPC error code this revision reports for that kind.
-
dispatch
Description copied from interface:McpRevisionDispatches one JSON-RPC request.- Specified by:
dispatchin interfaceMcpRevision- Parameters:
exchange- The inbound envelope plus header access. Nevernull .config- The neutral handler registry and pagination strategy. Nevernull .ctx- The per-request bean store, passed through to handlers. Nevernull .- Returns:
- A
McpResponseResultfor a normal request, aMcpStreamResult(for example wrapping aFlow.Publisherproduced by a v2-only method) for a request whose response is not a single JSON-RPC envelope, ornull for a notification request (which the HTTP layer renders as an empty body).
-