Class McpRestServlet

java.lang.Object
jakarta.servlet.GenericServlet
All Implemented Interfaces:
jakarta.servlet.Servlet, jakarta.servlet.ServletConfig, Serializable, BasicUniversalConfig, DefaultConfig, DefaultHtmlConfig, ReadinessStateAware

public abstract class McpRestServlet extends AbstractMcpRestServlet
Abstract MCP servlet bound to protocol revision 2025-06-18.

Subclass this (rather than McpRestServlet) to expose a 2025-06-18 endpoint; the revision binding is a compile-time choice made by which class you extend.

Example:
  • Constructor Details

  • Method Details

    • revision

      protected McpRevision revision()
      Description copied from class: AbstractMcpRestServlet
      The MCP protocol revision this servlet speaks.

      Supplied by the revision-specific subclass a consumer extends (for example org.apache.juneau.rest.server.mcp.v20250618.McpRestServlet); consumers do not normally implement this themselves.

      Specified by:
      revision in class AbstractMcpRestServlet
      Returns:
      The bound revision. Never null.
    • capabilities

      Optional explicit capabilities advertisement for initialize.

      Returning null (the default) leaves capabilities auto-derived from the registered tool / prompt / resource lists. Returning a non-null value bypasses auto-derivation entirely and advertises exactly what is returned — the way to advertise resources.subscribe, logging, listChanged, or experimental, none of which are derivable from a handler registry.

      This hook is typed against this revision's wire beans on purpose: capabilities diverge between MCP revisions, so a neutral carrier in the core would accept data that is nonsense for the bound revision and fail only at serialization time.

      Stays protected (Correction C8): revision() above is the only caller, and it lives in this same class, so there is never a need to reach this hook from outside this class's own hierarchy — in particular, McpRevision never calls back into it.

      Returns:
      The explicit capabilities, or null to auto-derive.