Package io.micronaut.mcp.server.stdio
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 Summary
ConstructorsConstructorDescriptionStdioServerTransportProviderReplacement(io.modelcontextprotocol.json.McpJsonMapper jsonMapper) Creates a new StdioServerTransportProvider with the specified ObjectMapper and System streams.StdioServerTransportProviderReplacement(io.modelcontextprotocol.json.McpJsonMapper jsonMapper, InputStream inputStream, OutputStream outputStream) Creates a new StdioServerTransportProvider with the specified ObjectMapper and streams. -
Method Summary
Modifier and TypeMethodDescriptionreactor.core.publisher.Mono<Void>reactor.core.publisher.Mono<Void>notifyClients(String method, Object params) voidsetSessionFactory(io.modelcontextprotocol.spec.McpServerSession.Factory sessionFactory) Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface io.modelcontextprotocol.spec.McpServerTransportProviderBase
close
-
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/deserializationinputStream- The input stream to read fromoutputStream- The output stream to write to
-
-
Method Details
-
protocolVersions
- Specified by:
protocolVersionsin interfaceio.modelcontextprotocol.spec.McpServerTransportProviderBase
-
setSessionFactory
public void setSessionFactory(io.modelcontextprotocol.spec.McpServerSession.Factory sessionFactory) - Specified by:
setSessionFactoryin interfaceio.modelcontextprotocol.spec.McpServerTransportProvider
-
notifyClients
- Specified by:
notifyClientsin interfaceio.modelcontextprotocol.spec.McpServerTransportProviderBase
-
closeGracefully
- Specified by:
closeGracefullyin interfaceio.modelcontextprotocol.spec.McpServerTransportProviderBase
-