public class WebRxSseServerTransportProvider extends java.lang.Object implements McpServerTransportProvider, IMcpHttpServerTransport
Key features:
The transport operates on two main endpoints:
/sse
- The SSE endpoint where clients establish their event stream
connection
This implementation uses ConcurrentHashMap
to safely manage multiple client
sessions in a thread-safe manner. Each client session is assigned a unique ID and
maintains its own SSE connection.
McpServerTransportProvider
,
Handler
限定符和类型 | 类和说明 |
---|---|
static class |
WebRxSseServerTransportProvider.Builder
Builder for creating instances of WebMvcSseServerTransportProvider.
|
限定符和类型 | 字段和说明 |
---|---|
static java.lang.String |
DEFAULT_SSE_ENDPOINT
Default SSE endpoint path as specified by the MCP transport specification.
|
static java.lang.String |
ENDPOINT_EVENT_TYPE
Event type for sending the message endpoint URI to clients.
|
static java.lang.String |
MESSAGE_EVENT_TYPE
Event type for JSON-RPC messages sent through the SSE connection.
|
构造器和说明 |
---|
WebRxSseServerTransportProvider(com.fasterxml.jackson.databind.ObjectMapper objectMapper,
java.lang.String baseUrl,
java.lang.String messageEndpoint,
java.lang.String sseEndpoint,
McpTransportContextExtractor<org.noear.solon.core.handle.Context> contextExtractor,
java.time.Duration keepAliveInterval)
已过时。
Use the builder
builder() instead for better configuration
options. |
限定符和类型 | 方法和说明 |
---|---|
static WebRxSseServerTransportProvider.Builder |
builder()
Creates a new Builder instance for configuring and creating instances of
WebMvcSseServerTransportProvider.
|
reactor.core.publisher.Mono<java.lang.Void> |
closeGracefully()
Initiates a graceful shutdown of the transport.
|
java.lang.String |
getMcpEndpoint() |
reactor.core.publisher.Mono<java.lang.Void> |
notifyClients(java.lang.String method,
java.lang.Object params)
Broadcasts a notification to all connected clients through their SSE connections.
|
java.util.List<java.lang.String> |
protocolVersions()
Returns the protocol version supported by this transport provider.
|
void |
setSessionFactory(McpServerSession.Factory sessionFactory)
Sets the session factory that will be used to create sessions for new clients.
|
void |
toHttpHandler(org.noear.solon.SolonApp app) |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
close
public static final java.lang.String MESSAGE_EVENT_TYPE
public static final java.lang.String ENDPOINT_EVENT_TYPE
public static final java.lang.String DEFAULT_SSE_ENDPOINT
@Deprecated public WebRxSseServerTransportProvider(com.fasterxml.jackson.databind.ObjectMapper objectMapper, java.lang.String baseUrl, java.lang.String messageEndpoint, java.lang.String sseEndpoint, McpTransportContextExtractor<org.noear.solon.core.handle.Context> contextExtractor, java.time.Duration keepAliveInterval)
builder()
instead for better configuration
options.objectMapper
- The ObjectMapper to use for JSON serialization/deserialization
of messages.baseUrl
- The base URL for the message endpoint, used to construct the full
endpoint URL for clients.messageEndpoint
- The endpoint URI where clients should send their JSON-RPC
messages via HTTP POST. This endpoint will be communicated to clients through the
SSE connection's initial endpoint event.sseEndpoint
- The endpoint URI where clients establish their SSE connections.
* @param keepAliveInterval The interval for sending keep-alive messages tojava.lang.IllegalArgumentException
- if any parameter is nullpublic void toHttpHandler(org.noear.solon.SolonApp app)
toHttpHandler
在接口中 IMcpHttpServerTransport
public java.lang.String getMcpEndpoint()
getMcpEndpoint
在接口中 IMcpHttpServerTransport
public java.util.List<java.lang.String> protocolVersions()
McpServerTransportProviderBase
protocolVersions
在接口中 McpServerTransportProviderBase
public void setSessionFactory(McpServerSession.Factory sessionFactory)
McpServerTransportProvider
setSessionFactory
在接口中 McpServerTransportProvider
sessionFactory
- the session factory to be used for initiating client sessionspublic reactor.core.publisher.Mono<java.lang.Void> notifyClients(java.lang.String method, java.lang.Object params)
notifyClients
在接口中 McpServerTransportProviderBase
method
- The method name for the notificationparams
- The parameters for the notificationMcpSession#sendNotification(String, Map)
public reactor.core.publisher.Mono<java.lang.Void> closeGracefully()
closeGracefully
在接口中 McpServerTransportProviderBase
public static WebRxSseServerTransportProvider.Builder builder()