38
38
import org .springframework .ai .mcp .spec .McpError ;
39
39
import org .springframework .ai .mcp .spec .McpSchema ;
40
40
import org .springframework .ai .mcp .spec .McpSchema .CallToolResult ;
41
+ import org .springframework .ai .mcp .spec .McpSchema .ClientCapabilities ;
41
42
import org .springframework .ai .mcp .spec .McpSchema .LoggingLevel ;
42
43
import org .springframework .ai .mcp .spec .McpSchema .LoggingMessageNotification ;
43
44
import org .springframework .ai .mcp .spec .McpSchema .Tool ;
@@ -66,6 +67,10 @@ public class McpAsyncServer {
66
67
67
68
private final McpSchema .Implementation serverInfo ;
68
69
70
+ private McpSchema .ClientCapabilities clientCapabilities ;
71
+
72
+ private McpSchema .Implementation clientInfo ;
73
+
69
74
/**
70
75
* Thread-safe list of tool handlers that can be modified at runtime.
71
76
*/
@@ -165,6 +170,9 @@ private DefaultMcpSession.RequestHandler initializeRequestHandler() {
165
170
new TypeReference <McpSchema .InitializeRequest >() {
166
171
});
167
172
173
+ this .clientCapabilities = initializeRequest .capabilities ();
174
+ this .clientInfo = initializeRequest .clientInfo ();
175
+
168
176
logger .info ("Client initialize request - Protocol: {}, Capabilities: {}, Info: {}" ,
169
177
initializeRequest .protocolVersion (), initializeRequest .capabilities (),
170
178
initializeRequest .clientInfo ());
@@ -183,6 +191,38 @@ private DefaultMcpSession.RequestHandler initializeRequestHandler() {
183
191
};
184
192
}
185
193
194
+ /**
195
+ * Get the server capabilities that define the supported features and functionality.
196
+ * @return The server capabilities
197
+ */
198
+ public McpSchema .ServerCapabilities getServerCapabilities () {
199
+ return this .serverCapabilities ;
200
+ }
201
+
202
+ /**
203
+ * Get the server implementation information.
204
+ * @return The server implementation details
205
+ */
206
+ public McpSchema .Implementation getServerInfo () {
207
+ return this .serverInfo ;
208
+ }
209
+
210
+ /**
211
+ * Get the client capabilities that define the supported features and functionality.
212
+ * @return The client capabilities
213
+ */
214
+ public ClientCapabilities getClientCapabilities () {
215
+ return this .clientCapabilities ;
216
+ }
217
+
218
+ /**
219
+ * Get the client implementation information.
220
+ * @return The client implementation details
221
+ */
222
+ public McpSchema .Implementation getClientInfo () {
223
+ return this .clientInfo ;
224
+ }
225
+
186
226
/**
187
227
* Gracefully closes the server, allowing any in-progress operations to complete.
188
228
* @return A Mono that completes when the server has been closed
0 commit comments