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) void
setSessionFactory
(io.modelcontextprotocol.spec.McpServerSession.Factory sessionFactory) Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Methods 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:
protocolVersions
in interfaceio.modelcontextprotocol.spec.McpServerTransportProviderBase
-
setSessionFactory
public void setSessionFactory(io.modelcontextprotocol.spec.McpServerSession.Factory sessionFactory) - Specified by:
setSessionFactory
in interfaceio.modelcontextprotocol.spec.McpServerTransportProvider
-
notifyClients
- Specified by:
notifyClients
in interfaceio.modelcontextprotocol.spec.McpServerTransportProviderBase
-
closeGracefully
- Specified by:
closeGracefully
in interfaceio.modelcontextprotocol.spec.McpServerTransportProviderBase
-