Class StdioServerTransportProviderReplacement

java.lang.Object
io.micronaut.mcp.server.stdio.StdioServerTransportProviderReplacement
All Implemented Interfaces:
io.modelcontextprotocol.spec.McpServerTransportProvider, io.modelcontextprotocol.spec.McpServerTransportProviderBase

@Internal public final class StdioServerTransportProviderReplacement extends Object implements io.modelcontextprotocol.spec.McpServerTransportProvider
Replacement for the MCP Java SDK StdioTransportProvider.

The only behavioral change from the upstream implementation is in setSessionFactory(io.modelcontextprotocol.spec.McpServerSession.Factory): the created StdioMcpSessionTransport anonymously overrides McpTransport.sendMessage(io.modelcontextprotocol.spec.McpSchema.JSONRPCMessage) to normalize outbound McpSchema.JSONRPCResponse values via JsonRrpcResponseUtils.map(io.modelcontextprotocol.spec.McpSchema.JSONRPCResponse) before delegating. All other behavior mirrors the upstream provider.

  • Constructor Details

    • StdioServerTransportProviderReplacement

      public StdioServerTransportProviderReplacement(io.modelcontextprotocol.json.McpJsonMapper jsonMapper)
      Creates a new StdioServerTransportProvider with the specified ObjectMapper and System streams.
      Parameters:
      jsonMapper - The JsonMapper to use for JSON serialization/deserialization
    • StdioServerTransportProviderReplacement

      public StdioServerTransportProviderReplacement(io.modelcontextprotocol.json.McpJsonMapper jsonMapper, InputStream inputStream, OutputStream outputStream)
      Creates a new StdioServerTransportProvider with the specified ObjectMapper and streams.
      Parameters:
      jsonMapper - The JsonMapper to use for JSON serialization/deserialization
      inputStream - The input stream to read from
      outputStream - The output stream to write to
  • Method Details

    • protocolVersions

      public List<String> protocolVersions()
      Specified by:
      protocolVersions in interface io.modelcontextprotocol.spec.McpServerTransportProviderBase
    • setSessionFactory

      public void setSessionFactory(io.modelcontextprotocol.spec.McpServerSession.Factory sessionFactory)
      Specified by:
      setSessionFactory in interface io.modelcontextprotocol.spec.McpServerTransportProvider
    • notifyClients

      public reactor.core.publisher.Mono<Void> notifyClients(String method, Object params)
      Specified by:
      notifyClients in interface io.modelcontextprotocol.spec.McpServerTransportProviderBase
    • closeGracefully

      public reactor.core.publisher.Mono<Void> closeGracefully()
      Specified by:
      closeGracefully in interface io.modelcontextprotocol.spec.McpServerTransportProviderBase