java.lang.Object
io.modelcontextprotocol.server.transport.StdioServerTransport
All Implemented Interfaces:
McpTransport, ServerMcpTransport

@Deprecated public class StdioServerTransport extends Object implements ServerMcpTransport
Deprecated.
This method will be removed in 0.9.0. Use StdioServerTransportProvider instead.
Implementation of the MCP Stdio transport for servers that communicates using standard input/output streams. Messages are exchanged as newline-delimited JSON-RPC messages over stdin/stdout, with errors and debug information sent to stderr.
Author:
Christian Tzolov
  • Constructor Details

    • StdioServerTransport

      public StdioServerTransport()
      Deprecated.
      Creates a new StdioServerTransport with a default ObjectMapper and System streams.
    • StdioServerTransport

      public StdioServerTransport(com.fasterxml.jackson.databind.ObjectMapper objectMapper)
      Deprecated.
      Creates a new StdioServerTransport with the specified ObjectMapper and System streams.
      Parameters:
      objectMapper - The ObjectMapper to use for JSON serialization/deserialization
  • Method Details

    • connect

      public reactor.core.publisher.Mono<Void> connect(Function<reactor.core.publisher.Mono<McpSchema.JSONRPCMessage>,reactor.core.publisher.Mono<McpSchema.JSONRPCMessage>> handler)
      Deprecated.
      Description copied from interface: McpTransport
      Initializes and starts the transport connection.

      This method should be called before any message exchange can occur. It sets up the necessary resources and establishes the connection to the server.

      Specified by:
      connect in interface McpTransport
    • sendMessage

      public reactor.core.publisher.Mono<Void> sendMessage(McpSchema.JSONRPCMessage message)
      Deprecated.
      Description copied from interface: McpTransport
      Sends a message to the peer asynchronously.

      This method handles the transmission of messages to the server in an asynchronous manner. Messages are sent in JSON-RPC format as specified by the MCP protocol.

      Specified by:
      sendMessage in interface McpTransport
      Parameters:
      message - the McpSchema.JSONRPCMessage to be sent to the server
      Returns:
      a reactor.core.publisher.Mono<Void> that completes when the message has been sent
    • closeGracefully

      public reactor.core.publisher.Mono<Void> closeGracefully()
      Deprecated.
      Description copied from interface: McpTransport
      Closes the transport connection and releases any associated resources asynchronously.
      Specified by:
      closeGracefully in interface McpTransport
      Returns:
      a reactor.core.publisher.Mono<Void> that completes when the connection has been closed.
    • unmarshalFrom

      public <T> T unmarshalFrom(Object data, com.fasterxml.jackson.core.type.TypeReference<T> typeRef)
      Deprecated.
      Description copied from interface: McpTransport
      Unmarshals the given data into an object of the specified type.
      Specified by:
      unmarshalFrom in interface McpTransport
      Type Parameters:
      T - the type of the object to unmarshal
      Parameters:
      data - the data to unmarshal
      typeRef - the type reference for the object to unmarshal
      Returns:
      the unmarshalled object