TsgcWSAPIServer_MCP › Events › OnMCPSessionNew
Raised every time a new MCP session is created.
property OnMCPSessionNew: TsgcAI_MCP_Server_OnSessionNewEvent;
// TsgcAI_MCP_Server_OnSessionNewEvent = procedure(Sender: TObject; const aSession: TsgcAI_MCP_Session) of object
—
Fires the first time the server sees a client’s Mcp-Session-Id header or, when missing, when a new session record is added on the fly. Use it to allocate per-session caches, emit audit entries, or attach application-specific state to aSession. The session is already registered in MCPServer.Sessions when the event fires.
procedure TMainForm.MCPServerMCPSessionNew(Sender: TObject;
const aSession: TsgcAI_MCP_Session);
begin
MemoLog.Lines.Add('#session_new ' + aSession.Id);
end;