Interface ServerEngine

All Superinterfaces:
AutoCloseable, TachyonServer

@InternalApi public interface ServerEngine extends TachyonServer
Engine SPI for MCP server internals. Extends the user-facing TachyonServer with the full set of methods needed by transport, dispatch, registries, and session management.

Not a stability contract. This interface lives in an internal package for a reason: it may change without notice across minor versions. Only code that ships inside the tachyon-core jar — transport handlers, dispatch plumbing, registry implementations — should depend on it. External code that reaches for ServerEngine is opting into a breakage-prone dependency.

  • Method Details

    • responseMapper

      ProtocolResponseMapper responseMapper()
      Returns the protocol response mapper for the default MCP version.
    • isStateless

      boolean isStateless()
      Returns true when running in stateless mode (no session persistence).
    • sessionIdGenerator

      SessionIdGenerator<? super io.netty.handler.codec.http.HttpRequest> sessionIdGenerator()
      Returns the configured session id generator.
    • setLoggingLevel

      void setLoggingLevel(String sessionId, LoggingLevel level)
      Sets the logging level for a session.
    • getLoggingLevel

      @Nullable LoggingLevel getLoggingLevel(String sessionId)
      Returns the logging level for a session, or null if not set.
    • resolveCapabilities

      ServerCapabilities resolveCapabilities()
      Resolves effective capabilities based on configuration and registered features.
    • broadcastNotification

      void broadcastNotification(String method, Object params)
      Sends a notification to all active sessions.
    • registerHandler

      void registerHandler(RpcMethodHandler handler)
      Registers a method handler keyed by its own method name.
    • registerHandler

      void registerHandler(String method, RpcMethodHandler handler)
      Registers a method handler with an explicit method name.
    • getHandler

      @Nullable RpcMethodHandler getHandler(String method)
      Returns the handler for a method, or null if not registered.
    • extensionForMethod

      @Nullable String extensionForMethod(String method)
      Returns the extension ID that owns the given method, or null if none.
    • extensionRequiresMeta

      boolean extensionRequiresMeta(String extensionId)
      Returns true if the given extension requires the meta envelope for its methods.
    • createSession

      Session createSession(String sessionId)
      Creates and registers a new session with the given ID.
    • getSession

      Optional<Session> getSession(String sessionId)
      Returns the session with the given ID, if present.
    • removeSession

      void removeSession(String sessionId)
      Removes and closes the session with the given ID.
    • sendNotification

      void sendNotification(Session session, String method, Object params)
      Sends a notification to the given session.
    • sendNotification

      void sendNotification(Session session, String method, @Nullable Object params, @Nullable OutboundSseStream stream)
      Sends a notification to the given session, optionally via a bound outbound SSE stream.
    • executor

      ExecutorService executor()
      Returns the executor used for handler dispatch.
    • tasksRegistry

      TaskRegistry tasksRegistry()
    • notifyTaskStatus

      void notifyTaskStatus(TaskEntry entry)
      Maps and sends a task status notification.
    • sendRequest

      CompletableFuture<String> sendRequest(Session session, String method, Object params)
      Sends a request to the client and returns a future that completes with the response.
    • sendRequest

      CompletableFuture<String> sendRequest(Session session, String method, Object params, @Nullable OutboundSseStream stream)
      Sends a request to the client, optionally via a bound outbound SSE stream, and returns a future.
    • completePendingRequest

      boolean completePendingRequest(@Nullable RequestId requestId, String resultJson)
      Completes a pending client request with the given result JSON. null requestId is a no-op.
    • failPendingRequest

      boolean failPendingRequest(@Nullable RequestId requestId, String message)
      Fails a pending client request with the given error message. null requestId is a no-op.
    • registerPendingRequest

      void registerPendingRequest(RequestId requestId, CompletableFuture<String> future)
      Registers a pending request with a timeout.
    • appendEvent

      void appendEvent(SessionEvent event)
      Appends an event to the session log.
    • replay

      List<SessionEvent> replay(String sessionId, long lastSeq)
      Replays session events after the given sequence number.
    • nextEventId

      long nextEventId()
      Returns and increments the event ID counter.
    • wireEventId

      static String wireEventId(long sseEventId, @Nullable String streamKey)
      Formats an SSE wire event id: the global counter value, suffixed with #<streamKey>.
    • toSseEvent

      static @Nullable SseEvent toSseEvent(SessionEvent event)
      Converts a session event to an SSE event, or returns null for non-transport events.