Class StdioServerTransport
java.lang.Object
io.modelcontextprotocol.server.transport.StdioServerTransport
- All Implemented Interfaces:
McpTransport,ServerMcpTransport
Deprecated.
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 Summary
ConstructorsConstructorDescriptionDeprecated.Creates a new StdioServerTransport with a default ObjectMapper and System streams.StdioServerTransport(com.fasterxml.jackson.databind.ObjectMapper objectMapper) Deprecated.Creates a new StdioServerTransport with the specified ObjectMapper and System streams. -
Method Summary
Modifier and TypeMethodDescriptionreactor.core.publisher.Mono<Void>Deprecated.Closes the transport connection and releases any associated resources asynchronously.reactor.core.publisher.Mono<Void>connect(Function<reactor.core.publisher.Mono<McpSchema.JSONRPCMessage>, reactor.core.publisher.Mono<McpSchema.JSONRPCMessage>> handler) Deprecated.Initializes and starts the transport connection.reactor.core.publisher.Mono<Void>sendMessage(McpSchema.JSONRPCMessage message) Deprecated.Sends a message to the peer asynchronously.<T> TunmarshalFrom(Object data, com.fasterxml.jackson.core.type.TypeReference<T> typeRef) Deprecated.Unmarshals the given data into an object of the specified type.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface io.modelcontextprotocol.spec.McpTransport
close
-
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:McpTransportInitializes 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:
connectin interfaceMcpTransport
-
sendMessage
Deprecated.Description copied from interface:McpTransportSends 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:
sendMessagein interfaceMcpTransport- Parameters:
message- theMcpSchema.JSONRPCMessageto be sent to the server- Returns:
- a
reactor.core.publisher.Mono<Void>that completes when the message has been sent
-
closeGracefully
Deprecated.Description copied from interface:McpTransportCloses the transport connection and releases any associated resources asynchronously.- Specified by:
closeGracefullyin interfaceMcpTransport- Returns:
- a
reactor.core.publisher.Mono<Void>that completes when the connection has been closed.
-
unmarshalFrom
Deprecated.Description copied from interface:McpTransportUnmarshals the given data into an object of the specified type.- Specified by:
unmarshalFromin interfaceMcpTransport- Type Parameters:
T- the type of the object to unmarshal- Parameters:
data- the data to unmarshaltypeRef- the type reference for the object to unmarshal- Returns:
- the unmarshalled object
-
StdioServerTransportProviderinstead.