Class McpRestServlet
- All Implemented Interfaces:
jakarta.servlet.Servlet,jakarta.servlet.ServletConfig,Serializable,BasicUniversalConfig,DefaultConfig,DefaultHtmlConfig,ReadinessStateAware
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:
-
Nested Class Summary
Nested classes/interfaces inherited from class org.apache.juneau.rest.server.servlet.RestServlet
RestServlet.Builder<R extends RestServlet,SELF extends RestServlet.Builder<R, SELF>>, RestServlet.DefaultBuilder<R extends RestServlet> -
Field Summary
Fields inherited from class jakarta.servlet.http.HttpServlet
LEGACY_DO_HEAD -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected ServerCapabilitiesOptional explicit capabilities advertisement forinitialize.protected McpRevisionrevision()The MCP protocol revision this servlet speaks.Methods inherited from class org.apache.juneau.rest.server.mcp.AbstractMcpRestServlet
acceptReadinessState, createMcpConfig, getMcpConfig, getSubscriptionBroker, handleMcpMethods inherited from class org.apache.juneau.rest.server.servlet.RestServlet
builder, createAuthenticator, destroy, doLog, getContext, getPath, getPaths, getRequest, getResponse, getRestBuilder, init, log, log, service, setContextMethods inherited from class jakarta.servlet.http.HttpServlet
doDelete, doGet, doHead, doOptions, doPatch, doPost, doPut, doTrace, getLastModified, isSensitiveHeader, serviceMethods inherited from class jakarta.servlet.GenericServlet
getInitParameter, getInitParameterNames, getServletConfig, getServletContext, getServletInfo, getServletName, init, log, log
-
Constructor Details
-
McpRestServlet
public McpRestServlet()
-
-
Method Details
-
revision
Description copied from class:AbstractMcpRestServletThe 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:
revisionin classAbstractMcpRestServlet- Returns:
- The bound revision. Never
null.
-
capabilities
Optional explicit capabilities advertisement forinitialize.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 advertiseresources.subscribe,logging,listChanged, orexperimental, 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,McpRevisionnever calls back into it.- Returns:
- The explicit capabilities, or
null to auto-derive.
-