Skip to main content

fastmcp.server.providers.aggregate

AggregateProvider for combining multiple providers into one. This module provides AggregateProvider, a utility class that presents multiple providers as a single unified provider. Useful when you want to combine custom providers without creating a full FastMCP server. Example:
from fastmcp.server.providers import AggregateProvider

# Combine multiple providers into one
combined = AggregateProvider([provider1, provider2, provider3])

# Use like any other provider
tools = await combined.list_tools()

Classes

AggregateProvider

Utility provider that combines multiple providers into one. Components are aggregated from all providers. For get_* operations, providers are queried in parallel and the highest version is returned. Errors from individual providers are logged and skipped (graceful degradation). This is useful when you want to combine custom providers without creating a full FastMCP server. Methods:

get_tasks

get_tasks(self) -> Sequence[FastMCPComponent]
Get all task-eligible components from all providers.

lifespan

lifespan(self) -> AsyncIterator[None]
Combine lifespans of all providers.