Skip to main content

fastmcp.server.mixins.lifespan

Lifespan infrastructure for FastMCP Server.

Classes

LifespanMixin

Mixin providing lifespan infrastructure for FastMCP. Methods:

docket

The Docket instance owned by this server, if the tasks extension is active. Returns the Docket that the tasks extension initialized as the root of a runtime tree, or None when no task backend is running. Mounted children do not own their own Docket — they share the root’s via _current_docket ContextVar inheritance — so accessing .docket on a mounted child returns None even while its tasks run on the root’s Docket.