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
WebRxSseServerTransportProvider. |
| 限定符和类型 | 字段和说明 |
|---|---|
static java.lang.String |
DEFAULT_BASE_URL |
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.
|
static java.lang.String |
SESSION_ID |
| 构造器和说明 |
|---|
WebRxSseServerTransportProvider(McpJsonMapper jsonMapper,
java.lang.String baseUrl,
java.lang.String messageEndpoint,
java.lang.String sseEndpoint,
java.time.Duration keepAliveInterval,
McpTransportContextExtractor<org.noear.solon.core.handle.Context> contextExtractor)
已过时。
Use the builder
builder() instead for better configuration
options. |
| 限定符和类型 | 方法和说明 |
|---|---|
static WebRxSseServerTransportProvider.Builder |
builder() |
reactor.core.publisher.Mono<java.lang.Void> |
closeGracefully()
Initiates a graceful shutdown of all the sessions.
|
java.lang.String |
getMcpEndpoint() |
reactor.core.publisher.Mono<java.lang.Void> |
notifyClients(java.lang.String method,
java.lang.Object params)
Broadcasts a JSON-RPC message 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, waitclosepublic 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
public static final java.lang.String SESSION_ID
public static final java.lang.String DEFAULT_BASE_URL
@Deprecated public WebRxSseServerTransportProvider(McpJsonMapper jsonMapper, java.lang.String baseUrl, java.lang.String messageEndpoint, java.lang.String sseEndpoint, java.time.Duration keepAliveInterval, McpTransportContextExtractor<org.noear.solon.core.handle.Context> contextExtractor)
builder() instead for better configuration
options.jsonMapper - 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 在接口中 IMcpHttpServerTransportpublic java.lang.String getMcpEndpoint()
getMcpEndpoint 在接口中 IMcpHttpServerTransportpublic java.util.List<java.lang.String> protocolVersions()
McpServerTransportProviderBaseprotocolVersions 在接口中 McpServerTransportProviderBasepublic void setSessionFactory(McpServerSession.Factory sessionFactory)
McpServerTransportProvidersetSessionFactory 在接口中 McpServerTransportProvidersessionFactory - 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)
The method:
notifyClients 在接口中 McpServerTransportProviderBasemethod - The JSON-RPC method to send to clientsparams - The method parameters to send to clientsMcpSession#sendNotification(String, Map)public reactor.core.publisher.Mono<java.lang.Void> closeGracefully()
closeGracefully 在接口中 McpServerTransportProviderBasepublic static WebRxSseServerTransportProvider.Builder builder()