Package org.apache.juneau.rest.server.mcp
package org.apache.juneau.rest.server.mcp
Revision-neutral core for MCP endpoints built on
juneau-rest-server.
This package knows the shape of an MCP server — tools, prompts, resources, pagination, the
JSON-RPC dispatch contract, and the two HTTP entry points — without knowing any MCP protocol
revision. It has no compile dependency on any revision's wire beans, and that is enforced at
build time. A protocol revision is supplied by an implementation of
McpRevision living in its own module (for example
juneau-rest-server-mcp-v20250618), and a consumer binds one
at compile time by extending that revision's abstract servlet or composing its endpoint mixin.
See Also:
-
ClassDescriptionDrop-in
BasicRestServletsubclass that exposes a single MCP JSON-RPC endpoint atPOST /.DefaultMcpSubscriptionBroker: aConcurrentHashMap-backed registry doing filtered fan-out.A single revision-neutral change event published throughMcpSubscriptionsand fanned out by anMcpSubscriptionBrokerto every matchingMcpSubscription.The kind of change a neutral MCP subscription can be notified about.Application behavior invoked for acompletion/completerequest against a declared prompt argument (McpPromptArgument.getCompleter()) or resource-template variable (McpResourceTemplateHandler.completer(String)).Revision-neutral identification of the declaration acompletion/completerequest targets.The kind of declaration aMcpCompletionReftargets.Revision-neutral invocation of anMcpCompleter.Revision-neutral, as-returned-by-the-application result of anMcpCompleterinvocation.The normalized shape of a completion result, ready for wire mapping.Revision-neutral content block returned by tool calls and prompt messages.Which content variant is populated.Pagination strategy for MCPlistdispatchers (tools / prompts / resources / resource templates).The non-notification result of oneMcpRevision.dispatch(McpExchange, McpServerConfig, org.apache.juneau.commons.inject.BeanStore)call: either a complete JSON-RPC response envelope (McpResponseResult) or a held-open streaming publisher (McpStreamResult, for a revision-specific method whose successful result is not a single JSON-RPC envelope, e.g. the2026-07-28subscriptions/listenmethod).Mixin interface that exposes an MCP JSON-RPC endpoint atPOST /mcpon any Juneau REST resource.Revision-neutral classification of a dispatch failure.The inbound JSON-RPC envelope plus request-header access, with no servlet or HTTP types attached.McpPage<T>Slice of MCP descriptors returned byMcpCursor.page(List, String, org.apache.juneau.commons.inject.BeanStore).Shared internal plumbing for revisionMcpRevision.dispatch(org.apache.juneau.rest.server.mcp.McpExchange, org.apache.juneau.rest.server.mcp.McpServerConfig, org.apache.juneau.commons.inject.BeanStore)implementations.Revision-neutral declared argument of a prompt.Handler for a single MCP prompt.Revision-neutral single message within a prompt result.Revision-neutral result of aprompts/getinvocation.Revision-neutral prompt descriptor returned fromprompts/list.Revision-neutral resource payload, either inline text or a base64 blob.Which payload variant is populated.Handler for a single MCP resource.Revision-neutral result of aresources/readinvocation.Revision-neutral resource descriptor returned fromresources/list.Handler for a single MCP resource template.A three-argument function from (uri,variables,ctx) to aMcpResourceOutcome, matchingMcpResourceTemplateHandler.ReadFunction.read(String, Map, BeanStore)'s signature.Revision-neutral resource-template descriptor returned fromresources/templates/list.AMcpDispatchResultwrapping a complete JSON-RPC response envelope — the common (non-streaming)McpRevision.dispatch(org.apache.juneau.rest.server.mcp.McpExchange, org.apache.juneau.rest.server.mcp.McpServerConfig, org.apache.juneau.commons.inject.BeanStore)outcome.Service-provider interface implemented once per MCP protocol revision.Revision-neutral role forMcpPromptMessageentries.Revision-neutral carrier for a tool's input schema.Aggregate configuration consumed by the boundMcpRevision.The result ofMcpServerConfig.resolveResourceTemplate(String): the winning resource-template handler paired with the variables decoded from the concrete request URI.AMcpDispatchResultwrapping a held-open streaming publisher, for a revision-specific method whose successful result is not a single JSON-RPC envelope (for example the2026-07-28subscriptions/listenmethod).Per-subscription queue handle minted by anMcpSubscriptionBroker.Revision-neutral registry + filtered fan-out publisher for MCPsubscriptions/listen.A revision-neutral, immutable subscription filter: the set of change kinds and resource URIs oneMcpSubscriptionis interested in.App-facing, revision-neutral change-publish SPI for MCPsubscriptions/listen.Handler for a single MCP tool.Revision-neutral result of atools/callinvocation.Revision-neutral tool descriptor returned fromtools/list.Bridgestyped tool handlersinto rawMcpToolHandlers.McpTypedToolHandler<A,R> Strongly-typed tool handler whose argument and result Java types drive schema derivation and binding.Hand-rolled, dependency-free compiler and reverse matcher for the narrow, reliably-invertible subset of RFC 6570 URI templates used by MCP resource-template reads.