class documentation

A single MCP session held open by a dedicated owner task.

_run enters and exits the session's context manager in the same task for the connection's whole lifetime; list_tools / call_tool activities on the same event loop call through the shared session (MCP multiplexes concurrent requests by id).

Method __init__ Undocumented
Async Method aclose Signal the owner task to exit its context manager and wait for it.
Method acquire Mark a call in flight; pause idle eviction while calls are active.
Method release Mark a call done; arm idle eviction once no calls remain in flight.
Async Method session Return the live session, or raise the connect failure.
Async Method _maybe_evict Undocumented
Method _on_idle Undocumented
Async Method _run Undocumented
Instance Variable _idle_handle Undocumented
Instance Variable _idle_timeout Undocumented
Instance Variable _inflight Undocumented
Instance Variable _owner Undocumented
Instance Variable _ready Undocumented
Instance Variable _server Undocumented
Instance Variable _stop Undocumented
def __init__(self, server: str, factory: McpSessionFactory, idle_timeout: timedelta): (source)

Undocumented

async def aclose(self): (source)

Signal the owner task to exit its context manager and wait for it.

def acquire(self): (source)

Mark a call in flight; pause idle eviction while calls are active.

def release(self): (source)

Mark a call done; arm idle eviction once no calls remain in flight.

async def session(self) -> ClientSession: (source)

Return the live session, or raise the connect failure.

async def _maybe_evict(self): (source)

Undocumented

def _on_idle(self): (source)

Undocumented

async def _run(self, factory: McpSessionFactory): (source)

Undocumented

Undocumented

_idle_timeout = (source)

Undocumented

_inflight: int = (source)

Undocumented

Undocumented

_ready: asyncio.Future[ClientSession] = (source)

Undocumented

Undocumented

Undocumented