diff --git a/mcp/src/main/java/io/modelcontextprotocol/server/McpAsyncServerExchange.java b/mcp/src/main/java/io/modelcontextprotocol/server/McpAsyncServerExchange.java index 889dc66d..830c6db5 100644 --- a/mcp/src/main/java/io/modelcontextprotocol/server/McpAsyncServerExchange.java +++ b/mcp/src/main/java/io/modelcontextprotocol/server/McpAsyncServerExchange.java @@ -19,6 +19,7 @@ * * @author Dariusz Jędrzejczyk * @author Christian Tzolov + * @author lambochen */ public class McpAsyncServerExchange { @@ -50,6 +51,14 @@ public McpAsyncServerExchange(McpServerSession session, McpSchema.ClientCapabili this.clientInfo = clientInfo; } + /** + * Get the server session. + * @return The server session. + */ + public McpServerSession getSession() { + return session; + } + /** * Get the client capabilities that define the supported features and functionality. * @return The client capabilities diff --git a/mcp/src/main/java/io/modelcontextprotocol/server/McpSyncServerExchange.java b/mcp/src/main/java/io/modelcontextprotocol/server/McpSyncServerExchange.java index 52360e54..c1344c36 100644 --- a/mcp/src/main/java/io/modelcontextprotocol/server/McpSyncServerExchange.java +++ b/mcp/src/main/java/io/modelcontextprotocol/server/McpSyncServerExchange.java @@ -7,6 +7,7 @@ import io.modelcontextprotocol.spec.McpSchema; import io.modelcontextprotocol.spec.McpSchema.LoggingLevel; import io.modelcontextprotocol.spec.McpSchema.LoggingMessageNotification; +import io.modelcontextprotocol.spec.McpServerSession; /** * Represents a synchronous exchange with a Model Context Protocol (MCP) client. The @@ -14,6 +15,7 @@ * * @author Dariusz Jędrzejczyk * @author Christian Tzolov + * @author lambochen */ public class McpSyncServerExchange { @@ -28,6 +30,14 @@ public McpSyncServerExchange(McpAsyncServerExchange exchange) { this.exchange = exchange; } + /** + * Get the server session. + * @return The server session. + */ + public McpServerSession getSession() { + return this.exchange.getSession(); + } + /** * Get the client capabilities that define the supported features and functionality. * @return The client capabilities