Skip to content

mcp server: get session from exchange #214

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
*
* @author Dariusz Jędrzejczyk
* @author Christian Tzolov
* @author lambochen
*/
public class McpAsyncServerExchange {

Expand Down Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,15 @@
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
* exchange provides methods to interact with the client and query its capabilities.
*
* @author Dariusz Jędrzejczyk
* @author Christian Tzolov
* @author lambochen
*/
public class McpSyncServerExchange {

Expand All @@ -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
Expand Down