Interface McpRevision

All Known Implementing Classes:
McpRevision, McpRevision

public interface McpRevision
Service-provider interface implemented once per MCP protocol revision.

A consumer binds exactly one revision at compile time, by extending that revision's abstract servlet or composing its endpoint mixin. There is deliberately no ServiceLoader wiring and no priority()/isAvailable() pair: unlike the transport-provider precedent in juneau-rest-client-apache-httpclient-45, there is never a set of runtime candidates to choose between.

This interface has exactly three methods and must stay that way. default methods here are reserved for genuinely additive future protocol growth — a hook a later revision needs that earlier revisions can no-op. They are not for utility plumbing: a revision-neutral helper belongs on whichever neutral type already owns the concept (an envelope bean, McpCursor, McpParamUtils), never here.

  • Method Details

    • protocolVersion

      The MCP protocol revision string this implementation speaks.
      Returns:
      The revision token (e.g. "2025-06-18"). Never null.
    • dispatch

      Dispatches one JSON-RPC request.
      Parameters:
      exchange - The inbound envelope plus header access. Never null.
      config - The neutral handler registry and pagination strategy. Never null.
      ctx - The per-request bean store, passed through to handlers. Never null.
      Returns:
      A McpResponseResult for a normal request, a McpStreamResult (for example wrapping a Flow.Publisher produced by a v2-only method) for a request whose response is not a single JSON-RPC envelope, or null for a notification request (which the HTTP layer renders as an empty body).
    • errorCode

      Maps a neutral failure classification to this revision's JSON-RPC error code.
      Parameters:
      kind - The failure classification. Never null.
      Returns:
      The JSON-RPC error code this revision reports for that kind.