Interface McpEndpointMixin
- All Known Subinterfaces:
McpEndpoint,McpEndpoint
- All Known Implementing Classes:
SpringExampleMcpServer,SpringMcpRestServlet,SpringMcpRestServlet
POST /mcp on any Juneau REST resource.
Implementing classes supply their McpServerConfig via getMcpConfig() and their
protocol revision via revision(). In practice a consumer implements a revision-specific
sub-interface (for example org.apache.juneau.rest.server.mcp.v20250618.McpEndpoint), which supplies revision() for them.
Example:
-
Method Summary
Modifier and TypeMethodDescriptionReturns theMcpServerConfigbacking this endpoint.default ObjecthandleMcpRequest(JsonRpcRequest req, RestRequest restReq) Default MCP JSON-RPC endpoint handler.revision()The MCP protocol revision this endpoint speaks.default McpSubscriptionBrokerOptional subscription broker backing this endpoint'ssubscriptions/listensupport.
-
Method Details
-
getMcpConfig
Returns theMcpServerConfigbacking this endpoint.- Returns:
- The config. Never
null.
-
revision
The MCP protocol revision this endpoint speaks.- Returns:
- The bound revision. Never
null.
-
subscriptionBroker
Optional subscription broker backing this endpoint'ssubscriptions/listensupport.Returning
null (the default) means this endpoint does not support subscriptions: noMcpSubscriptionBrokerorMcpSubscriptionsbean is added to the request-scopedBeanStorethathandleMcpRequest(org.apache.juneau.bean.jsonrpc.JsonRpcRequest, org.apache.juneau.rest.server.RestRequest)builds.A revision binding that implements
subscriptions/listen(for exampleorg.apache.juneau.rest.server.mcp.v20260728.McpEndpoint) overrides this to return a binding-owned broker instance (its own per-binding vs. shared-instance semantics are that revision's own choice — see its Javadoc).- Returns:
- The subscription broker, or
null if this endpoint does not support subscriptions.
-
handleMcpRequest
Default MCP JSON-RPC endpoint handler.Implementations may override this method to customize routing (path / annotations) but must still dispatch through
revision().Applies the same serializer policy as
AbstractMcpRestServlet(addBeanTypesanduriResolution="NONE"), so the two neutral HTTP entrypoints stay at parity.- Parameters:
req- JSON-RPC request envelope.restReq- The current REST request.- Returns:
- The response, or
nullfor notifications.
-