Interface Protocol

All Known Implementing Classes:
McpProtocol, McpProtocol

public interface Protocol
SPI for protocol versions, loadable via ServiceLoader.

Each implementation represents one negotiated server version (e.g. MCP 2025-11-25, MCP 2026-07-28) and encapsulates the endpoint path, request matching predicate, response mapper, and per-channel context factory.

To register an implementation, add its fully-qualified class name to META-INF/services/dev.tachyonmcp.core.protocol.Protocol.

  • Method Details

    • endpoint

      String endpoint()
      HTTP endpoint path this protocol is served on, e.g. "/mcp".
    • familyName

      String familyName()
      Protocol family name, e.g. "mcp".
    • versionString

      String versionString()
      Server's negotiated version string, e.g. "2025-11-25". Used for version comparison: ISO-date format ensures lexicographic order is chronological.
    • priority

      default int priority()
    • supportsSessions

      default boolean supportsSessions()
      Whether this protocol version supports a server-side session established via initialize. true for versions where sessions are part of the protocol (e.g. MCP 2025-11-25) — a deployment can still choose to run those statelessly via ServerBuilder session config, that's an orthogonal server choice, not a protocol trait. false for fully stateless, per-request protocol versions (e.g. MCP 2026-07-28), which removed sessions from the protocol entirely — every request self-describes via _meta, and no initialize handshake exists.
    • matches

      boolean matches(io.netty.handler.codec.http.HttpRequest request)
      Returns true when this implementation can handle the given HTTP request. POST requests are matched by endpoint AND MCP-Protocol-Version header compatibility; other methods (GET for SSE, DELETE for session close, OPTIONS) are matched by endpoint only.
    • responseMapper

      ProtocolResponseMapper responseMapper()
      Response mapper for this protocol version.
    • requestMapper

      ProtocolRequestMapper requestMapper()
      Request mapper for this protocol version.
    • createInteractionContext

      default ChannelContext createInteractionContext()