Skip to content

Commit 3bb5c28

Browse files
committed
Merge branch 'main' into issue115/httpClientSseClientTransport_internal
2 parents a34ca8b + 391ec19 commit 3bb5c28

File tree

11 files changed

+14
-17
lines changed

11 files changed

+14
-17
lines changed

mcp-spring/mcp-spring-webflux/src/main/java/io/modelcontextprotocol/server/transport/WebFluxSseServerTransportProvider.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,7 @@ public void setSessionFactory(McpServerSession.Factory sessionFactory) {
188188
* errors if any session fails to receive the message
189189
*/
190190
@Override
191-
public Mono<Void> notifyClients(String method, Map<String, Object> params) {
191+
public Mono<Void> notifyClients(String method, Object params) {
192192
if (sessions.isEmpty()) {
193193
logger.debug("No active sessions to broadcast message to");
194194
return Mono.empty();

mcp-spring/mcp-spring-webmvc/src/main/java/io/modelcontextprotocol/server/transport/WebMvcSseServerTransportProvider.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,7 @@ public void setSessionFactory(McpServerSession.Factory sessionFactory) {
179179
* @return A Mono that completes when the broadcast attempt is finished
180180
*/
181181
@Override
182-
public Mono<Void> notifyClients(String method, Map<String, Object> params) {
182+
public Mono<Void> notifyClients(String method, Object params) {
183183
if (sessions.isEmpty()) {
184184
logger.debug("No active sessions to broadcast message to");
185185
return Mono.empty();

mcp/src/main/java/io/modelcontextprotocol/server/McpAsyncServer.java

+2-5
Original file line numberDiff line numberDiff line change
@@ -669,15 +669,12 @@ public Mono<Void> loggingNotification(LoggingMessageNotification loggingMessageN
669669
return Mono.error(new McpError("Logging message must not be null"));
670670
}
671671

672-
Map<String, Object> params = this.objectMapper.convertValue(loggingMessageNotification,
673-
new TypeReference<Map<String, Object>>() {
674-
});
675-
676672
if (loggingMessageNotification.level().level() < minLoggingLevel.level()) {
677673
return Mono.empty();
678674
}
679675

680-
return this.mcpTransportProvider.notifyClients(McpSchema.METHOD_NOTIFICATION_MESSAGE, params);
676+
return this.mcpTransportProvider.notifyClients(McpSchema.METHOD_NOTIFICATION_MESSAGE,
677+
loggingMessageNotification);
681678
}
682679

683680
private McpServerSession.RequestHandler<Void> setLoggerRequestHandler() {

mcp/src/main/java/io/modelcontextprotocol/server/transport/HttpServletSseServerTransportProvider.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@ public void setSessionFactory(McpServerSession.Factory sessionFactory) {
160160
* @return A Mono that completes when the broadcast attempt is finished
161161
*/
162162
@Override
163-
public Mono<Void> notifyClients(String method, Map<String, Object> params) {
163+
public Mono<Void> notifyClients(String method, Object params) {
164164
if (sessions.isEmpty()) {
165165
logger.debug("No active sessions to broadcast message to");
166166
return Mono.empty();

mcp/src/main/java/io/modelcontextprotocol/server/transport/StdioServerTransportProvider.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ public void setSessionFactory(McpServerSession.Factory sessionFactory) {
9999
}
100100

101101
@Override
102-
public Mono<Void> notifyClients(String method, Map<String, Object> params) {
102+
public Mono<Void> notifyClients(String method, Object params) {
103103
if (this.session == null) {
104104
return Mono.error(new McpError("No session to close"));
105105
}

mcp/src/main/java/io/modelcontextprotocol/spec/McpClientSession.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -258,7 +258,7 @@ public <T> Mono<T> sendRequest(String method, Object requestParams, TypeReferenc
258258
* @return A Mono that completes when the notification is sent
259259
*/
260260
@Override
261-
public Mono<Void> sendNotification(String method, Map<String, Object> params) {
261+
public Mono<Void> sendNotification(String method, Object params) {
262262
McpSchema.JSONRPCNotification jsonrpcNotification = new McpSchema.JSONRPCNotification(McpSchema.JSONRPC_VERSION,
263263
method, params);
264264
return this.transport.sendMessage(jsonrpcNotification);

mcp/src/main/java/io/modelcontextprotocol/spec/McpSchema.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -191,7 +191,7 @@ public record JSONRPCRequest( // @formatter:off
191191
public record JSONRPCNotification( // @formatter:off
192192
@JsonProperty("jsonrpc") String jsonrpc,
193193
@JsonProperty("method") String method,
194-
@JsonProperty("params") Map<String, Object> params) implements JSONRPCMessage {
194+
@JsonProperty("params") Object params) implements JSONRPCMessage {
195195
} // @formatter:on
196196

197197
@JsonInclude(JsonInclude.Include.NON_ABSENT)

mcp/src/main/java/io/modelcontextprotocol/spec/McpServerSession.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ public <T> Mono<T> sendRequest(String method, Object requestParams, TypeReferenc
132132
}
133133

134134
@Override
135-
public Mono<Void> sendNotification(String method, Map<String, Object> params) {
135+
public Mono<Void> sendNotification(String method, Object params) {
136136
McpSchema.JSONRPCNotification jsonrpcNotification = new McpSchema.JSONRPCNotification(McpSchema.JSONRPC_VERSION,
137137
method, params);
138138
return this.transport.sendMessage(jsonrpcNotification);

mcp/src/main/java/io/modelcontextprotocol/spec/McpServerTransportProvider.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -42,11 +42,11 @@ public interface McpServerTransportProvider {
4242
/**
4343
* Sends a notification to all connected clients.
4444
* @param method the name of the notification method to be called on the clients
45-
* @param params a map of parameters to be sent with the notification
45+
* @param params parameters to be sent with the notification
4646
* @return a Mono that completes when the notification has been broadcast
4747
* @see McpSession#sendNotification(String, Map)
4848
*/
49-
Mono<Void> notifyClients(String method, Map<String, Object> params);
49+
Mono<Void> notifyClients(String method, Object params);
5050

5151
/**
5252
* Immediately closes all the transports with connected clients and releases any

mcp/src/main/java/io/modelcontextprotocol/spec/McpSession.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -63,10 +63,10 @@ default Mono<Void> sendNotification(String method) {
6363
* parameters with the notification.
6464
* </p>
6565
* @param method the name of the notification method to be sent to the counterparty
66-
* @param params a map of parameters to be sent with the notification
66+
* @param params parameters to be sent with the notification
6767
* @return a Mono that completes when the notification has been sent
6868
*/
69-
Mono<Void> sendNotification(String method, Map<String, Object> params);
69+
Mono<Void> sendNotification(String method, Object params);
7070

7171
/**
7272
* Closes the session and releases any associated resources asynchronously.

mcp/src/test/java/io/modelcontextprotocol/MockMcpServerTransportProvider.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ public void setSessionFactory(Factory sessionFactory) {
4747
}
4848

4949
@Override
50-
public Mono<Void> notifyClients(String method, Map<String, Object> params) {
50+
public Mono<Void> notifyClients(String method, Object params) {
5151
return session.sendNotification(method, params);
5252
}
5353

0 commit comments

Comments
 (0)