Skip to content

Server-side Stateful Sessions #129

@headlessButSmart

Description

@headlessButSmart

During integration of MCP Server capabilities into our platform, we've come across a use case where we need to utilize certain session specific parameters across all RPC calls during the session. We are utilizing our own transport layer and utilizing core functionality only with a different approach to sessions, so this may not be 100% relevant for all, but, two minor changes would open up new capabilities:

  1. Adding a generic "Map<String, Object> sessionParameters" variable to McpServerSession
  2. Making "session" variable within McpAsyncServerExchange & McpSyncServerExchange accessible

With these two, information such as requestor profile can be passed with an initial request and made accessible in tool calls:

(exchange, arguments) -> {
	McpServerSession session = exchange.getSession();
	Map<String, Object> sessionParameters = session.getSessionParameters();
	//Enriched tool call with arguments & sessionParameters
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions