Package dev.tachyonmcp.core.server
Class McpDispatcher
java.lang.Object
dev.tachyonmcp.core.server.McpDispatcher
Orchestrates the MCP server's per-request flow: parses JSON-RPC messages, establishes the session on
initialize, routes to registered handlers (including extension methods), tracks pending
requests, and encodes responses. Collaborator of DefaultTachyonServer — server holds state/registries,
this drives one request at a time.
MCP- and spec-version-specific: it special-cases initialize/task-status and binds the
v2025_11_25 models/codecs. The version-specific call-sites (marked below) move behind an
McpDialect when a second spec version is wired.
-
Nested Class Summary
Nested Classes -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final AttributeKey<io.netty.handler.codec.http.HttpRequest> Interaction-context attribute key under whichMcpInitializationHandlerstashes a detached copy of theinitializeHTTP request, so a customSessionIdGeneratorcan read its headers/URI.static final String -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptiondispatchNotification(String method, @Nullable Object params, @Nullable String sessionId) dispatchNotification(String method, @Nullable Object params, @Nullable String sessionId, @Nullable ChannelContext channelContext) dispatchRequestAsync(RequestId id, String method, Object params, @Nullable String sessionId) dispatchRequestAsync(RequestId id, String method, Object params, @Nullable String sessionId, @Nullable OutboundSseStream outboundSseStream, @Nullable ChannelContext channelContext) byte[]parseError(@Nullable ChannelContext channelContext) @Nullable JsonRpcMessageparseMessage(io.netty.buffer.ByteBuf body)
-
Field Details
-
ATTR_INIT_REQUEST
Interaction-context attribute key under whichMcpInitializationHandlerstashes a detached copy of theinitializeHTTP request, so a customSessionIdGeneratorcan read its headers/URI. -
NOTIFICATIONS_INITIALIZED
- See Also:
-
-
Constructor Details
-
McpDispatcher
-
-
Method Details
-
parseMessage
-
parseError
-
dispatchRequestAsync
public CompletableFuture<McpDispatcher.DispatchResult> dispatchRequestAsync(RequestId id, String method, Object params, @Nullable String sessionId) -
dispatchRequestAsync
public CompletableFuture<McpDispatcher.DispatchResult> dispatchRequestAsync(RequestId id, String method, Object params, @Nullable String sessionId, @Nullable OutboundSseStream outboundSseStream, @Nullable ChannelContext channelContext) -
dispatchNotification
public McpDispatcher.DispatchResult dispatchNotification(String method, @Nullable Object params, @Nullable String sessionId) -
dispatchNotification
public McpDispatcher.DispatchResult dispatchNotification(String method, @Nullable Object params, @Nullable String sessionId, @Nullable ChannelContext channelContext)
-