Class McpChannelInitializer
java.lang.Object
io.netty.channel.ChannelHandlerAdapter
io.netty.channel.ChannelInboundHandlerAdapter
io.netty.channel.ChannelInitializer<io.netty.channel.socket.SocketChannel>
dev.tachyonmcp.core.transport.netty.McpChannelInitializer
- All Implemented Interfaces:
io.netty.channel.ChannelHandler,io.netty.channel.ChannelInboundHandler
@Sharable
public class McpChannelInitializer
extends io.netty.channel.ChannelInitializer<io.netty.channel.socket.SocketChannel>
Assembles the Netty pipeline for each new MCP channel: validation handlers
(endpoint, origin, protocol version, accept header, stateless guard),
InteractionHandler, HTTP aggregation, idle timeout, the
initialization-phase handler (McpInitializationHandler), and the
LifecyclePipelineCoordinator.
In stateless mode, StatelessValidatorHandler is added to reject
session-related headers and DELETE methods before they reach protocol handlers.
-
Nested Class Summary
Nested classes/interfaces inherited from interface io.netty.channel.ChannelHandler
io.netty.channel.ChannelHandler.Sharable -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intDefault max aggregated request body. 64 KB was too small for schemas + tool results. -
Constructor Summary
ConstructorsConstructorDescriptionMcpChannelInitializer(String endpointPath, boolean stateless, ServerEngine server, Duration readerIdleTimeout, Duration writerIdleTimeout, int maxContentLength, io.netty.channel.group.ChannelGroup childChannels, @Nullable io.netty.handler.codec.http.cors.CorsConfig corsConfig, @Nullable Consumer<io.netty.channel.ChannelPipeline> pipelineCustomizer) -
Method Summary
Modifier and TypeMethodDescriptionprotected voidinitChannel(io.netty.channel.socket.SocketChannel ch) Methods inherited from class io.netty.channel.ChannelInitializer
channelRegistered, exceptionCaught, handlerAdded, handlerRemovedMethods inherited from class io.netty.channel.ChannelInboundHandlerAdapter
channelActive, channelInactive, channelRead, channelReadComplete, channelUnregistered, channelWritabilityChanged, userEventTriggeredMethods inherited from class io.netty.channel.ChannelHandlerAdapter
ensureNotSharable, isSharable
-
Field Details
-
DEFAULT_MAX_CONTENT_LENGTH
public static final int DEFAULT_MAX_CONTENT_LENGTHDefault max aggregated request body. 64 KB was too small for schemas + tool results.- See Also:
-
-
Constructor Details
-
McpChannelInitializer
public McpChannelInitializer(String endpointPath, boolean stateless, ServerEngine server, Duration readerIdleTimeout, Duration writerIdleTimeout, int maxContentLength, io.netty.channel.group.ChannelGroup childChannels, @Nullable io.netty.handler.codec.http.cors.CorsConfig corsConfig, @Nullable Consumer<io.netty.channel.ChannelPipeline> pipelineCustomizer)
-
-
Method Details
-
initChannel
protected void initChannel(io.netty.channel.socket.SocketChannel ch) - Specified by:
initChannelin classio.netty.channel.ChannelInitializer<io.netty.channel.socket.SocketChannel>
-