Package dev.tachyonmcp.core.protocol
Interface Protocol
- All Known Implementing Classes:
McpProtocol,McpProtocol
public interface Protocol
SPI for protocol versions, loadable via
ServiceLoader.
Each implementation represents one negotiated server version (e.g. MCP 2025-11-25, MCP 2026-07-28) and encapsulates the endpoint path, request matching predicate, response mapper, and per-channel context factory.
To register an implementation, add its fully-qualified class name to
META-INF/services/dev.tachyonmcp.core.protocol.Protocol.
-
Method Summary
Modifier and TypeMethodDescriptiondefault ChannelContextendpoint()HTTP endpoint path this protocol is served on, e.g.Protocol family name, e.g.booleanmatches(io.netty.handler.codec.http.HttpRequest request) Returnstruewhen this implementation can handle the given HTTP request.default intpriority()Request mapper for this protocol version.Response mapper for this protocol version.default booleanWhether this protocol version supports a server-side session established viainitialize.Server's negotiated version string, e.g.
-
Method Details
-
endpoint
String endpoint()HTTP endpoint path this protocol is served on, e.g."/mcp". -
familyName
String familyName()Protocol family name, e.g."mcp". -
versionString
String versionString()Server's negotiated version string, e.g."2025-11-25". Used for version comparison: ISO-date format ensures lexicographic order is chronological. -
priority
default int priority() -
supportsSessions
default boolean supportsSessions()Whether this protocol version supports a server-side session established viainitialize.truefor versions where sessions are part of the protocol (e.g. MCP 2025-11-25) — a deployment can still choose to run those statelessly viaServerBuildersession config, that's an orthogonal server choice, not a protocol trait.falsefor fully stateless, per-request protocol versions (e.g. MCP 2026-07-28), which removed sessions from the protocol entirely — every request self-describes via_meta, and noinitializehandshake exists. -
matches
boolean matches(io.netty.handler.codec.http.HttpRequest request) Returnstruewhen this implementation can handle the given HTTP request. POST requests are matched by endpoint ANDMCP-Protocol-Versionheader compatibility; other methods (GET for SSE, DELETE for session close, OPTIONS) are matched by endpoint only. -
responseMapper
ProtocolResponseMapper responseMapper()Response mapper for this protocol version. -
requestMapper
ProtocolRequestMapper requestMapper()Request mapper for this protocol version. -
createInteractionContext
-