NAME

MCP::Server::Session - Session container

SYNOPSIS

use MCP::Server::Session;

my $session = MCP::Server::Session->new(id => '12345');
$session->touch;

DESCRIPTION

MCP::Server::Session is a container for per-session state.

ATTRIBUTES

MCP::Server::Session implements the following attributes.

id

my $id   = $session->id;
$session = $session->id('12345');

The session identifier.

last_used

my $time = $session->last_used;
$session = $session->last_used(time);

Epoch seconds of the last activity on this session, defaults to the time the session was created. Updated by "touch".

stream

my $stream = $session->stream;
$session   = $session->stream(Mojolicious::Controller->new);

The Mojolicious::Controller currently serving the server-to-client SSE stream for this session, or undef if no stream is open.

METHODS

MCP::Server::Session inherits all methods from Mojo::Base and implements the following new ones.

touch

$session = $session->touch;

Set "last_used" to the current time.

SEE ALSO

MCP, https://mojolicious.org, https://modelcontextprotocol.io.